ret.push((".wasm".to_string(), TargetFileType::Normal, true));
}
- // rust-lang/cargo#4490
- // - only uplift *.dSYM for binaries.
+ // rust-lang/cargo#4490, rust-lang/cargo#4960
+ // - only uplift debuginfo for binaries.
// tests are run directly from target/debug/deps/
- // and examples are inside target/debug/examples/ which already have *.dSYM next to them
+ // and examples are inside target/debug/examples/ which already have symbols next to them
// so no need to do anything.
- if target_triple.contains("-apple-") && *target_kind == TargetKind::Bin {
- ret.push((".dSYM".to_string(), TargetFileType::DebugInfo, false));
+ if *target_kind == TargetKind::Bin {
+ if target_triple.contains("-apple-") {
+ ret.push((".dSYM".to_string(), TargetFileType::DebugInfo, false));
+ } else if target_triple.ends_with("-msvc") {
+ ret.push((".pdb".to_string(), TargetFileType::DebugInfo, false));
+ }
}
ret
assert_that(&p.bin("d.dSYM"), is_not(existing_dir()));
}
+#[test]
+fn uplift_pdb_of_bin_on_windows() {
+ if !cfg!(all(target_os = "windows", target_env = "msvc")) {
+ return
+ }
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.1.0"
+ "#)
+ .file("src/main.rs", "fn main() { panic!(); }")
+ .file("src/bin/b.rs", "fn main() { panic!(); }")
+ .file("examples/c.rs", "fn main() { panic!(); }")
+ .file("tests/d.rs", "fn main() { panic!(); }")
+ .build();
+
+ assert_that(
+ p.cargo("build").arg("--bins").arg("--examples").arg("--tests"),
+ execs().with_status(0)
+ );
+ assert_that(&p.target_debug_dir().join("foo.pdb"), existing_file());
+ assert_that(&p.target_debug_dir().join("b.pdb"), existing_file());
+ assert_that(&p.target_debug_dir().join("c.pdb"), is_not(existing_file()));
+ assert_that(&p.target_debug_dir().join("d.pdb"), is_not(existing_file()));
+}
+
// Make sure that `cargo build` chooses the correct profile for building
// targets based on filters (assuming --profile is not specified).
#[test]