Dedup cc prebuilts module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I7e9440a075ef9c683729ed83e0033ab529fe4ac0
diff --git a/apex/apex_test.go b/apex/apex_test.go
index bb6e026..035a553 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -289,8 +289,7 @@
ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
- ctx.RegisterModuleType("cc_prebuilt_library_shared", cc.PrebuiltSharedLibraryFactory)
- ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory)
+ cc.RegisterPrebuiltBuildComponents(ctx)
ctx.RegisterModuleType("cc_binary", cc.BinaryFactory)
ctx.RegisterModuleType("cc_object", cc.ObjectFactory)
ctx.RegisterModuleType("cc_defaults", func() android.Module {
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index f20616f..b0cf489 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -19,9 +19,13 @@
)
func init() {
- android.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory)
- android.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory)
- android.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory)
+ RegisterPrebuiltBuildComponents(android.InitRegistrationContext)
+}
+
+func RegisterPrebuiltBuildComponents(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory)
+ ctx.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory)
+ ctx.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory)
}
type prebuiltLinkerInterface interface {
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index 31db2df..658cef0 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -72,9 +72,7 @@
ctx := CreateTestContext()
- ctx.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory)
- ctx.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory)
- ctx.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory)
+ RegisterPrebuiltBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PostDepsMutators(android.RegisterPrebuiltsPostDepsMutators)
diff --git a/sdk/testing.go b/sdk/testing.go
index 0aac1a4..61043f3 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -87,8 +87,7 @@
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
ctx.RegisterModuleType("cc_object", cc.ObjectFactory)
- ctx.RegisterModuleType("cc_prebuilt_library_shared", cc.PrebuiltSharedLibraryFactory)
- ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory)
+ cc.RegisterPrebuiltBuildComponents(ctx)
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {