Extract apex registration code into function for reuse
Test: m nothing
Change-Id: Id2c918891ecd9e874004f6828f71374bf0cdb9e4
diff --git a/apex/apex.go b/apex/apex.go
index efd1736..a182f9f 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -39,16 +39,20 @@
)
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 991f5c9..22ecfa7 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -229,14 +229,8 @@
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 @@
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 752888d..8b33b59 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -27,8 +27,12 @@
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 {