Dedup cc library module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I6685338550f587212e70f3eba8d4342b66f566e2
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e8dc9aa..5e49e41 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -286,8 +286,6 @@
ctx.RegisterModuleType("prebuilt_apex", PrebuiltFactory)
ctx.RegisterModuleType("override_apex", overrideApexFactory)
- ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
- ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
cc.RegisterRequiredBuildComponentsForTest(ctx)
ctx.RegisterModuleType("cc_binary", cc.BinaryFactory)
ctx.RegisterModuleType("cc_test", cc.TestFactory)
diff --git a/cc/library.go b/cc/library.go
index 04130c4..84f1831 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -174,12 +174,16 @@
}
func init() {
- android.RegisterModuleType("cc_library_static", LibraryStaticFactory)
- android.RegisterModuleType("cc_library_shared", LibrarySharedFactory)
- android.RegisterModuleType("cc_library", LibraryFactory)
- android.RegisterModuleType("cc_library_host_static", LibraryHostStaticFactory)
- android.RegisterModuleType("cc_library_host_shared", LibraryHostSharedFactory)
- android.RegisterModuleType("cc_library_headers", LibraryHeaderFactory)
+ RegisterLibraryBuildComponents(android.InitRegistrationContext)
+}
+
+func RegisterLibraryBuildComponents(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("cc_library_static", LibraryStaticFactory)
+ ctx.RegisterModuleType("cc_library_shared", LibrarySharedFactory)
+ ctx.RegisterModuleType("cc_library", LibraryFactory)
+ ctx.RegisterModuleType("cc_library_host_static", LibraryHostStaticFactory)
+ ctx.RegisterModuleType("cc_library_host_shared", LibraryHostSharedFactory)
+ ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory)
}
// cc_library creates both static and/or shared libraries for a device and/or
diff --git a/cc/testing.go b/cc/testing.go
index de4f1ec..bc31077 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -20,14 +20,14 @@
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
RegisterPrebuiltBuildComponents(ctx)
- ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
- ctx.RegisterModuleType("cc_library", LibraryFactory)
- ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
- ctx.RegisterModuleType("cc_object", ObjectFactory)
-
android.RegisterPrebuiltMutators(ctx)
RegisterCCBuildComponents(ctx)
+ RegisterLibraryBuildComponents(ctx)
+
+ ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
+ ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
+ ctx.RegisterModuleType("cc_object", ObjectFactory)
}
func GatherRequiredDepsForTest(os android.OsType) string {
@@ -308,9 +308,6 @@
ctx.RegisterModuleType("cc_binary", BinaryFactory)
ctx.RegisterModuleType("cc_binary_host", binaryHostFactory)
ctx.RegisterModuleType("cc_fuzz", FuzzFactory)
- ctx.RegisterModuleType("cc_library_shared", LibrarySharedFactory)
- ctx.RegisterModuleType("cc_library_static", LibraryStaticFactory)
- ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory)
ctx.RegisterModuleType("cc_test", TestFactory)
ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory)
ctx.RegisterModuleType("ndk_library", NdkLibraryFactory)
diff --git a/sdk/testing.go b/sdk/testing.go
index eec7f01..950cf0a 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -77,8 +77,6 @@
// from cc package
cc.RegisterRequiredBuildComponentsForTest(ctx)
- ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
- ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
// from apex package
ctx.RegisterModuleType("apex", apex.BundleFactory)
diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go
index 0c0f222..7cad3da 100644
--- a/sysprop/sysprop_test.go
+++ b/sysprop/sysprop_test.go
@@ -66,8 +66,6 @@
})
cc.RegisterRequiredBuildComponentsForTest(ctx)
- ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
- ctx.RegisterModuleType("cc_library_static", cc.LibraryFactory)
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("sysprop_java", java.SyspropMutator).Parallel()
})