diff --git a/apex/apex_test.go b/apex/apex_test.go index b37674ff1..9510d8257 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -288,7 +288,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr ctx.RegisterModuleType("override_apex", overrideApexFactory) cc.RegisterRequiredBuildComponentsForTest(ctx) - ctx.RegisterModuleType("cc_binary", cc.BinaryFactory) ctx.RegisterModuleType("cc_test", cc.TestFactory) ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory) ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory) diff --git a/cc/binary.go b/cc/binary.go index 617d4dda0..ba6ed5f68 100644 --- a/cc/binary.go +++ b/cc/binary.go @@ -56,8 +56,12 @@ type BinaryLinkerProperties struct { } 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 bc3107721..198a346f5 100644 --- a/cc/testing.go +++ b/cc/testing.go @@ -23,6 +23,7 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { android.RegisterPrebuiltMutators(ctx) RegisterCCBuildComponents(ctx) + RegisterBinaryBuildComponents(ctx) RegisterLibraryBuildComponents(ctx) ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) @@ -305,8 +306,6 @@ func TestConfig(buildDir string, os android.OsType, env map[string]string, 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)