Add bootclasspath_fragment as an alias for boot_image

This is part of the work to rename boot_image to bootclasspath_fragment
which is being done for two reasons:
1. To avoid clashing with the bootimg module type.
2. To better reflect what this represents.

While a bootclasspath_fragment can create what ART calls a boot image
(which is different to what the bootimg module type represents) it does
not have to do so.

Bug: 177892522
Test: m nothing
Change-Id: Ib45604be7adc790ded9e27a2ac812dd7522ca8db
This commit is contained in:
Paul Duffin
2021-03-29 11:02:53 +01:00
parent 837486d308
commit 4b64ba05b6
3 changed files with 36 additions and 1 deletions

View File

@@ -27,17 +27,29 @@ import (
func init() {
RegisterBootImageBuildComponents(android.InitRegistrationContext)
// TODO(b/177892522): Remove after has been replaced by bootclasspath_fragments
android.RegisterSdkMemberType(&bootImageMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "boot_images",
SupportsSdk: true,
},
})
android.RegisterSdkMemberType(&bootImageMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "bootclasspath_fragments",
SupportsSdk: true,
},
})
}
func RegisterBootImageBuildComponents(ctx android.RegistrationContext) {
// TODO(b/177892522): Remove after has been replaced by bootclasspath_fragment
ctx.RegisterModuleType("boot_image", bootImageFactory)
ctx.RegisterModuleType("prebuilt_boot_image", prebuiltBootImageFactory)
ctx.RegisterModuleType("bootclasspath_fragment", bootImageFactory)
ctx.RegisterModuleType("prebuilt_bootclasspath_fragment", prebuiltBootImageFactory)
}
type bootImageProperties struct {
@@ -172,7 +184,11 @@ func (b *bootImageMemberType) IsInstance(module android.Module) bool {
}
func (b *bootImageMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "prebuilt_boot_image")
if b.PropertyName == "boot_images" {
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "prebuilt_boot_image")
} else {
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "prebuilt_bootclasspath_fragment")
}
}
func (b *bootImageMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {

View File

@@ -41,6 +41,18 @@ func TestUnknownBootImage(t *testing.T) {
`)
}
func TestUnknownBootclasspathFragmentImageName(t *testing.T) {
prepareForTestWithBootImage.
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
RunTestWithBp(t, `
bootclasspath_fragment {
name: "unknown-boot-image",
image_name: "unknown",
}
`)
}
func TestUnknownPrebuiltBootImage(t *testing.T) {
prepareForTestWithBootImage.
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(