Skip to content

Commit 8bbf05b

Browse files
committed
Filter outputs by lib target_kind
1 parent 4ee87d5 commit 8bbf05b

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Diff for: src/bin/cargo_semver.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub type Result<T> = cargo::util::CargoResult<T>;
2323
#[derive(Debug, Deserialize)]
2424
struct Invocation {
2525
package_name: String,
26+
target_kind: Vec<String>,
2627
outputs: Vec<PathBuf>,
2728
}
2829

@@ -436,18 +437,10 @@ impl<'a> WorkInfo<'a> {
436437

437438
// TODO: handle multiple outputs gracefully
438439
for i in &build_plan.invocations {
439-
if i.package_name == name {
440-
// FIXME: this is a hack to avoid picking up output artifacts of
441-
// build scrits and build programs (no outputs):
442-
let build_script = i
443-
.outputs
444-
.iter()
445-
.any(|v| v.to_str().unwrap().contains("build_script"));
446-
let build_program = i.outputs.is_empty();
447-
if build_script || build_program {
448-
continue;
440+
if let Some(kind) = i.target_kind.get(0) {
441+
if kind.contains("lib") && i.package_name == name {
442+
return Ok((i.outputs[0].clone(), compilation.deps_output));
449443
}
450-
return Ok((i.outputs[0].clone(), compilation.deps_output));
451444
}
452445
}
453446

0 commit comments

Comments
 (0)