rust: Remove rust_ffi_rlibs, keep rust_ffi_static
rust_ffi_static and rust_ffi_rlibs both alias to rust_library_rlib now.
We need to think about whether we need these aliases at all.
There are no users of rust_ffi_rlibs at the moment as developers are
continuing to declare rust_ffi_static modules. Let's remove this alias
in the meantime at least to simplify things.
Bug: 350633786
Bug: 383552450
Test: m blueprint_tests && m rust
Change-Id: I6be895ddbffc5ac6303f2edc9ab20f7c20cd1591
diff --git a/cc/fuzz.go b/cc/fuzz.go
index 26ac7d1..122871f 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -638,7 +638,7 @@
ctx.WalkDeps(func(child, parent android.Module) bool {
// If this is a Rust module which is not rust_ffi_shared, we still want to bundle any transitive
- // shared dependencies (even for rust_ffi_rlib or rust_ffi_static)
+ // shared dependencies (even for rust_ffi_static)
if rustmod, ok := child.(LinkableInterface); ok && rustmod.RustLibraryInterface() && !rustmod.Shared() {
if recursed[ctx.OtherModuleName(child)] {
return false
diff --git a/rust/fuzz_test.go b/rust/fuzz_test.go
index 6cb8b93..3598c99 100644
--- a/rust/fuzz_test.go
+++ b/rust/fuzz_test.go
@@ -145,6 +145,6 @@
t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_static ('libcc_transitive_dep'): %#v", fuzz_static_libtest.FuzzSharedLibraries().String())
}
if !strings.Contains(fuzz_staticffi_libtest.FuzzSharedLibraries().String(), ":libcc_transitive_dep.so") {
- t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_rlib ('libcc_transitive_dep'): %#v", fuzz_staticffi_libtest.FuzzSharedLibraries().String())
+ t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_static ('libcc_transitive_dep'): %#v", fuzz_staticffi_libtest.FuzzSharedLibraries().String())
}
}
diff --git a/rust/image_test.go b/rust/image_test.go
index d84eb10..0581fa7 100644
--- a/rust/image_test.go
+++ b/rust/image_test.go
@@ -22,14 +22,13 @@
"android/soong/cc"
)
-// Test that cc modules can depend on vendor_available rust_ffi_rlib/rust_ffi_static libraries.
+// Test that cc modules can depend on vendor_available rust_ffi_static libraries.
func TestVendorLinkage(t *testing.T) {
ctx := testRust(t, `
cc_binary {
name: "fizz_vendor_available",
static_libs: [
"libfoo_vendor",
- "libfoo_vendor_static"
],
vendor_available: true,
}
@@ -38,14 +37,8 @@
static_libs: ["libfoo_vendor"],
soc_specific: true,
}
- rust_ffi_rlib {
- name: "libfoo_vendor",
- crate_name: "foo",
- srcs: ["foo.rs"],
- vendor_available: true,
- }
rust_ffi_static {
- name: "libfoo_vendor_static",
+ name: "libfoo_vendor",
crate_name: "foo",
srcs: ["foo.rs"],
vendor_available: true,
@@ -54,8 +47,8 @@
vendorBinary := ctx.ModuleForTests("fizz_vendor_available", "android_vendor_arm64_armv8-a").Module().(*cc.Module)
- if android.InList("libfoo_vendor_static.vendor", vendorBinary.Properties.AndroidMkStaticLibs) {
- t.Errorf("vendorBinary should not have a staticlib dependency on libfoo_vendor_static.vendor: %#v", vendorBinary.Properties.AndroidMkStaticLibs)
+ if android.InList("libfoo_vendor.vendor", vendorBinary.Properties.AndroidMkStaticLibs) {
+ t.Errorf("vendorBinary should not have a staticlib dependency on libfoo_vendor.vendor: %#v", vendorBinary.Properties.AndroidMkStaticLibs)
}
}
@@ -107,26 +100,19 @@
}
-// Test that cc modules can link against vendor_ramdisk_available rust_ffi_rlib and rust_ffi_static libraries.
+// Test that cc modules can link against vendor_ramdisk_available rust_ffi_static libraries.
func TestVendorRamdiskLinkage(t *testing.T) {
ctx := testRust(t, `
cc_library_shared {
name: "libcc_vendor_ramdisk",
static_libs: [
"libfoo_vendor_ramdisk",
- "libfoo_static_vendor_ramdisk"
],
system_shared_libs: [],
vendor_ramdisk_available: true,
}
- rust_ffi_rlib {
- name: "libfoo_vendor_ramdisk",
- crate_name: "foo",
- srcs: ["foo.rs"],
- vendor_ramdisk_available: true,
- }
rust_ffi_static {
- name: "libfoo_static_vendor_ramdisk",
+ name: "libfoo_vendor_ramdisk",
crate_name: "foo",
srcs: ["foo.rs"],
vendor_ramdisk_available: true,
@@ -135,8 +121,8 @@
vendorRamdiskLibrary := ctx.ModuleForTests("libcc_vendor_ramdisk", "android_vendor_ramdisk_arm64_armv8-a_shared").Module().(*cc.Module)
- if android.InList("libfoo_static_vendor_ramdisk.vendor_ramdisk", vendorRamdiskLibrary.Properties.AndroidMkStaticLibs) {
- t.Errorf("libcc_vendor_ramdisk should not have a dependency on the libfoo_static_vendor_ramdisk static library")
+ if android.InList("libfoo_vendor_ramdisk.vendor_ramdisk", vendorRamdiskLibrary.Properties.AndroidMkStaticLibs) {
+ t.Errorf("libcc_vendor_ramdisk should not have a dependency on the libfoo_vendor_ramdisk static library")
}
}
diff --git a/rust/library.go b/rust/library.go
index 93a9a3d..ffc8ab0 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -40,13 +40,8 @@
android.RegisterModuleType("rust_library_host_rlib", RustLibraryRlibHostFactory)
android.RegisterModuleType("rust_ffi", RustFFIFactory)
android.RegisterModuleType("rust_ffi_shared", RustFFISharedFactory)
- android.RegisterModuleType("rust_ffi_rlib", RustLibraryRlibFactory)
android.RegisterModuleType("rust_ffi_host", RustFFIHostFactory)
android.RegisterModuleType("rust_ffi_host_shared", RustFFISharedHostFactory)
- android.RegisterModuleType("rust_ffi_host_rlib", RustLibraryRlibHostFactory)
-
- // TODO: Remove when all instances of rust_ffi_static have been switched to rust_ffi_rlib
- // Alias rust_ffi_static to the rust_ffi_rlib factory
android.RegisterModuleType("rust_ffi_static", RustLibraryRlibFactory)
android.RegisterModuleType("rust_ffi_host_static", RustLibraryRlibHostFactory)
}
@@ -279,8 +274,7 @@
return module.Init()
}
-// rust_ffi produces all FFI variants (rust_ffi_shared, rust_ffi_static, and
-// rust_ffi_rlib).
+// rust_ffi produces all FFI variants (rust_ffi_shared, rust_ffi_static).
func RustFFIFactory() android.Module {
module, library := NewRustLibrary(android.HostAndDeviceSupported)
library.BuildOnlyFFI()
@@ -318,7 +312,7 @@
}
// rust_ffi_host produces all FFI variants for the host
-// (rust_ffi_rlib_host, rust_ffi_static_host, and rust_ffi_shared_host).
+// (rust_ffi_static_host and rust_ffi_shared_host).
func RustFFIHostFactory() android.Module {
module, library := NewRustLibrary(android.HostSupported)
library.BuildOnlyFFI()
diff --git a/rust/library_test.go b/rust/library_test.go
index 35a420c..45c0ed6 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -202,9 +202,9 @@
func TestNativeDependencyOfRlib(t *testing.T) {
ctx := testRust(t, `
- rust_ffi_rlib {
- name: "libffi_rlib",
- crate_name: "ffi_rlib",
+ rust_ffi_static {
+ name: "libffi_static",
+ crate_name: "ffi_static",
rlibs: ["librust_rlib"],
srcs: ["foo.rs"],
}
@@ -227,7 +227,7 @@
rustRlibRlibStd := ctx.ModuleForTests("librust_rlib", "android_arm64_armv8-a_rlib_rlib-std")
rustRlibDylibStd := ctx.ModuleForTests("librust_rlib", "android_arm64_armv8-a_rlib_dylib-std")
- ffiRlib := ctx.ModuleForTests("libffi_rlib", "android_arm64_armv8-a_rlib_rlib-std")
+ ffiRlib := ctx.ModuleForTests("libffi_static", "android_arm64_armv8-a_rlib_rlib-std")
modules := []android.TestingModule{
rustRlibRlibStd,
@@ -412,10 +412,10 @@
t.Errorf("Device rust_ffi_shared does not link libstd as an dylib")
}
if !android.InList("libstd", libbarFFIRlib.Properties.AndroidMkRlibs) {
- t.Errorf("Device rust_ffi_rlib does not link libstd as an rlib")
+ t.Errorf("Device rust_ffi_static does not link libstd as an rlib")
}
if !android.InList("libfoo.rlib-std", libbarFFIRlib.Properties.AndroidMkRlibs) {
- t.Errorf("Device rust_ffi_rlib does not link dependent rustlib rlib-std variant")
+ t.Errorf("Device rust_ffi_static does not link dependent rustlib rlib-std variant")
}
if !android.InList("libstd", libbarRlibStd.Properties.AndroidMkRlibs) {
t.Errorf("rust_ffi with prefer_rlib does not link libstd as an rlib")
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 7e64c0a..90c1f61 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -434,21 +434,21 @@
func TestRustRlibs(t *testing.T) {
ctx := testRust(t, `
- rust_ffi_rlib {
+ rust_ffi_static {
name: "libbar",
crate_name: "bar",
srcs: ["src/lib.rs"],
export_include_dirs: ["bar_includes"]
}
- rust_ffi_rlib {
+ rust_ffi_static {
name: "libfoo",
crate_name: "foo",
srcs: ["src/lib.rs"],
export_include_dirs: ["foo_includes"]
}
- rust_ffi_rlib {
+ rust_ffi_static {
name: "libbuzz",
crate_name: "buzz",
srcs: ["src/lib.rs"],
diff --git a/rust/testing.go b/rust/testing.go
index 2e50e1e..0ce1b66 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -188,11 +188,9 @@
ctx.RegisterModuleType("rust_fuzz_host", RustFuzzHostFactory)
ctx.RegisterModuleType("rust_ffi", RustFFIFactory)
ctx.RegisterModuleType("rust_ffi_shared", RustFFISharedFactory)
- ctx.RegisterModuleType("rust_ffi_rlib", RustLibraryRlibFactory)
ctx.RegisterModuleType("rust_ffi_static", RustLibraryRlibFactory)
ctx.RegisterModuleType("rust_ffi_host", RustFFIHostFactory)
ctx.RegisterModuleType("rust_ffi_host_shared", RustFFISharedHostFactory)
- ctx.RegisterModuleType("rust_ffi_host_rlib", RustLibraryRlibHostFactory)
ctx.RegisterModuleType("rust_ffi_host_static", RustLibraryRlibHostFactory)
ctx.RegisterModuleType("rust_proc_macro", ProcMacroFactory)
ctx.RegisterModuleType("rust_protobuf", RustProtobufFactory)