Add support for Rust C libraries.
Adds the ability for rust modules to be compiled as C libraries, and
allows cc modules to depend on these rust-generated modules. This also
means that soong-rust should not have any dependencies on soong-cc aside
from what's required for testing.
There's a couple small fixes included as well:
- A bug in libNameFromFilePath that caused issues when library's had
"lib" in their name.
- VariantName is removed from rust library MutatedProperties since this
was unused.
Bug: 140726209
Test: Soong tests pass.
Test: Example cc_binary can include a rust shared library as a dep.
Test: m crosvm.experimental
Change-Id: Ia7deed1345d2423001089014cc65ce7934123da4
diff --git a/cc/vndk.go b/cc/vndk.go
index b066439..ec8f023 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -125,7 +125,7 @@
// Other (static and LL-NDK) libraries are allowed to link.
return
}
- if !to.useVndk() {
+ if !to.UseVndk() {
ctx.ModuleErrorf("(%s) should not link to %q which is not a vendor-available library",
vndk.typeName(), to.Name())
return
@@ -352,7 +352,7 @@
useCoreVariant := m.vndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
mctx.DeviceConfig().VndkUseCoreVariant() &&
!inList(m.BaseModuleName(), config.VndkMustUseVendorVariantList)
- return lib.shared() && m.useVndk() && m.isVndk() && !m.isVndkExt() && !useCoreVariant
+ return lib.shared() && m.UseVndk() && m.IsVndk() && !m.isVndkExt() && !useCoreVariant
}
return false
}
@@ -536,7 +536,7 @@
if m.Target().NativeBridge == android.NativeBridgeEnabled {
return nil, "", false
}
- if !m.useVndk() || !m.IsForPlatform() || !m.installable() {
+ if !m.UseVndk() || !m.IsForPlatform() || !m.installable() {
return nil, "", false
}
l, ok := m.linker.(vndkSnapshotLibraryInterface)
@@ -699,7 +699,7 @@
if c.isVndkPrivate(config) {
vndkprivate = append(vndkprivate, filename)
}
- } else if c.vndkVersion() == vndkVersion && c.isVndk() && !c.isVndkExt() {
+ } else if c.vndkVersion() == vndkVersion && c.IsVndk() && !c.isVndkExt() {
if c.isVndkSp() {
vndksp = append(vndksp, filename)
} else {
@@ -708,7 +708,7 @@
if c.isVndkPrivate(config) {
vndkprivate = append(vndkprivate, filename)
}
- if ctx.DeviceConfig().VndkUseCoreVariant() && !c.mustUseVendorVariant() {
+ if ctx.DeviceConfig().VndkUseCoreVariant() && !c.MustUseVendorVariant() {
vndkcorevariant = append(vndkcorevariant, filename)
}
}