Auto merge of #47035 - acfoltzer:dep-info-tweak, r=alexcrichton

Remove dep-info files as targets in themselves

If you ask `rustc` to `--emit dep-info`, the resulting dependency file contains a rule for producing the dependency file itself. This differs from the output of `gcc -MD` or `clang -MD`, which only includes dependency rules for the object files produced.

Tools like Ninja often consume and delete dependency files as soon as they’re produced for performance reasons, particularly on Windows. In the case of `rustc` output, though, the recently-deleted dependency file is cached by Ninja as a target, and therefore triggers a rebuild every time.

This very small patch removes the dep-info file from the list of output filenames, so it matches the behavior of gcc and clang.
This commit is contained in:
bors 2018-01-17 09:22:22 +00:00
commit 3e49ada752
2 changed files with 6 additions and 0 deletions

View File

@ -1236,6 +1236,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
overriding the default for the current target"),
human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],
"generate human-readable, predictable names for codegen units"),
dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
"in dep-info output, omit targets for tracking dependencies of the dep-info files \
themselves"),
}
pub fn default_lib_output() -> CrateType {

View File

@ -1162,6 +1162,9 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, crate_name: &str) {
out_filenames.push(p);
}
}
OutputType::DepInfo if sess.opts.debugging_opts.dep_info_omit_d_target => {
// Don't add the dep-info output when omitting it from dep-info targets
}
_ => {
out_filenames.push(file);
}