diff options
author | 2020-01-13 16:31:13 -0800 | |
---|---|---|
committer | 2020-01-15 08:37:42 -0800 | |
commit | 22cef966e1552575f891ea77bf0151555a207056 (patch) | |
tree | a0dc7a5871df903f4baccd255d0c03395422ebaa /rust/library.go | |
parent | 5ce6dfbd36d5699af20f6d9759f3e1944a28b321 (diff) |
rust: Include Soong module name as metadata
If we want to build a component which uses two versions of a crate in
the dependency graph (for example, libc in std and libc from
external/crates), Rust requires at least one of them have a metadata
field to differentiate them.
Since Soong module names should be distinct for a given target, they
should serve as metadata.
Bug: 147397356
Test: Build a rust library with "rlibs: ["liblibc"]" in the blueprint
Change-Id: I5d85ea8b3197972c09de301c9523efaff08adf81
Diffstat (limited to 'rust/library.go')
-rw-r--r-- | rust/library.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/rust/library.go b/rust/library.go index 43819cef7..2844e70d9 100644 --- a/rust/library.go +++ b/rust/library.go @@ -323,6 +323,7 @@ func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { return deps } func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags { + flags.RustFlags = append(flags.RustFlags, "-C metadata="+ctx.baseModuleName()) flags = library.baseCompiler.compilerFlags(ctx, flags) if library.shared() || library.static() { library.includeDirs = append(library.includeDirs, android.PathsForModuleSrc(ctx, library.Properties.Include_dirs)...) |