Loading apex/apex_test.go +10 −5 Original line number Diff line number Diff line Loading @@ -4826,7 +4826,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { name: "myapex", enabled: false, key: "myapex.key", java_libs: ["libfoo"], java_libs: ["libfoo", "libbar"], } apex_key { Loading Loading @@ -4884,8 +4884,8 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { // Make sure that the dex file from the prebuilt_apex contributes to the hiddenapi index file. checkHiddenAPIIndexInputs(t, ctx, ` .intermediates/prebuilt_libbar/android_common_prebuilt_myapex/hiddenapi/index.csv .intermediates/prebuilt_libfoo/android_common_prebuilt_myapex/hiddenapi/index.csv .intermediates/prebuilt_libbar/android_common_myapex/hiddenapi/index.csv .intermediates/prebuilt_libfoo/android_common_myapex/hiddenapi/index.csv `) }) } Loading Loading @@ -6555,6 +6555,11 @@ func testDexpreoptWithApexes(t *testing.T, bp, errmsg string, preparer android.F PrepareForTestWithApexBuildComponents, preparer, fs.AddToFixture(), android.FixtureAddTextFile("frameworks/base/boot/Android.bp", ` platform_bootclasspath { name: "platform-bootclasspath", } `), ). ExtendWithErrorHandler(errorHandler). RunTestWithBp(t, bp) Loading Loading @@ -6657,13 +6662,13 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) { }) t.Run("nonexistent jar in the ART boot image => error", func(t *testing.T) { err := "failed to find a dex jar path for module 'nonexistent'" err := `"platform-bootclasspath" depends on undefined module "nonexistent"` preparer := java.FixtureConfigureBootJars("platform:nonexistent") testNoUpdatableJarsInBootImage(t, err, preparer) }) t.Run("nonexistent jar in the framework boot image => error", func(t *testing.T) { err := "failed to find a dex jar path for module 'nonexistent'" err := `"platform-bootclasspath" depends on undefined module "nonexistent"` preparer := java.FixtureConfigureBootJars("platform:nonexistent") testNoUpdatableJarsInBootImage(t, err, preparer) }) Loading apex/prebuilt.go +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) { // Create an ApexInfo for the prebuilt_apex. apexInfo := android.ApexInfo{ ApexVariationName: mctx.ModuleName(), ApexVariationName: android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName()), InApexes: []string{mctx.ModuleName()}, ApexContents: []*android.ApexContents{apexContents}, ForPrebuiltApex: true, Loading java/platform_bootclasspath.go +24 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,30 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st // error, unless missing dependencies are allowed. The simplest way to handle that is to add a // dependency that will not be satisfied and the default behavior will handle it. if !addedDep { ctx.AddFarVariationDependencies(variations, tag, name) // Add dependency on the unprefixed (i.e. source or renamed prebuilt) module which we know does // not exist. The resulting error message will contain useful information about the available // variants. reportMissingVariationDependency(ctx, variations, name) // Add dependency on the missing prefixed prebuilt variant too if a module with that name exists // so that information about its available variants will be reported too. if ctx.OtherModuleExists(prebuiltName) { reportMissingVariationDependency(ctx, variations, prebuiltName) } } } // reportMissingVariationDependency intentionally adds a dependency on a missing variation in order // to generate an appropriate error message with information about the available variations. func reportMissingVariationDependency(ctx android.BottomUpMutatorContext, variations []blueprint.Variation, name string) { modules := ctx.AddFarVariationDependencies(variations, nil, name) if len(modules) != 1 { panic(fmt.Errorf("Internal Error: expected one module, found %d", len(modules))) return } if modules[0] != nil { panic(fmt.Errorf("Internal Error: expected module to be missing but was found: %q", modules[0])) return } } Loading Loading
apex/apex_test.go +10 −5 Original line number Diff line number Diff line Loading @@ -4826,7 +4826,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { name: "myapex", enabled: false, key: "myapex.key", java_libs: ["libfoo"], java_libs: ["libfoo", "libbar"], } apex_key { Loading Loading @@ -4884,8 +4884,8 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { // Make sure that the dex file from the prebuilt_apex contributes to the hiddenapi index file. checkHiddenAPIIndexInputs(t, ctx, ` .intermediates/prebuilt_libbar/android_common_prebuilt_myapex/hiddenapi/index.csv .intermediates/prebuilt_libfoo/android_common_prebuilt_myapex/hiddenapi/index.csv .intermediates/prebuilt_libbar/android_common_myapex/hiddenapi/index.csv .intermediates/prebuilt_libfoo/android_common_myapex/hiddenapi/index.csv `) }) } Loading Loading @@ -6555,6 +6555,11 @@ func testDexpreoptWithApexes(t *testing.T, bp, errmsg string, preparer android.F PrepareForTestWithApexBuildComponents, preparer, fs.AddToFixture(), android.FixtureAddTextFile("frameworks/base/boot/Android.bp", ` platform_bootclasspath { name: "platform-bootclasspath", } `), ). ExtendWithErrorHandler(errorHandler). RunTestWithBp(t, bp) Loading Loading @@ -6657,13 +6662,13 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) { }) t.Run("nonexistent jar in the ART boot image => error", func(t *testing.T) { err := "failed to find a dex jar path for module 'nonexistent'" err := `"platform-bootclasspath" depends on undefined module "nonexistent"` preparer := java.FixtureConfigureBootJars("platform:nonexistent") testNoUpdatableJarsInBootImage(t, err, preparer) }) t.Run("nonexistent jar in the framework boot image => error", func(t *testing.T) { err := "failed to find a dex jar path for module 'nonexistent'" err := `"platform-bootclasspath" depends on undefined module "nonexistent"` preparer := java.FixtureConfigureBootJars("platform:nonexistent") testNoUpdatableJarsInBootImage(t, err, preparer) }) Loading
apex/prebuilt.go +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) { // Create an ApexInfo for the prebuilt_apex. apexInfo := android.ApexInfo{ ApexVariationName: mctx.ModuleName(), ApexVariationName: android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName()), InApexes: []string{mctx.ModuleName()}, ApexContents: []*android.ApexContents{apexContents}, ForPrebuiltApex: true, Loading
java/platform_bootclasspath.go +24 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,30 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st // error, unless missing dependencies are allowed. The simplest way to handle that is to add a // dependency that will not be satisfied and the default behavior will handle it. if !addedDep { ctx.AddFarVariationDependencies(variations, tag, name) // Add dependency on the unprefixed (i.e. source or renamed prebuilt) module which we know does // not exist. The resulting error message will contain useful information about the available // variants. reportMissingVariationDependency(ctx, variations, name) // Add dependency on the missing prefixed prebuilt variant too if a module with that name exists // so that information about its available variants will be reported too. if ctx.OtherModuleExists(prebuiltName) { reportMissingVariationDependency(ctx, variations, prebuiltName) } } } // reportMissingVariationDependency intentionally adds a dependency on a missing variation in order // to generate an appropriate error message with information about the available variations. func reportMissingVariationDependency(ctx android.BottomUpMutatorContext, variations []blueprint.Variation, name string) { modules := ctx.AddFarVariationDependencies(variations, nil, name) if len(modules) != 1 { panic(fmt.Errorf("Internal Error: expected one module, found %d", len(modules))) return } if modules[0] != nil { panic(fmt.Errorf("Internal Error: expected module to be missing but was found: %q", modules[0])) return } } Loading