Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/crufty/artifact_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@
pub enum ArtifactType {
Rust,
Scala,
JavaMaven,
Custom {
pattern: &'static str,
name: &'static str,
files: &'static [&'static str],
},
}

pub fn builtin() -> [ArtifactType; 2] {
[ArtifactType::Rust, ArtifactType::Scala]
pub fn builtin() -> [ArtifactType; 3] {
[
ArtifactType::Rust,
ArtifactType::Scala,
ArtifactType::JavaMaven,
]
}

impl ArtifactType {
pub fn pattern(&self) -> &'static str {
match self {
ArtifactType::Rust => "**/target",
ArtifactType::Scala => "**/target",
ArtifactType::JavaMaven => "**/target",
ArtifactType::Custom { pattern, .. } => pattern,
}
}
Expand All @@ -27,6 +33,7 @@ impl ArtifactType {
match self {
ArtifactType::Rust => "Rust",
ArtifactType::Scala => "Scala",
ArtifactType::JavaMaven => "Java",
ArtifactType::Custom { name, .. } => name,
}
}
Expand All @@ -35,6 +42,7 @@ impl ArtifactType {
match self {
ArtifactType::Rust => vec!["Cargo.toml".to_string()],
ArtifactType::Scala => vec!["build.sbt".to_string()],
ArtifactType::JavaMaven => vec!["pom.xml".to_string()],
ArtifactType::Custom { files, .. } => {
files.iter().map(|s| s.to_string()).collect()
}
Expand Down