diff --git a/apex/apex.go b/apex/apex.go index efd1736db..a182f9f65 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -39,16 +39,20 @@ import ( ) func init() { - android.RegisterModuleType("apex", BundleFactory) - android.RegisterModuleType("apex_test", testApexBundleFactory) - android.RegisterModuleType("apex_vndk", vndkApexBundleFactory) - android.RegisterModuleType("apex_defaults", defaultsFactory) - android.RegisterModuleType("prebuilt_apex", PrebuiltFactory) - android.RegisterModuleType("override_apex", overrideApexFactory) - android.RegisterModuleType("apex_set", apexSetFactory) + registerApexBuildComponents(android.InitRegistrationContext) +} - android.PreDepsMutators(RegisterPreDepsMutators) - android.PostDepsMutators(RegisterPostDepsMutators) +func registerApexBuildComponents(ctx android.RegistrationContext) { + ctx.RegisterModuleType("apex", BundleFactory) + ctx.RegisterModuleType("apex_test", testApexBundleFactory) + ctx.RegisterModuleType("apex_vndk", vndkApexBundleFactory) + ctx.RegisterModuleType("apex_defaults", defaultsFactory) + ctx.RegisterModuleType("prebuilt_apex", PrebuiltFactory) + ctx.RegisterModuleType("override_apex", overrideApexFactory) + ctx.RegisterModuleType("apex_set", apexSetFactory) + + ctx.PreDepsMutators(RegisterPreDepsMutators) + ctx.PostDepsMutators(RegisterPostDepsMutators) } func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) { diff --git a/apex/apex_test.go b/apex/apex_test.go index 3e5ba7fc7..08f54f724 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -229,14 +229,8 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr android.RegisterPackageBuildComponents(ctx) ctx.PreArchMutators(android.RegisterVisibilityRuleChecker) - ctx.RegisterModuleType("apex", BundleFactory) - ctx.RegisterModuleType("apex_test", testApexBundleFactory) - ctx.RegisterModuleType("apex_vndk", vndkApexBundleFactory) - ctx.RegisterModuleType("apex_key", ApexKeyFactory) - ctx.RegisterModuleType("apex_defaults", defaultsFactory) - ctx.RegisterModuleType("prebuilt_apex", PrebuiltFactory) - ctx.RegisterModuleType("override_apex", overrideApexFactory) - ctx.RegisterModuleType("apex_set", apexSetFactory) + registerApexBuildComponents(ctx) + registerApexKeyBuildComponents(ctx) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(android.RegisterComponentsMutator) @@ -263,12 +257,8 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr ctx.RegisterModuleType("platform_compat_config", java.PlatformCompatConfigFactory) ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory) - ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory) ctx.RegisterModuleType("bpf", bpf.BpfFactory) - ctx.PreDepsMutators(RegisterPreDepsMutators) - ctx.PostDepsMutators(RegisterPostDepsMutators) - ctx.Register() return ctx, config diff --git a/apex/key.go b/apex/key.go index 752888da2..8b33b593f 100644 --- a/apex/key.go +++ b/apex/key.go @@ -27,8 +27,12 @@ import ( var String = proptools.String func init() { - android.RegisterModuleType("apex_key", ApexKeyFactory) - android.RegisterSingletonType("apex_keys_text", apexKeysTextFactory) + registerApexKeyBuildComponents(android.InitRegistrationContext) +} + +func registerApexKeyBuildComponents(ctx android.RegistrationContext) { + ctx.RegisterModuleType("apex_key", ApexKeyFactory) + ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory) } type apexKey struct {