Rust: Vendor support for Rust static libraries.
We don't have Rust VNDK support yet, but static linkage can be supported in the interim. This adds support for making rust_ffi_static libraries available to CC vendor modules. Since rust_ffi_static modules will link against rlibs, we allow rlib linkage into vendor as well, but only for the variants which use the rlib libstd. Bug: 172525289 Test: New Soong tests pass Test: Example vendor cc_binary links against rust_ffi_static module. Change-Id: Idf3aeb51e32293866f1ad965e329aa6b9e0bf2ef
This commit is contained in:
@@ -601,6 +601,11 @@ func LibraryMutator(mctx android.BottomUpMutatorContext) {
|
||||
v.(*Module).compiler.(libraryInterface).setRlib()
|
||||
case dylibVariation:
|
||||
v.(*Module).compiler.(libraryInterface).setDylib()
|
||||
if v.(*Module).ModuleBase.ImageVariation().Variation != android.CoreVariation {
|
||||
// TODO(b/165791368)
|
||||
// Disable dylib non-core variations until we support these.
|
||||
v.(*Module).Disable()
|
||||
}
|
||||
case "source":
|
||||
v.(*Module).compiler.(libraryInterface).setSource()
|
||||
// The source variant does not produce any library.
|
||||
@@ -637,6 +642,12 @@ func LibstdMutator(mctx android.BottomUpMutatorContext) {
|
||||
dylib := modules[1].(*Module)
|
||||
rlib.compiler.(libraryInterface).setRlibStd()
|
||||
dylib.compiler.(libraryInterface).setDylibStd()
|
||||
if dylib.ModuleBase.ImageVariation().Variation != android.CoreVariation {
|
||||
// TODO(b/165791368)
|
||||
// Disable rlibs that link against dylib-std on non-core variations until non-core dylib
|
||||
// variants are properly supported.
|
||||
dylib.Disable()
|
||||
}
|
||||
rlib.Properties.SubName += RlibStdlibSuffix
|
||||
dylib.Properties.SubName += DylibStdlibSuffix
|
||||
}
|
||||
|
Reference in New Issue
Block a user