aboutsummaryrefslogtreecommitdiffstats
path: root/apex
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2019-02-07 16:27:23 +0900
committerJiyong Park <jiyong@google.com>2019-02-08 02:55:28 +0900
commit30ca9379e6d515bd176945dd92a1930cc35d47fe (patch)
treef1465107f7d2ae17f01ea040770becf85a4e6da4 /apex
parentf98087ffce4e435ed2738c423c3d57435b6c016b (diff)
downloadbuild_soong-30ca9379e6d515bd176945dd92a1930cc35d47fe.tar.gz
build_soong-30ca9379e6d515bd176945dd92a1930cc35d47fe.tar.bz2
build_soong-30ca9379e6d515bd176945dd92a1930cc35d47fe.zip
add apex_defaults
apex_defaults is the default module for apex. Bug: 124026431 Test: m (apex_test updated) Change-Id: I09f63046e909e8eeb52ecec6bb07eb51e5490561
Diffstat (limited to 'apex')
-rw-r--r--apex/apex.go29
-rw-r--r--apex/apex_test.go11
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",