Skip to content

Commit b7e9ebd

Browse files
committed
Add support for libraries with build.rs
1 parent d430853 commit b7e9ebd

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

ci/run.sh

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -ex
44

5+
# Note: this is required for correctness,
6+
# otherwise executing multiple "full" tests in parallel
7+
# of the same library can alter results.
58
export RUST_TEST_THREADS=1
69
export RUST_BACKTRACE=full
710
#export RUST_TEST_NOCAPTURE=1

src/bin/cargo_semver.rs

+8
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,14 @@ impl<'a> WorkInfo<'a> {
419419
// TODO: handle multiple outputs gracefully
420420
for i in &build_plan.invocations {
421421
if i.package_name == name {
422+
// FIXME: this is a hack to avoid picking up output artifacts of
423+
// build scrits and build programs (no outputs):
424+
let build_script =
425+
i.outputs.iter().any(|v| v.to_str().unwrap().contains("build_script"));
426+
let build_program = i.outputs.is_empty();
427+
if build_script || build_program {
428+
continue;
429+
}
422430
return Ok((i.outputs[0].clone(), compilation.deps_output));
423431
}
424432
}

tests/full.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mod full {
4646
};
4747

4848
let out_file: PathBuf = format!("{}.{}", out_file.display(), file_ext).into();
49-
assert!(out_file.exists());
49+
assert!(out_file.exists(), "file `{}` does not exist", out_file.display());
5050

5151
if let Some(path) = env::var_os("PATH") {
5252
let mut paths = env::split_paths(&path).collect::<Vec<_>>();
@@ -94,7 +94,8 @@ mod full {
9494
.env("RUST_BACKTRACE", "full")
9595
.stdin(Stdio::null())
9696
.stdout(out_pipe)
97-
.stderr(err_pipe);
97+
.stderr(err_pipe)
98+
;
9899

99100
if let Ok(target) = std::env::var("TEST_TARGET") {
100101
cmd.args(&["--target", &target]);
@@ -137,7 +138,8 @@ mod full {
137138
}
138139

139140
full_test!(log, "log", "0.3.4", "0.3.8", true);
140-
full_test!(libc, "libc", "0.2.28", "0.2.31", false);
141+
full_test!(libc0, "libc", "0.2.28", "0.2.31", false);
142+
full_test!(libc1, "libc", "0.2.47", "0.2.48", true);
141143
// full_test!(mozjs, "mozjs", "0.2.0", "0.3.0");
142144
// full_test!(rand, "rand", "0.3.10", "0.3.16");
143145
// full_test!(serde_pre, "serde", "0.7.0", "1.0.0");
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version bump: 0.2.47 -> (patch) -> 0.2.48

0 commit comments

Comments
 (0)