Merge "Extract apex registration code into function for reuse" am: 3d3f7a0c3f am: 5dccf644f1

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1625379

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2c20a0a5a5fed0aae8cdbdb678f09474e09d8324
This commit is contained in:
Paul Duffin
2021-03-10 20:12:30 +00:00
committed by Automerger Merge Worker
3 changed files with 21 additions and 23 deletions

View File

@@ -39,16 +39,20 @@ import (
) )
func init() { func init() {
android.RegisterModuleType("apex", BundleFactory) registerApexBuildComponents(android.InitRegistrationContext)
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)
android.PreDepsMutators(RegisterPreDepsMutators) func registerApexBuildComponents(ctx android.RegistrationContext) {
android.PostDepsMutators(RegisterPostDepsMutators) 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) { func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) {

View File

@@ -229,14 +229,8 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
android.RegisterPackageBuildComponents(ctx) android.RegisterPackageBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterVisibilityRuleChecker) ctx.PreArchMutators(android.RegisterVisibilityRuleChecker)
ctx.RegisterModuleType("apex", BundleFactory) registerApexBuildComponents(ctx)
ctx.RegisterModuleType("apex_test", testApexBundleFactory) registerApexKeyBuildComponents(ctx)
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)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
ctx.PreArchMutators(android.RegisterComponentsMutator) 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("platform_compat_config", java.PlatformCompatConfigFactory)
ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory) ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory)
ctx.RegisterModuleType("bpf", bpf.BpfFactory) ctx.RegisterModuleType("bpf", bpf.BpfFactory)
ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators)
ctx.Register() ctx.Register()
return ctx, config return ctx, config

View File

@@ -27,8 +27,12 @@ import (
var String = proptools.String var String = proptools.String
func init() { func init() {
android.RegisterModuleType("apex_key", ApexKeyFactory) registerApexKeyBuildComponents(android.InitRegistrationContext)
android.RegisterSingletonType("apex_keys_text", apexKeysTextFactory) }
func registerApexKeyBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("apex_key", ApexKeyFactory)
ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory)
} }
type apexKey struct { type apexKey struct {