Pass --remap-path-prefix to Rust builds.

We need to pass --remap-path-prefix to Rust builds to ensure that they
are reproducible across different paths.  This adds that for both host
and device builds.

Test: Verify host and device builds are reproducible with different
directories.

Change-Id: I68ba31537b2332fd05613aa0fb00a1502d78e410
This commit is contained in:
Joel Galenson 2019-09-30 13:01:37 -07:00
parent 852116a061
commit 724286c957
2 changed files with 5 additions and 0 deletions

View file

@ -120,6 +120,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
flags.RustFlags = append(flags.RustFlags, compiler.featuresToFlags(compiler.Properties.Features)...) flags.RustFlags = append(flags.RustFlags, compiler.featuresToFlags(compiler.Properties.Features)...)
flags.RustFlags = append(flags.RustFlags, "--edition="+*compiler.Properties.Edition) flags.RustFlags = append(flags.RustFlags, "--edition="+*compiler.Properties.Edition)
flags.LinkFlags = append(flags.LinkFlags, compiler.Properties.Ld_flags...) flags.LinkFlags = append(flags.LinkFlags, compiler.Properties.Ld_flags...)
flags.GlobalRustFlags = append(flags.GlobalRustFlags, config.GlobalRustFlags...)
flags.GlobalRustFlags = append(flags.GlobalRustFlags, ctx.toolchain().ToolchainRustFlags()) flags.GlobalRustFlags = append(flags.GlobalRustFlags, ctx.toolchain().ToolchainRustFlags())
flags.GlobalLinkFlags = append(flags.GlobalLinkFlags, ctx.toolchain().ToolchainLinkFlags()) flags.GlobalLinkFlags = append(flags.GlobalLinkFlags, ctx.toolchain().ToolchainLinkFlags())

View file

@ -37,6 +37,10 @@ var (
DefaultDenyWarnings = proptools.BoolPtr(true) DefaultDenyWarnings = proptools.BoolPtr(true)
GlobalRustFlags = []string{
"--remap-path-prefix $$(pwd)=",
}
deviceGlobalRustFlags = []string{} deviceGlobalRustFlags = []string{}
deviceGlobalLinkFlags = []string{ deviceGlobalLinkFlags = []string{