Revert "cc: Add cc_rustlibs_for_make to bundle rust_ffi_static"
Revert submission 3469976-ICU4X-in-bionic
Reason for revert: Droidmonitor created revert due to b/399425763. Will be verifying through ABTD before submission.
Reverted changes: /q/submissionid:3469976-ICU4X-in-bionic
Change-Id: Id8e9b68c2e44bbdd363d303a794041dc370f29fc
diff --git a/cc/library.go b/cc/library.go
index 86196ce..532b7e9 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -220,7 +220,6 @@
func RegisterLibraryBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("cc_library_static", LibraryStaticFactory)
- ctx.RegisterModuleType("cc_rustlibs_for_make", LibraryMakeRustlibsFactory)
ctx.RegisterModuleType("cc_library_shared", LibrarySharedFactory)
ctx.RegisterModuleType("cc_library", LibraryFactory)
ctx.RegisterModuleType("cc_library_host_static", LibraryHostStaticFactory)
@@ -250,19 +249,6 @@
return module.Init()
}
-// cc_rustlibs_for_make creates a static library which bundles together rust_ffi_static
-// deps for Make. This should not be depended on in Soong, and is probably not the
-// module you need unless you are sure of what you're doing. These should only
-// be declared as dependencies in Make. To ensure inclusion, rust_ffi_static modules
-// should be declared in the whole_static_libs property.
-func LibraryMakeRustlibsFactory() android.Module {
- module, library := NewLibrary(android.HostAndDeviceSupported)
- library.BuildOnlyStatic()
- library.wideStaticlibForMake = true
- module.sdkMemberTypes = []android.SdkMemberType{staticLibrarySdkMemberType}
- return module.Init()
-}
-
// cc_library_shared creates a shared library for a device and/or host.
func LibrarySharedFactory() android.Module {
module, library := NewLibrary(android.HostAndDeviceSupported)
@@ -451,10 +437,6 @@
// Path to the file containing the APIs exported by this library
stubsSymbolFilePath android.Path
-
- // Forces production of the generated Rust staticlib for cc_library_static.
- // Intended to be used to provide these generated staticlibs for Make.
- wideStaticlibForMake bool
}
// linkerProps returns the list of properties structs relevant for this library. (For example, if
@@ -1073,16 +1055,6 @@
library.objects = library.objects.Append(objs)
library.wholeStaticLibsFromPrebuilts = android.CopyOfPaths(deps.WholeStaticLibsFromPrebuilts)
- if library.wideStaticlibForMake {
- if generatedLib := GenerateRustStaticlib(ctx, deps.RustRlibDeps); generatedLib != nil {
- // WholeStaticLibsFromPrebuilts are .a files that get included whole into the resulting staticlib
- // so reuse that here for our Rust staticlibs because we don't have individual object files for
- // these.
- deps.WholeStaticLibsFromPrebuilts = append(deps.WholeStaticLibsFromPrebuilts, generatedLib)
- }
-
- }
-
fileName := ctx.ModuleName() + staticLibraryExtension
outputFile := android.PathForModuleOut(ctx, fileName)
builderFlags := flagsToBuilderFlags(flags)
diff --git a/rust/library_test.go b/rust/library_test.go
index 6cc4f25..6db9525 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -426,45 +426,6 @@
android.AssertStringDoesContain(t, "cFlags for lib module", libfooStatic.Args["cFlags"], " -Irust_includes ")
}
-// Make sure cc_rustlibs_for_make has the expected behavior, and that
-// cc_library_static does as well.
-// This is here instead of cc/library_test.go because the test needs to
-// define a rust_ffi module which can't be done in soong-cc to avoid the
-// circular dependency.
-func TestCCRustlibsForMake(t *testing.T) {
- t.Parallel()
- result := testRust(t, `
- rust_ffi_static {
- name: "libbar",
- srcs: ["foo.rs"],
- crate_name: "bar",
- export_include_dirs: ["rust_includes"],
- host_supported: true,
- }
-
- cc_rustlibs_for_make {
- name: "libmakerustlibs",
- whole_static_libs: ["libbar"],
- }
-
- cc_library_static {
- name: "libccstatic",
- whole_static_libs: ["libbar"],
- }
- `)
-
- libmakerustlibs := result.ModuleForTests(t, "libmakerustlibs", "android_arm64_armv8-a_static").MaybeRule("rustc")
- libccstatic := result.ModuleForTests(t, "libccstatic", "android_arm64_armv8-a_static").MaybeRule("rustc")
-
- if libmakerustlibs.Output == nil {
- t.Errorf("cc_rustlibs_for_make is not generating a Rust staticlib when it should")
- }
-
- if libccstatic.Output != nil {
- t.Errorf("cc_library_static is generating a Rust staticlib when it should not")
- }
-}
-
func TestRustVersionScript(t *testing.T) {
ctx := testRust(t, `
rust_library {