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/androidmk.go b/cc/androidmk.go
index cdd8e92..c0b8997 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -36,10 +36,10 @@
Arch() android.Arch
Os() android.OsType
Host() bool
- useVndk() bool
+ UseVndk() bool
vndkVersion() string
static() bool
- inRecovery() bool
+ InRecovery() bool
}
type subAndroidMkProvider interface {
@@ -89,9 +89,9 @@
fmt.Fprintln(w, "LOCAL_WHOLE_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkWholeStaticLibs, " "))
}
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.makeLinkType)
- if c.useVndk() {
+ if c.UseVndk() {
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
- if c.isVndk() && !c.static() {
+ if c.IsVndk() && !c.static() {
fmt.Fprintln(w, "LOCAL_SOONG_VNDK_VERSION := "+c.vndkVersion())
}
}
@@ -224,7 +224,7 @@
})
}
if len(library.Properties.Stubs.Versions) > 0 &&
- android.DirectlyInAnyApex(ctx, ctx.Name()) && !ctx.inRecovery() && !ctx.useVndk() &&
+ android.DirectlyInAnyApex(ctx, ctx.Name()) && !ctx.InRecovery() && !ctx.UseVndk() &&
!ctx.static() {
if !library.buildStubs() {
ret.SubName = ".bootstrap"