Skip to content

Commit 7d137e4

Browse files
committed
Filter "custom-build" artifact kinds from automatching
If a project uses build.rs, cargo will add a "custom-build" artifact kind to the build which is confusing information because we can only use concrete compiled "bin" or "example" binaries for binutils, so let's only admit real "bin" or "example" kinds into the auto matcher. Fixes #81 Signed-off-by: Daniel Egger <daniel@eggers-club.de>
1 parent 80fe0a9 commit 7d137e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ enum BuildType<'a> {
120120
impl<'a> BuildType<'a> {
121121
fn matches(&self, artifact: &Artifact) -> bool {
122122
match self {
123-
BuildType::Any => true,
124123
BuildType::Bin(target_name)
125124
| BuildType::Example(target_name)
126125
| BuildType::Test(target_name)
@@ -129,6 +128,13 @@ impl<'a> BuildType<'a> {
129128
}
130129
// For info about 'kind' values see:
131130
// https://github.com/rust-lang/cargo/blob/d47a9545db81fe6d7e6c542bc8154f09d0e6c788/src/cargo/core/manifest.rs#L166-L181
131+
// The only "Any" artifacts we can support are bins and examples, so let's make sure
132+
// no-one slips us a "custom-build" in form of a build.rs in
133+
BuildType::Any => artifact
134+
.target
135+
.kind
136+
.iter()
137+
.any(|s| s == "bin" || s == "example"),
132138
// Since LibKind can be an arbitrary string `LibKind:Other(String)` we filter by what it can't be
133139
BuildType::Lib => artifact.target.kind.iter().any(|s| {
134140
s != "bin" && s != "example" && s != "test" && s != "custom-build" && s != "bench"

0 commit comments

Comments
 (0)