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
diff --git a/rust/library.go b/rust/library.go
index 971588d..48b3ad4 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -601,6 +601,11 @@
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 @@
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
}