aboutsummaryrefslogtreecommitdiffstats
path: root/apex/apex_test.go
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2020-04-17 13:43:10 +0900
committerJooyung Han <jooyung@google.com>2020-04-25 02:22:28 +0900
commit40b286ceea0f52db222f3c57a3f289edb92ad512 (patch)
treed94fd63ac9e0673a8b7ce1fd6010b87944427710 /apex/apex_test.go
parent0b848b01e8e6ba3b612262cbd7af9775a098c113 (diff)
downloadbuild_soong-40b286ceea0f52db222f3c57a3f289edb92ad512.tar.gz
build_soong-40b286ceea0f52db222f3c57a3f289edb92ad512.tar.bz2
build_soong-40b286ceea0f52db222f3c57a3f289edb92ad512.zip
apex: Don't run apex mutators if disabled
apex_deps/apex/apex_flattened mutators don't have to run if module is disabled. For some branches which have no valid targets, apex modules are disabled by the os mutator. e.g. aosp-build-tools Some enforcement checks which run during those mutators may fail because build-environment doesn't provide full context information. For example, "Platform_version_all_codenames" config variable is not set while apex.min_sdk_version uses one of those codenames. Bug: 152655956 Test: m Merged-In: I47e27d2d025ba4c36534708b113ce77c4cb2397b Change-Id: I47e27d2d025ba4c36534708b113ce77c4cb2397b (cherry picked from commit 49f6701e9a1f7474522d06aa8b15795fe21885e6)
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 2e5a2bdc..35a07c8c 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4085,6 +4085,27 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
ensureRealfileExists(t, files, "lib64/myotherlib.so") // this is a real file
}
+func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
+ ctx, _ := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `, func(fs map[string][]byte, config android.Config) {
+ delete(config.Targets, android.Android)
+ config.AndroidCommonTarget = android.Target{}
+ })
+
+ if expected, got := []string{""}, ctx.ModuleVariantsForTests("myapex"); !reflect.DeepEqual(expected, got) {
+ t.Errorf("Expected variants: %v, but got: %v", expected, got)
+ }
+}
+
func TestAppBundle(t *testing.T) {
ctx, _ := testApex(t, `
apex {