mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Fix dep-info files including non-local build script paths.
This commit is contained in:
parent
d95b29ba04
commit
2db502f766
@ -92,7 +92,7 @@ fn add_deps_for_unit(
|
|||||||
// Recursively traverse all transitive dependencies
|
// Recursively traverse all transitive dependencies
|
||||||
let unit_deps = Vec::from(cx.unit_deps(unit)); // Create vec due to mutable borrow.
|
let unit_deps = Vec::from(cx.unit_deps(unit)); // Create vec due to mutable borrow.
|
||||||
for dep in unit_deps {
|
for dep in unit_deps {
|
||||||
if unit.is_local() {
|
if dep.unit.is_local() {
|
||||||
add_deps_for_unit(deps, cx, &dep.unit, visited)?;
|
add_deps_for_unit(deps, cx, &dep.unit, visited)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! Tests for dep-info files. This includes the dep-info file Cargo creates in
|
//! Tests for dep-info files. This includes the dep-info file Cargo creates in
|
||||||
//! the output directory, and the ones stored in the fingerprint.
|
//! the output directory, and the ones stored in the fingerprint.
|
||||||
|
|
||||||
|
use cargo_test_support::compare::assert_match_exact;
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{
|
||||||
@ -575,3 +576,40 @@ fn canonical_path() {
|
|||||||
&[(0, "src/lib.rs"), (1, "debug/deps/libregdep-*.rmeta")],
|
&[(0, "src/lib.rs"), (1, "debug/deps/libregdep-*.rmeta")],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn non_local_build_script() {
|
||||||
|
// Non-local build script information is not included.
|
||||||
|
Package::new("bar", "1.0.0")
|
||||||
|
.file(
|
||||||
|
"build.rs",
|
||||||
|
r#"
|
||||||
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.publish();
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bar = "1.0"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("build").run();
|
||||||
|
let contents = p.read_file("target/debug/foo.d");
|
||||||
|
assert_match_exact(
|
||||||
|
"[ROOT]/foo/target/debug/foo[EXE]: [ROOT]/foo/src/main.rs",
|
||||||
|
&contents,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user