Loading apex/apex.go +8 −15 Original line number Diff line number Diff line Loading @@ -92,12 +92,6 @@ type apexBundleProperties struct { Multilib apexMultilibProperties // List of boot images that are embedded inside this APEX bundle. // // deprecated: Use Bootclasspath_fragments // TODO(b/177892522): Remove after has been replaced by Bootclasspath_fragments Boot_images []string // List of bootclasspath fragments that are embedded inside this APEX bundle. Bootclasspath_fragments []string Loading Loading @@ -573,7 +567,7 @@ var ( certificateTag = dependencyTag{name: "certificate"} executableTag = dependencyTag{name: "executable", payload: true} fsTag = dependencyTag{name: "filesystem", payload: true} bootImageTag = dependencyTag{name: "bootImage", payload: true, sourceOnly: true} bcpfTag = dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true} compatConfigTag = dependencyTag{name: "compatConfig", payload: true, sourceOnly: true} javaLibTag = dependencyTag{name: "javaLib", payload: true} jniLibTag = dependencyTag{name: "jniLib", payload: true} Loading Loading @@ -753,8 +747,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { // Common-arch dependencies come next commonVariation := ctx.Config().AndroidCommonTarget.Variations() ctx.AddFarVariationDependencies(commonVariation, bootImageTag, a.properties.Boot_images...) ctx.AddFarVariationDependencies(commonVariation, bootImageTag, a.properties.Bootclasspath_fragments...) ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...) ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...) ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...) ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...) Loading Loading @@ -1700,10 +1693,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } else { ctx.PropertyErrorf("binaries", "%q is neither cc_binary, rust_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName) } case bootImageTag: case bcpfTag: { if _, ok := child.(*java.BootImageModule); !ok { ctx.PropertyErrorf("boot_images", "%q is not a boot_image module", depName) ctx.PropertyErrorf("bootclasspath_fragments", "%q is not a boot_image module", depName) return false } bootImageInfo := ctx.OtherModuleProvider(child, java.BootImageInfoProvider).(java.BootImageInfo) Loading @@ -1711,7 +1704,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { dirInApex := filepath.Join("javalib", arch.String()) for _, f := range files { androidMkModuleName := "javalib_" + arch.String() + "_" + filepath.Base(f.String()) // TODO(b/177892522) - consider passing in the boot image module here instead of nil // TODO(b/177892522) - consider passing in the bootclasspath fragment module here instead of nil af := newApexFile(ctx, f, androidMkModuleName, dirInApex, etc, nil) filesInfo = append(filesInfo, af) } Loading Loading @@ -1932,18 +1925,18 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // dependencies. Track them. return true } else if java.IsbootImageContentDepTag(depTag) { // Add the contents of the boot image to the apex. // Add the contents of the bootclasspath fragment to the apex. switch child.(type) { case *java.Library, *java.SdkLibrary: af := apexFileForJavaModule(ctx, child.(javaModule)) if !af.ok() { ctx.PropertyErrorf("boot_images", "boot image content %q is not configured to be compiled into dex", depName) ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q is not configured to be compiled into dex", depName) return false } filesInfo = append(filesInfo, af) return true // track transitive dependencies default: ctx.PropertyErrorf("boot_images", "boot image content %q of type %q is not supported", depName, ctx.OtherModuleType(child)) ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q of type %q is not supported", depName, ctx.OtherModuleType(child)) } } else if _, ok := depTag.(android.CopyDirectlyInAnyApexTag); ok { Loading apex/boot_image_test.go +31 −31 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import ( // Contains tests for boot_image logic from java/boot_image.go as the ART boot image requires // modules from the ART apex. var prepareForTestWithBootImage = android.GroupFixturePreparers( var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers( java.PrepareForTestWithDexpreopt, PrepareForTestWithApexBuildComponents, ) Loading @@ -37,9 +37,9 @@ var prepareForTestWithArtApex = android.FixtureMergeMockFs(android.MockFS{ "system/sepolicy/apex/com.android.art-file_contexts": nil, }) func TestBootImages(t *testing.T) { func TestBootclasspathFragments(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, // Configure some libraries in the art and framework boot images. java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz", "platform:foo", "platform:bar"), prepareForTestWithArtApex, Loading Loading @@ -90,23 +90,23 @@ func TestBootImages(t *testing.T) { srcs: ["b.java"], } boot_image { name: "art-boot-image", bootclasspath_fragment { name: "art-bootclasspath-fragment", image_name: "art", apex_available: [ "com.android.art", ], } boot_image { name: "framework-boot-image", bootclasspath_fragment { name: "framework-bootclasspath-fragment", image_name: "boot", } `, ) // Make sure that the framework-boot-image is using the correct configuration. checkBootImage(t, result, "framework-boot-image", "platform:foo,platform:bar", ` // Make sure that the framework-bootclasspath-fragment is using the correct configuration. checkBootclasspathFragment(t, result, "framework-bootclasspath-fragment", "platform:foo,platform:bar", ` test_device/dex_bootjars/android/system/framework/arm/boot-foo.art test_device/dex_bootjars/android/system/framework/arm/boot-foo.oat test_device/dex_bootjars/android/system/framework/arm/boot-foo.vdex Loading @@ -121,8 +121,8 @@ test_device/dex_bootjars/android/system/framework/arm64/boot-bar.oat test_device/dex_bootjars/android/system/framework/arm64/boot-bar.vdex `) // Make sure that the art-boot-image is using the correct configuration. checkBootImage(t, result, "art-boot-image", "com.android.art:baz,com.android.art:quuz", ` // Make sure that the art-bootclasspath-fragment is using the correct configuration. checkBootclasspathFragment(t, result, "art-bootclasspath-fragment", "com.android.art:baz,com.android.art:quuz", ` test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex Loading @@ -138,7 +138,7 @@ test_device/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-quuz.vde `) } func checkBootImage(t *testing.T, result *android.TestResult, moduleName string, expectedConfiguredModules string, expectedBootImageFiles string) { func checkBootclasspathFragment(t *testing.T, result *android.TestResult, moduleName string, expectedConfiguredModules string, expectedBootclasspathFragmentFiles string) { t.Helper() bootImage := result.ModuleForTests(moduleName, "android_common").Module().(*java.BootImageModule) Loading @@ -158,12 +158,12 @@ func checkBootImage(t *testing.T, result *android.TestResult, moduleName string, } } android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootImageFiles, strings.Join(allPaths, "\n")) android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootclasspathFragmentFiles, strings.Join(allPaths, "\n")) } func TestBootImageInArtApex(t *testing.T) { func TestBootclasspathFragmentInArtApex(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, // Configure some libraries in the art boot image. Loading @@ -172,11 +172,11 @@ func TestBootImageInArtApex(t *testing.T) { apex { name: "com.android.art", key: "com.android.art.key", boot_images: [ "mybootimage", bootclasspath_fragments: [ "mybootclasspathfragment", ], // bar (like foo) should be transitively included in this apex because it is part of the // mybootimage boot_image. However, it is kept here to ensure that the apex dedups the files // mybootclasspathfragment boot_image. However, it is kept here to ensure that the apex dedups the files // correctly. java_libs: [ "bar", Loading Loading @@ -209,7 +209,7 @@ func TestBootImageInArtApex(t *testing.T) { } boot_image { name: "mybootimage", name: "mybootclasspathfragment", image_name: "art", apex_available: [ "com.android.art", Loading @@ -218,7 +218,7 @@ func TestBootImageInArtApex(t *testing.T) { // Make sure that a preferred prebuilt doesn't affect the apex. prebuilt_boot_image { name: "mybootimage", name: "mybootclasspathfragment", image_name: "art", prefer: true, apex_available: [ Loading Loading @@ -247,13 +247,13 @@ func TestBootImageInArtApex(t *testing.T) { java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ `bar`, `com.android.art.key`, `mybootimage`, `mybootclasspathfragment`, }) } func TestBootImageInPrebuiltArtApex(t *testing.T) { func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, android.FixtureMergeMockFs(android.MockFS{ Loading Loading @@ -294,7 +294,7 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) { } prebuilt_boot_image { name: "mybootimage", name: "mybootclasspathfragment", image_name: "art", apex_available: [ "com.android.art", Loading @@ -308,23 +308,23 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) { `prebuilt_foo`, }) java.CheckModuleDependencies(t, result.TestContext, "mybootimage", "android_common", []string{ java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common", []string{ `dex2oatd`, `prebuilt_bar`, `prebuilt_foo`, }) } func TestBootImageContentsNoName(t *testing.T) { func TestBootclasspathFragmentContentsNoName(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, prepareForTestWithMyapex, ).RunTestWithBp(t, ` apex { name: "myapex", key: "myapex.key", boot_images: [ "mybootimage", bootclasspath_fragments: [ "mybootclasspathfragment", ], updatable: false, } Loading Loading @@ -354,7 +354,7 @@ func TestBootImageContentsNoName(t *testing.T) { } boot_image { name: "mybootimage", name: "mybootclasspathfragment", contents: [ "foo", "bar", Loading @@ -374,7 +374,7 @@ func TestBootImageContentsNoName(t *testing.T) { java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ `myapex.key`, `mybootimage`, `mybootclasspathfragment`, }) } Loading Loading
apex/apex.go +8 −15 Original line number Diff line number Diff line Loading @@ -92,12 +92,6 @@ type apexBundleProperties struct { Multilib apexMultilibProperties // List of boot images that are embedded inside this APEX bundle. // // deprecated: Use Bootclasspath_fragments // TODO(b/177892522): Remove after has been replaced by Bootclasspath_fragments Boot_images []string // List of bootclasspath fragments that are embedded inside this APEX bundle. Bootclasspath_fragments []string Loading Loading @@ -573,7 +567,7 @@ var ( certificateTag = dependencyTag{name: "certificate"} executableTag = dependencyTag{name: "executable", payload: true} fsTag = dependencyTag{name: "filesystem", payload: true} bootImageTag = dependencyTag{name: "bootImage", payload: true, sourceOnly: true} bcpfTag = dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true} compatConfigTag = dependencyTag{name: "compatConfig", payload: true, sourceOnly: true} javaLibTag = dependencyTag{name: "javaLib", payload: true} jniLibTag = dependencyTag{name: "jniLib", payload: true} Loading Loading @@ -753,8 +747,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { // Common-arch dependencies come next commonVariation := ctx.Config().AndroidCommonTarget.Variations() ctx.AddFarVariationDependencies(commonVariation, bootImageTag, a.properties.Boot_images...) ctx.AddFarVariationDependencies(commonVariation, bootImageTag, a.properties.Bootclasspath_fragments...) ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...) ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...) ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...) ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...) Loading Loading @@ -1700,10 +1693,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } else { ctx.PropertyErrorf("binaries", "%q is neither cc_binary, rust_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName) } case bootImageTag: case bcpfTag: { if _, ok := child.(*java.BootImageModule); !ok { ctx.PropertyErrorf("boot_images", "%q is not a boot_image module", depName) ctx.PropertyErrorf("bootclasspath_fragments", "%q is not a boot_image module", depName) return false } bootImageInfo := ctx.OtherModuleProvider(child, java.BootImageInfoProvider).(java.BootImageInfo) Loading @@ -1711,7 +1704,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { dirInApex := filepath.Join("javalib", arch.String()) for _, f := range files { androidMkModuleName := "javalib_" + arch.String() + "_" + filepath.Base(f.String()) // TODO(b/177892522) - consider passing in the boot image module here instead of nil // TODO(b/177892522) - consider passing in the bootclasspath fragment module here instead of nil af := newApexFile(ctx, f, androidMkModuleName, dirInApex, etc, nil) filesInfo = append(filesInfo, af) } Loading Loading @@ -1932,18 +1925,18 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // dependencies. Track them. return true } else if java.IsbootImageContentDepTag(depTag) { // Add the contents of the boot image to the apex. // Add the contents of the bootclasspath fragment to the apex. switch child.(type) { case *java.Library, *java.SdkLibrary: af := apexFileForJavaModule(ctx, child.(javaModule)) if !af.ok() { ctx.PropertyErrorf("boot_images", "boot image content %q is not configured to be compiled into dex", depName) ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q is not configured to be compiled into dex", depName) return false } filesInfo = append(filesInfo, af) return true // track transitive dependencies default: ctx.PropertyErrorf("boot_images", "boot image content %q of type %q is not supported", depName, ctx.OtherModuleType(child)) ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q of type %q is not supported", depName, ctx.OtherModuleType(child)) } } else if _, ok := depTag.(android.CopyDirectlyInAnyApexTag); ok { Loading
apex/boot_image_test.go +31 −31 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import ( // Contains tests for boot_image logic from java/boot_image.go as the ART boot image requires // modules from the ART apex. var prepareForTestWithBootImage = android.GroupFixturePreparers( var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers( java.PrepareForTestWithDexpreopt, PrepareForTestWithApexBuildComponents, ) Loading @@ -37,9 +37,9 @@ var prepareForTestWithArtApex = android.FixtureMergeMockFs(android.MockFS{ "system/sepolicy/apex/com.android.art-file_contexts": nil, }) func TestBootImages(t *testing.T) { func TestBootclasspathFragments(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, // Configure some libraries in the art and framework boot images. java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz", "platform:foo", "platform:bar"), prepareForTestWithArtApex, Loading Loading @@ -90,23 +90,23 @@ func TestBootImages(t *testing.T) { srcs: ["b.java"], } boot_image { name: "art-boot-image", bootclasspath_fragment { name: "art-bootclasspath-fragment", image_name: "art", apex_available: [ "com.android.art", ], } boot_image { name: "framework-boot-image", bootclasspath_fragment { name: "framework-bootclasspath-fragment", image_name: "boot", } `, ) // Make sure that the framework-boot-image is using the correct configuration. checkBootImage(t, result, "framework-boot-image", "platform:foo,platform:bar", ` // Make sure that the framework-bootclasspath-fragment is using the correct configuration. checkBootclasspathFragment(t, result, "framework-bootclasspath-fragment", "platform:foo,platform:bar", ` test_device/dex_bootjars/android/system/framework/arm/boot-foo.art test_device/dex_bootjars/android/system/framework/arm/boot-foo.oat test_device/dex_bootjars/android/system/framework/arm/boot-foo.vdex Loading @@ -121,8 +121,8 @@ test_device/dex_bootjars/android/system/framework/arm64/boot-bar.oat test_device/dex_bootjars/android/system/framework/arm64/boot-bar.vdex `) // Make sure that the art-boot-image is using the correct configuration. checkBootImage(t, result, "art-boot-image", "com.android.art:baz,com.android.art:quuz", ` // Make sure that the art-bootclasspath-fragment is using the correct configuration. checkBootclasspathFragment(t, result, "art-bootclasspath-fragment", "com.android.art:baz,com.android.art:quuz", ` test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex Loading @@ -138,7 +138,7 @@ test_device/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-quuz.vde `) } func checkBootImage(t *testing.T, result *android.TestResult, moduleName string, expectedConfiguredModules string, expectedBootImageFiles string) { func checkBootclasspathFragment(t *testing.T, result *android.TestResult, moduleName string, expectedConfiguredModules string, expectedBootclasspathFragmentFiles string) { t.Helper() bootImage := result.ModuleForTests(moduleName, "android_common").Module().(*java.BootImageModule) Loading @@ -158,12 +158,12 @@ func checkBootImage(t *testing.T, result *android.TestResult, moduleName string, } } android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootImageFiles, strings.Join(allPaths, "\n")) android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootclasspathFragmentFiles, strings.Join(allPaths, "\n")) } func TestBootImageInArtApex(t *testing.T) { func TestBootclasspathFragmentInArtApex(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, // Configure some libraries in the art boot image. Loading @@ -172,11 +172,11 @@ func TestBootImageInArtApex(t *testing.T) { apex { name: "com.android.art", key: "com.android.art.key", boot_images: [ "mybootimage", bootclasspath_fragments: [ "mybootclasspathfragment", ], // bar (like foo) should be transitively included in this apex because it is part of the // mybootimage boot_image. However, it is kept here to ensure that the apex dedups the files // mybootclasspathfragment boot_image. However, it is kept here to ensure that the apex dedups the files // correctly. java_libs: [ "bar", Loading Loading @@ -209,7 +209,7 @@ func TestBootImageInArtApex(t *testing.T) { } boot_image { name: "mybootimage", name: "mybootclasspathfragment", image_name: "art", apex_available: [ "com.android.art", Loading @@ -218,7 +218,7 @@ func TestBootImageInArtApex(t *testing.T) { // Make sure that a preferred prebuilt doesn't affect the apex. prebuilt_boot_image { name: "mybootimage", name: "mybootclasspathfragment", image_name: "art", prefer: true, apex_available: [ Loading Loading @@ -247,13 +247,13 @@ func TestBootImageInArtApex(t *testing.T) { java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ `bar`, `com.android.art.key`, `mybootimage`, `mybootclasspathfragment`, }) } func TestBootImageInPrebuiltArtApex(t *testing.T) { func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, android.FixtureMergeMockFs(android.MockFS{ Loading Loading @@ -294,7 +294,7 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) { } prebuilt_boot_image { name: "mybootimage", name: "mybootclasspathfragment", image_name: "art", apex_available: [ "com.android.art", Loading @@ -308,23 +308,23 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) { `prebuilt_foo`, }) java.CheckModuleDependencies(t, result.TestContext, "mybootimage", "android_common", []string{ java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common", []string{ `dex2oatd`, `prebuilt_bar`, `prebuilt_foo`, }) } func TestBootImageContentsNoName(t *testing.T) { func TestBootclasspathFragmentContentsNoName(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment, prepareForTestWithMyapex, ).RunTestWithBp(t, ` apex { name: "myapex", key: "myapex.key", boot_images: [ "mybootimage", bootclasspath_fragments: [ "mybootclasspathfragment", ], updatable: false, } Loading Loading @@ -354,7 +354,7 @@ func TestBootImageContentsNoName(t *testing.T) { } boot_image { name: "mybootimage", name: "mybootclasspathfragment", contents: [ "foo", "bar", Loading @@ -374,7 +374,7 @@ func TestBootImageContentsNoName(t *testing.T) { java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ `myapex.key`, `mybootimage`, `mybootclasspathfragment`, }) } Loading