Skip to content

Commit

Permalink
Auto merge of #7057 - hugwijst:apple-depinfo, r=ehuss
Browse files Browse the repository at this point in the history
Fix overwriting .d file for binary with dSYM on apple targets.

When building a binary on targets containing `-apple-`, the resulting `.d` file gets overwritten with the dependencies of the `.dSYM` file. Eg. in the changed unit test, `foo.d` would start with `p.bin(foo).with_extension("dSYM")` instead of `p.bin(foo)`.

This PR fixes that problem by not generating `.d` dependency information files for outputs of the `DebugInfo` flavor.
  • Loading branch information
bors committed Jul 6, 2019
2 parents a3eee9f + 2c488c9 commit 644c808
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cargo/core/compiler/output_depinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};

use log::debug;

use super::{fingerprint, Context, Unit};
use super::{fingerprint, Context, FileFlavor, Unit};
use crate::util::paths;
use crate::util::{internal, CargoResult};

Expand Down Expand Up @@ -98,7 +98,11 @@ pub fn output_depinfo<'a, 'b>(cx: &mut Context<'a, 'b>, unit: &Unit<'a>) -> Carg
.map(|f| render_filename(f, basedir))
.collect::<CargoResult<Vec<_>>>()?;

for output in cx.outputs(unit)?.iter() {
for output in cx
.outputs(unit)?
.iter()
.filter(|o| o.flavor != FileFlavor::DebugInfo)
{
if let Some(ref link_dst) = output.hardlink {
let output_path = link_dst.with_extension("d");
if success {
Expand Down
7 changes: 7 additions & 0 deletions tests/testsuite/dep_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ fn build_dep_info() {
let depinfo_bin_path = &p.bin("foo").with_extension("d");

assert!(depinfo_bin_path.is_file());

let depinfo = p.read_file(depinfo_bin_path.to_str().unwrap());

let bin_path = p.bin("foo");
let src_path = p.root().join("src").join("foo.rs");
let expected_depinfo = format!("{}: {}\n", bin_path.display(), src_path.display());
assert_eq!(depinfo, expected_depinfo);
}

#[cargo_test]
Expand Down

0 comments on commit 644c808

Please sign in to comment.