Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22cef966 authored by Matthew Maurer's avatar Matthew Maurer
Browse files

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
parent 5ce6dfbd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)...)