Remove unused boot_images property and rename tag

Bug: 177892522
Test: m nothing
Change-Id: I9ffd6dda23aefea183f87e22497c17fb8a276ece
This commit is contained in:
Paul Duffin 2021-04-20 12:40:07 +01:00
parent 42030eafff
commit 94f1963b6d
2 changed files with 39 additions and 46 deletions

View File

@ -92,12 +92,6 @@ type apexBundleProperties struct {
Multilib apexMultilibProperties 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. // List of bootclasspath fragments that are embedded inside this APEX bundle.
Bootclasspath_fragments []string Bootclasspath_fragments []string
@ -573,7 +567,7 @@ var (
certificateTag = dependencyTag{name: "certificate"} certificateTag = dependencyTag{name: "certificate"}
executableTag = dependencyTag{name: "executable", payload: true} executableTag = dependencyTag{name: "executable", payload: true}
fsTag = dependencyTag{name: "filesystem", 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} compatConfigTag = dependencyTag{name: "compatConfig", payload: true, sourceOnly: true}
javaLibTag = dependencyTag{name: "javaLib", payload: true} javaLibTag = dependencyTag{name: "javaLib", payload: true}
jniLibTag = dependencyTag{name: "jniLib", payload: true} jniLibTag = dependencyTag{name: "jniLib", payload: true}
@ -753,8 +747,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
// Common-arch dependencies come next // Common-arch dependencies come next
commonVariation := ctx.Config().AndroidCommonTarget.Variations() commonVariation := ctx.Config().AndroidCommonTarget.Variations()
ctx.AddFarVariationDependencies(commonVariation, bootImageTag, a.properties.Boot_images...) ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...)
ctx.AddFarVariationDependencies(commonVariation, bootImageTag, a.properties.Bootclasspath_fragments...)
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...) ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...) ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...)
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...) ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
@ -1700,10 +1693,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
} else { } 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) 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 { 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 return false
} }
bootImageInfo := ctx.OtherModuleProvider(child, java.BootImageInfoProvider).(java.BootImageInfo) bootImageInfo := ctx.OtherModuleProvider(child, java.BootImageInfoProvider).(java.BootImageInfo)
@ -1711,7 +1704,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
dirInApex := filepath.Join("javalib", arch.String()) dirInApex := filepath.Join("javalib", arch.String())
for _, f := range files { for _, f := range files {
androidMkModuleName := "javalib_" + arch.String() + "_" + filepath.Base(f.String()) 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) af := newApexFile(ctx, f, androidMkModuleName, dirInApex, etc, nil)
filesInfo = append(filesInfo, af) filesInfo = append(filesInfo, af)
} }
@ -1932,18 +1925,18 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// dependencies. Track them. // dependencies. Track them.
return true return true
} else if java.IsbootImageContentDepTag(depTag) { } 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) { switch child.(type) {
case *java.Library, *java.SdkLibrary: case *java.Library, *java.SdkLibrary:
af := apexFileForJavaModule(ctx, child.(javaModule)) af := apexFileForJavaModule(ctx, child.(javaModule))
if !af.ok() { 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 return false
} }
filesInfo = append(filesInfo, af) filesInfo = append(filesInfo, af)
return true // track transitive dependencies return true // track transitive dependencies
default: 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 { } else if _, ok := depTag.(android.CopyDirectlyInAnyApexTag); ok {

View File

@ -25,7 +25,7 @@ import (
// Contains tests for boot_image logic from java/boot_image.go as the ART boot image requires // Contains tests for boot_image logic from java/boot_image.go as the ART boot image requires
// modules from the ART apex. // modules from the ART apex.
var prepareForTestWithBootImage = android.GroupFixturePreparers( var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers(
java.PrepareForTestWithDexpreopt, java.PrepareForTestWithDexpreopt,
PrepareForTestWithApexBuildComponents, PrepareForTestWithApexBuildComponents,
) )
@ -37,9 +37,9 @@ var prepareForTestWithArtApex = android.FixtureMergeMockFs(android.MockFS{
"system/sepolicy/apex/com.android.art-file_contexts": nil, "system/sepolicy/apex/com.android.art-file_contexts": nil,
}) })
func TestBootImages(t *testing.T) { func TestBootclasspathFragments(t *testing.T) {
result := android.GroupFixturePreparers( result := android.GroupFixturePreparers(
prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment,
// Configure some libraries in the art and framework boot images. // Configure some libraries in the art and framework boot images.
java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz", "platform:foo", "platform:bar"), java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz", "platform:foo", "platform:bar"),
prepareForTestWithArtApex, prepareForTestWithArtApex,
@ -90,23 +90,23 @@ func TestBootImages(t *testing.T) {
srcs: ["b.java"], srcs: ["b.java"],
} }
boot_image { bootclasspath_fragment {
name: "art-boot-image", name: "art-bootclasspath-fragment",
image_name: "art", image_name: "art",
apex_available: [ apex_available: [
"com.android.art", "com.android.art",
], ],
} }
boot_image { bootclasspath_fragment {
name: "framework-boot-image", name: "framework-bootclasspath-fragment",
image_name: "boot", image_name: "boot",
} }
`, `,
) )
// Make sure that the framework-boot-image is using the correct configuration. // Make sure that the framework-bootclasspath-fragment is using the correct configuration.
checkBootImage(t, result, "framework-boot-image", "platform:foo,platform:bar", ` 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.art
test_device/dex_bootjars/android/system/framework/arm/boot-foo.oat test_device/dex_bootjars/android/system/framework/arm/boot-foo.oat
test_device/dex_bootjars/android/system/framework/arm/boot-foo.vdex test_device/dex_bootjars/android/system/framework/arm/boot-foo.vdex
@ -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 test_device/dex_bootjars/android/system/framework/arm64/boot-bar.vdex
`) `)
// Make sure that the art-boot-image is using the correct configuration. // Make sure that the art-bootclasspath-fragment is using the correct configuration.
checkBootImage(t, result, "art-boot-image", "com.android.art:baz,com.android.art:quuz", ` 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.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.oat
test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex test_device/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex
@ -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() t.Helper()
bootImage := result.ModuleForTests(moduleName, "android_common").Module().(*java.BootImageModule) bootImage := result.ModuleForTests(moduleName, "android_common").Module().(*java.BootImageModule)
@ -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( result := android.GroupFixturePreparers(
prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment,
prepareForTestWithArtApex, prepareForTestWithArtApex,
// Configure some libraries in the art boot image. // Configure some libraries in the art boot image.
@ -172,11 +172,11 @@ func TestBootImageInArtApex(t *testing.T) {
apex { apex {
name: "com.android.art", name: "com.android.art",
key: "com.android.art.key", key: "com.android.art.key",
boot_images: [ bootclasspath_fragments: [
"mybootimage", "mybootclasspathfragment",
], ],
// bar (like foo) should be transitively included in this apex because it is part of the // 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. // correctly.
java_libs: [ java_libs: [
"bar", "bar",
@ -209,7 +209,7 @@ func TestBootImageInArtApex(t *testing.T) {
} }
boot_image { boot_image {
name: "mybootimage", name: "mybootclasspathfragment",
image_name: "art", image_name: "art",
apex_available: [ apex_available: [
"com.android.art", "com.android.art",
@ -218,7 +218,7 @@ func TestBootImageInArtApex(t *testing.T) {
// Make sure that a preferred prebuilt doesn't affect the apex. // Make sure that a preferred prebuilt doesn't affect the apex.
prebuilt_boot_image { prebuilt_boot_image {
name: "mybootimage", name: "mybootclasspathfragment",
image_name: "art", image_name: "art",
prefer: true, prefer: true,
apex_available: [ apex_available: [
@ -247,13 +247,13 @@ func TestBootImageInArtApex(t *testing.T) {
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
`bar`, `bar`,
`com.android.art.key`, `com.android.art.key`,
`mybootimage`, `mybootclasspathfragment`,
}) })
} }
func TestBootImageInPrebuiltArtApex(t *testing.T) { func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
result := android.GroupFixturePreparers( result := android.GroupFixturePreparers(
prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment,
prepareForTestWithArtApex, prepareForTestWithArtApex,
android.FixtureMergeMockFs(android.MockFS{ android.FixtureMergeMockFs(android.MockFS{
@ -294,7 +294,7 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) {
} }
prebuilt_boot_image { prebuilt_boot_image {
name: "mybootimage", name: "mybootclasspathfragment",
image_name: "art", image_name: "art",
apex_available: [ apex_available: [
"com.android.art", "com.android.art",
@ -308,23 +308,23 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) {
`prebuilt_foo`, `prebuilt_foo`,
}) })
java.CheckModuleDependencies(t, result.TestContext, "mybootimage", "android_common", []string{ java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common", []string{
`dex2oatd`, `dex2oatd`,
`prebuilt_bar`, `prebuilt_bar`,
`prebuilt_foo`, `prebuilt_foo`,
}) })
} }
func TestBootImageContentsNoName(t *testing.T) { func TestBootclasspathFragmentContentsNoName(t *testing.T) {
result := android.GroupFixturePreparers( result := android.GroupFixturePreparers(
prepareForTestWithBootImage, prepareForTestWithBootclasspathFragment,
prepareForTestWithMyapex, prepareForTestWithMyapex,
).RunTestWithBp(t, ` ).RunTestWithBp(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
boot_images: [ bootclasspath_fragments: [
"mybootimage", "mybootclasspathfragment",
], ],
updatable: false, updatable: false,
} }
@ -354,7 +354,7 @@ func TestBootImageContentsNoName(t *testing.T) {
} }
boot_image { boot_image {
name: "mybootimage", name: "mybootclasspathfragment",
contents: [ contents: [
"foo", "foo",
"bar", "bar",
@ -374,7 +374,7 @@ func TestBootImageContentsNoName(t *testing.T) {
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
`myapex.key`, `myapex.key`,
`mybootimage`, `mybootclasspathfragment`,
}) })
} }