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
// 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
@ -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}
@ -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...)
@ -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)
@ -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)
}
@ -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 {

View File

@ -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,
)
@ -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,
@ -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
@ -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
@ -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)
@ -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.
@ -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",
@ -209,7 +209,7 @@ func TestBootImageInArtApex(t *testing.T) {
}
boot_image {
name: "mybootimage",
name: "mybootclasspathfragment",
image_name: "art",
apex_available: [
"com.android.art",
@ -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: [
@ -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{
@ -294,7 +294,7 @@ func TestBootImageInPrebuiltArtApex(t *testing.T) {
}
prebuilt_boot_image {
name: "mybootimage",
name: "mybootclasspathfragment",
image_name: "art",
apex_available: [
"com.android.art",
@ -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,
}
@ -354,7 +354,7 @@ func TestBootImageContentsNoName(t *testing.T) {
}
boot_image {
name: "mybootimage",
name: "mybootclasspathfragment",
contents: [
"foo",
"bar",
@ -374,7 +374,7 @@ func TestBootImageContentsNoName(t *testing.T) {
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
`myapex.key`,
`mybootimage`,
`mybootclasspathfragment`,
})
}