rust: Mutate prebuilt modules dylib/rlib

This change makes it possible to use a single module to provide both
dylib and rlib varieties of a library. This allows the use of libstd and
libtest from a rustlibs property, allowing linkage type to change
for different variants.

Bug: 159718669
Test: cd external crates; mma; m crosvm.experimental
Change-Id: I477c4d2faec63703fdc6dd42ba020747d6a50714
This commit is contained in:
Matthew Maurer
2020-06-25 00:47:46 -07:00
parent 0f003b1851
commit c761eeca48
5 changed files with 76 additions and 36 deletions

View File

@@ -38,7 +38,8 @@ func init() {
}
type VariantLibraryProperties struct {
Enabled *bool `android:"arch_variant"`
Enabled *bool `android:"arch_variant"`
Srcs []string `android:"path,arch_variant"`
}
type LibraryCompilerProperties struct {
@@ -355,7 +356,7 @@ func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
if !ctx.Host() && library.static() {
library.setNoStdlibs()
for _, stdlib := range config.Stdlibs {
deps.Rlibs = append(deps.Rlibs, stdlib+".static")
deps.Rlibs = append(deps.Rlibs, stdlib)
}
}