Loading apex/apex.go +25 −2 Original line number Diff line number Diff line Loading @@ -1057,8 +1057,9 @@ func apexMutator(mctx android.BottomUpMutatorContext) { // apexBundle itself is mutated so that it and its dependencies have the same apex variant. // TODO(jiyong): document the reason why the VNDK APEX is an exception here. if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { apexBundleName := mctx.ModuleName() unprefixedModuleName := android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName()) if apexModuleTypeRequiresVariant(mctx.Module()) { apexBundleName := unprefixedModuleName mctx.CreateVariations(apexBundleName) if strings.HasPrefix(apexBundleName, "com.android.art") { // Create an alias from the platform variant. This is done to make Loading @@ -1076,6 +1077,12 @@ func apexMutator(mctx android.BottomUpMutatorContext) { mctx.ModuleErrorf("base property is not set") return } // Workaround the issue reported in b/191269918 by using the unprefixed module name of this // module as the default variation to use if dependencies of this module do not have the correct // apex variant name. This name matches the name used to create the variations of modules for // which apexModuleTypeRequiresVariant return true. // TODO(b/191269918): Remove this workaround. mctx.SetDefaultDependencyVariation(&unprefixedModuleName) mctx.CreateVariations(apexBundleName) if strings.HasPrefix(apexBundleName, "com.android.art") { // TODO(b/183882457): See note for CreateAliasVariation above. Loading @@ -1084,6 +1091,22 @@ func apexMutator(mctx android.BottomUpMutatorContext) { } } // apexModuleTypeRequiresVariant determines whether the module supplied requires an apex specific // variant. func apexModuleTypeRequiresVariant(module android.Module) bool { if a, ok := module.(*apexBundle); ok { return !a.vndkApex } // Match apex_set and prebuilt_apex. Would also match apexBundle but that is handled specially // above. if _, ok := module.(ApexInfoMutator); ok { return true } return false } // See android.UpdateDirectlyInAnyApex // TODO(jiyong): move this to android/apex.go? func apexDirectlyInAnyMutator(mctx android.BottomUpMutatorContext) { Loading apex/apex_test.go +8 −8 Original line number Diff line number Diff line Loading @@ -4389,7 +4389,7 @@ func TestPrebuilt(t *testing.T) { } `) prebuilt := ctx.ModuleForTests("myapex", "android_common").Module().(*Prebuilt) prebuilt := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*Prebuilt) expectedInput := "myapex-arm64.apex" if prebuilt.inputApex.String() != expectedInput { Loading @@ -4398,7 +4398,7 @@ func TestPrebuilt(t *testing.T) { } func TestPrebuiltMissingSrc(t *testing.T) { testApexError(t, `module "myapex" variant "android_common".*: prebuilt_apex does not support "arm64_armv8-a"`, ` testApexError(t, `module "myapex" variant "android_common_myapex".*: prebuilt_apex does not support "arm64_armv8-a"`, ` prebuilt_apex { name: "myapex", } Loading @@ -4414,7 +4414,7 @@ func TestPrebuiltFilenameOverride(t *testing.T) { } `) p := ctx.ModuleForTests("myapex", "android_common").Module().(*Prebuilt) p := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*Prebuilt) expected := "notmyapex.apex" if p.installFilename != expected { Loading @@ -4433,7 +4433,7 @@ func TestPrebuiltOverrides(t *testing.T) { } `) p := ctx.ModuleForTests("myapex.prebuilt", "android_common").Module().(*Prebuilt) p := ctx.ModuleForTests("myapex.prebuilt", "android_common_myapex.prebuilt").Module().(*Prebuilt) expected := []string{"myapex"} actual := android.AndroidMkEntriesForTest(t, ctx, p)[0].EntryMap["LOCAL_OVERRIDES_MODULES"] Loading Loading @@ -4503,7 +4503,7 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) { } // Make sure that the prebuilt_apex has the correct input APEX. prebuiltApex := ctx.ModuleForTests("myapex", "android_common") prebuiltApex := ctx.ModuleForTests("myapex", "android_common_myapex") rule = prebuiltApex.Rule("android/soong/android.Cp") if expected, actual := "myapex-arm64.apex", android.NormalizePathForTesting(rule.Input); !reflect.DeepEqual(expected, actual) { t.Errorf("expected: %q, found: %q", expected, actual) Loading Loading @@ -6522,8 +6522,8 @@ func TestAppSetBundlePrebuilt(t *testing.T) { android.AssertArrayString(t, "extractor input", []string{"myapex.hwasan.apks"}, extractedApex.Inputs.Strings()) // Ditto for the apex. m = ctx.ModuleForTests("myapex", "android_common") copiedApex := m.Output("out/soong/.intermediates/myapex/android_common/foo_v2.apex") m = ctx.ModuleForTests("myapex", "android_common_myapex") copiedApex := m.Output("out/soong/.intermediates/myapex/android_common_myapex/foo_v2.apex") android.AssertStringEquals(t, "myapex input", extractorOutput, copiedApex.Input.String()) } Loading Loading @@ -7183,7 +7183,7 @@ func TestApexSet(t *testing.T) { t.Errorf("Unexpected abis parameter - expected %q vs actual %q", expected, actual) } m = ctx.ModuleForTests("myapex", "android_common") m = ctx.ModuleForTests("myapex", "android_common_myapex") a := m.Module().(*ApexSet) expectedOverrides := []string{"foo"} actualOverrides := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_OVERRIDES_MODULES"] Loading apex/bootclasspath_fragment_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -519,7 +519,7 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { } `) java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common", []string{ java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{ `com.android.art.apex.selector`, `prebuilt_bar`, `prebuilt_foo`, Loading Loading
apex/apex.go +25 −2 Original line number Diff line number Diff line Loading @@ -1057,8 +1057,9 @@ func apexMutator(mctx android.BottomUpMutatorContext) { // apexBundle itself is mutated so that it and its dependencies have the same apex variant. // TODO(jiyong): document the reason why the VNDK APEX is an exception here. if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { apexBundleName := mctx.ModuleName() unprefixedModuleName := android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName()) if apexModuleTypeRequiresVariant(mctx.Module()) { apexBundleName := unprefixedModuleName mctx.CreateVariations(apexBundleName) if strings.HasPrefix(apexBundleName, "com.android.art") { // Create an alias from the platform variant. This is done to make Loading @@ -1076,6 +1077,12 @@ func apexMutator(mctx android.BottomUpMutatorContext) { mctx.ModuleErrorf("base property is not set") return } // Workaround the issue reported in b/191269918 by using the unprefixed module name of this // module as the default variation to use if dependencies of this module do not have the correct // apex variant name. This name matches the name used to create the variations of modules for // which apexModuleTypeRequiresVariant return true. // TODO(b/191269918): Remove this workaround. mctx.SetDefaultDependencyVariation(&unprefixedModuleName) mctx.CreateVariations(apexBundleName) if strings.HasPrefix(apexBundleName, "com.android.art") { // TODO(b/183882457): See note for CreateAliasVariation above. Loading @@ -1084,6 +1091,22 @@ func apexMutator(mctx android.BottomUpMutatorContext) { } } // apexModuleTypeRequiresVariant determines whether the module supplied requires an apex specific // variant. func apexModuleTypeRequiresVariant(module android.Module) bool { if a, ok := module.(*apexBundle); ok { return !a.vndkApex } // Match apex_set and prebuilt_apex. Would also match apexBundle but that is handled specially // above. if _, ok := module.(ApexInfoMutator); ok { return true } return false } // See android.UpdateDirectlyInAnyApex // TODO(jiyong): move this to android/apex.go? func apexDirectlyInAnyMutator(mctx android.BottomUpMutatorContext) { Loading
apex/apex_test.go +8 −8 Original line number Diff line number Diff line Loading @@ -4389,7 +4389,7 @@ func TestPrebuilt(t *testing.T) { } `) prebuilt := ctx.ModuleForTests("myapex", "android_common").Module().(*Prebuilt) prebuilt := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*Prebuilt) expectedInput := "myapex-arm64.apex" if prebuilt.inputApex.String() != expectedInput { Loading @@ -4398,7 +4398,7 @@ func TestPrebuilt(t *testing.T) { } func TestPrebuiltMissingSrc(t *testing.T) { testApexError(t, `module "myapex" variant "android_common".*: prebuilt_apex does not support "arm64_armv8-a"`, ` testApexError(t, `module "myapex" variant "android_common_myapex".*: prebuilt_apex does not support "arm64_armv8-a"`, ` prebuilt_apex { name: "myapex", } Loading @@ -4414,7 +4414,7 @@ func TestPrebuiltFilenameOverride(t *testing.T) { } `) p := ctx.ModuleForTests("myapex", "android_common").Module().(*Prebuilt) p := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*Prebuilt) expected := "notmyapex.apex" if p.installFilename != expected { Loading @@ -4433,7 +4433,7 @@ func TestPrebuiltOverrides(t *testing.T) { } `) p := ctx.ModuleForTests("myapex.prebuilt", "android_common").Module().(*Prebuilt) p := ctx.ModuleForTests("myapex.prebuilt", "android_common_myapex.prebuilt").Module().(*Prebuilt) expected := []string{"myapex"} actual := android.AndroidMkEntriesForTest(t, ctx, p)[0].EntryMap["LOCAL_OVERRIDES_MODULES"] Loading Loading @@ -4503,7 +4503,7 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) { } // Make sure that the prebuilt_apex has the correct input APEX. prebuiltApex := ctx.ModuleForTests("myapex", "android_common") prebuiltApex := ctx.ModuleForTests("myapex", "android_common_myapex") rule = prebuiltApex.Rule("android/soong/android.Cp") if expected, actual := "myapex-arm64.apex", android.NormalizePathForTesting(rule.Input); !reflect.DeepEqual(expected, actual) { t.Errorf("expected: %q, found: %q", expected, actual) Loading Loading @@ -6522,8 +6522,8 @@ func TestAppSetBundlePrebuilt(t *testing.T) { android.AssertArrayString(t, "extractor input", []string{"myapex.hwasan.apks"}, extractedApex.Inputs.Strings()) // Ditto for the apex. m = ctx.ModuleForTests("myapex", "android_common") copiedApex := m.Output("out/soong/.intermediates/myapex/android_common/foo_v2.apex") m = ctx.ModuleForTests("myapex", "android_common_myapex") copiedApex := m.Output("out/soong/.intermediates/myapex/android_common_myapex/foo_v2.apex") android.AssertStringEquals(t, "myapex input", extractorOutput, copiedApex.Input.String()) } Loading Loading @@ -7183,7 +7183,7 @@ func TestApexSet(t *testing.T) { t.Errorf("Unexpected abis parameter - expected %q vs actual %q", expected, actual) } m = ctx.ModuleForTests("myapex", "android_common") m = ctx.ModuleForTests("myapex", "android_common_myapex") a := m.Module().(*ApexSet) expectedOverrides := []string{"foo"} actualOverrides := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_OVERRIDES_MODULES"] Loading
apex/bootclasspath_fragment_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -519,7 +519,7 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { } `) java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common", []string{ java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{ `com.android.art.apex.selector`, `prebuilt_bar`, `prebuilt_foo`, Loading