From 29aa9fde5dccf0babff4c29d6614e0b60c9d35c6 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 13 Aug 2020 15:46:21 -0700 Subject: [PATCH] Keep only out file dependency rule in output .d files Bug: 163408818 Test: mm in external/rust/crates Change-Id: I7ace46ca985813f292ce3429196defc5f234cf6b --- rust/builder.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust/builder.go b/rust/builder.go index 45cd268e9..654b1e6bf 100644 --- a/rust/builder.go +++ b/rust/builder.go @@ -31,9 +31,14 @@ var ( Command: "$envVars $rustcCmd " + "-C linker=${config.RustLinker} " + "-C link-args=\"${crtBegin} ${config.RustLinkerArgs} ${linkFlags} ${crtEnd}\" " + - "--emit link -o $out --emit dep-info=$out.d $in ${libFlags} $rustcFlags", + "--emit link -o $out --emit dep-info=$out.d.raw $in ${libFlags} $rustcFlags" + + " && grep \"^$out:\" $out.d.raw > $out.d", CommandDeps: []string{"$rustcCmd"}, // Rustc deps-info writes out make compatible dep files: https://github.com/rust-lang/rust/issues/7633 + // Rustc emits unneeded dependency lines for the .d and input .rs files. + // Those extra lines cause ninja warning: + // "warning: depfile has multiple output paths" + // For ninja, we keep/grep only the dependency rule for the rust $out file. Deps: blueprint.DepsGCC, Depfile: "$out.d", },