diff options
Diffstat (limited to 'apex')
-rw-r--r-- | apex/apex.go | 29 | ||||
-rw-r--r-- | apex/apex_test.go | 11 |
2 files changed, 38 insertions, 2 deletions
diff --git a/apex/apex.go b/apex/apex.go index 06e6c784..092868e6 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -137,6 +137,7 @@ func init() { pctx.HostBinToolVariable("zipalign", "zipalign") android.RegisterModuleType("apex", ApexBundleFactory) + android.RegisterModuleType("apex_defaults", defaultsFactory) android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.TopDown("apex_deps", apexDepsMutator) @@ -1103,3 +1104,31 @@ func ApexBundleFactory() android.Module { android.InitDefaultableModule(module) return module } + +// +// Defaults +// +type Defaults struct { + android.ModuleBase + android.DefaultsModuleBase +} + +func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { +} + +func defaultsFactory() android.Module { + return DefaultsFactory() +} + +func DefaultsFactory(props ...interface{}) android.Module { + module := &Defaults{} + + module.AddProperties(props...) + module.AddProperties( + &apexBundleProperties{}, + &apexTargetBundleProperties{}, + ) + + android.InitDefaultsModule(module) + return module +} diff --git a/apex/apex_test.go b/apex/apex_test.go index 56ddd5f9..6163d0f4 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -33,6 +33,8 @@ func testApex(t *testing.T, bp string) *android.TestContext { ctx := android.NewTestArchContext() ctx.RegisterModuleType("apex", android.ModuleFactoryAdaptor(ApexBundleFactory)) ctx.RegisterModuleType("apex_key", android.ModuleFactoryAdaptor(apexKeyFactory)) + ctx.RegisterModuleType("apex_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) + ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.TopDown("apex_deps", apexDepsMutator) @@ -201,8 +203,8 @@ func ensureListNotContains(t *testing.T, result []string, notExpected string) { // Minimal test func TestBasicApex(t *testing.T) { ctx := testApex(t, ` - apex { - name: "myapex", + apex_defaults { + name: "myapex-defaults", key: "myapex.key", native_shared_libs: ["mylib"], multilib: { @@ -212,6 +214,11 @@ func TestBasicApex(t *testing.T) { } } + apex { + name: "myapex", + defaults: ["myapex-defaults"], + } + apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", |