Dedup cc binary build components registration
Bug: 146540677
Test: m nothing
Change-Id: I1c677d0ee2cead1d61f81e34e8d5a2f4a52f6cad
diff --git a/cc/binary.go b/cc/binary.go
index 617d4dd..ba6ed5f 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -56,8 +56,12 @@
}
func init() {
- android.RegisterModuleType("cc_binary", BinaryFactory)
- android.RegisterModuleType("cc_binary_host", binaryHostFactory)
+ RegisterBinaryBuildComponents(android.InitRegistrationContext)
+}
+
+func RegisterBinaryBuildComponents(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("cc_binary", BinaryFactory)
+ ctx.RegisterModuleType("cc_binary_host", binaryHostFactory)
}
// cc_binary produces a binary that is runnable on a device.
diff --git a/cc/testing.go b/cc/testing.go
index bc31077..198a346 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -23,6 +23,7 @@
android.RegisterPrebuiltMutators(ctx)
RegisterCCBuildComponents(ctx)
+ RegisterBinaryBuildComponents(ctx)
RegisterLibraryBuildComponents(ctx)
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
@@ -305,8 +306,6 @@
func CreateTestContext() *android.TestContext {
ctx := android.NewTestArchContext()
- ctx.RegisterModuleType("cc_binary", BinaryFactory)
- ctx.RegisterModuleType("cc_binary_host", binaryHostFactory)
ctx.RegisterModuleType("cc_fuzz", FuzzFactory)
ctx.RegisterModuleType("cc_test", TestFactory)
ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory)