Rename BootImageModule to BootclasspathFragmentModule
Also renames files, tests, module types in a similar fashion. There are still some references to image and boot image. They are kept for the following reasons: * image_name - this is the name of an ART boot image, i.e. the collection of .art/.oat/.vdex files. * BootImageInfo - again this is related to the ART boot image. * .../art_boot_images/... paths - ditto. Bug: 177892522 Test: m nothing Change-Id: Ie1f4738061d131fee75de48bc26a7601481bad4d
This commit is contained in:
parent
d5f8421afd
commit
7771eba88e
7 changed files with 102 additions and 100 deletions
|
@ -30,7 +30,7 @@ bootstrap_go_package {
|
|||
],
|
||||
testSrcs: [
|
||||
"apex_test.go",
|
||||
"boot_image_test.go",
|
||||
"bootclasspath_fragment_test.go",
|
||||
"platform_bootclasspath_test.go",
|
||||
"vndk_test.go",
|
||||
],
|
||||
|
|
|
@ -1695,7 +1695,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
}
|
||||
case bcpfTag:
|
||||
{
|
||||
if _, ok := child.(*java.BootImageModule); !ok {
|
||||
if _, ok := child.(*java.BootclasspathFragmentModule); !ok {
|
||||
ctx.PropertyErrorf("bootclasspath_fragments", "%q is not a boot_image module", depName)
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"android/soong/java"
|
||||
)
|
||||
|
||||
// Contains tests for boot_image logic from java/boot_image.go as the ART boot image requires
|
||||
// modules from the ART apex.
|
||||
// Contains tests for bootclasspath_fragment logic from java/bootclasspath_fragment.go as the ART
|
||||
// bootclasspath_fragment requires modules from the ART apex.
|
||||
|
||||
var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers(
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
|
@ -40,7 +40,7 @@ var prepareForTestWithArtApex = android.FixtureMergeMockFs(android.MockFS{
|
|||
func TestBootclasspathFragments(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithBootclasspathFragment,
|
||||
// Configure some libraries in the art and framework boot images.
|
||||
// Configure some libraries in the art bootclasspath_fragment and platform_bootclasspath.
|
||||
java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz", "platform:foo", "platform:bar"),
|
||||
prepareForTestWithArtApex,
|
||||
|
||||
|
@ -141,9 +141,9 @@ test_device/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-quuz.vde
|
|||
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)
|
||||
bootclasspathFragment := result.ModuleForTests(moduleName, "android_common").Module().(*java.BootclasspathFragmentModule)
|
||||
|
||||
bootImageInfo := result.ModuleProvider(bootImage, java.BootImageInfoProvider).(java.BootImageInfo)
|
||||
bootImageInfo := result.ModuleProvider(bootclasspathFragment, java.BootImageInfoProvider).(java.BootImageInfo)
|
||||
modules := bootImageInfo.Modules()
|
||||
android.AssertStringEquals(t, "invalid modules for "+moduleName, expectedConfiguredModules, modules.String())
|
||||
|
||||
|
@ -166,7 +166,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
|
|||
prepareForTestWithBootclasspathFragment,
|
||||
prepareForTestWithArtApex,
|
||||
|
||||
// Configure some libraries in the art boot image.
|
||||
// Configure some libraries in the art bootclasspath_fragment.
|
||||
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
|
||||
).RunTestWithBp(t, `
|
||||
apex {
|
||||
|
@ -176,8 +176,8 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
|
|||
"mybootclasspathfragment",
|
||||
],
|
||||
// bar (like foo) should be transitively included in this apex because it is part of the
|
||||
// mybootclasspathfragment boot_image. However, it is kept here to ensure that the apex dedups the files
|
||||
// correctly.
|
||||
// mybootclasspathfragment bootclasspath_fragment. However, it is kept here to ensure that the
|
||||
// apex dedups the files correctly.
|
||||
java_libs: [
|
||||
"bar",
|
||||
],
|
||||
|
@ -208,7 +208,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
|
|||
],
|
||||
}
|
||||
|
||||
boot_image {
|
||||
bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
image_name: "art",
|
||||
apex_available: [
|
||||
|
@ -233,7 +233,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
|
|||
}
|
||||
|
||||
// Make sure that a preferred prebuilt doesn't affect the apex.
|
||||
prebuilt_boot_image {
|
||||
prebuilt_bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
image_name: "art",
|
||||
prefer: true,
|
||||
|
@ -277,7 +277,7 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
|
|||
"com.android.art-arm.apex": nil,
|
||||
}),
|
||||
|
||||
// Configure some libraries in the art boot image.
|
||||
// Configure some libraries in the art bootclasspath_fragment.
|
||||
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
|
||||
).RunTestWithBp(t, `
|
||||
prebuilt_apex {
|
||||
|
@ -309,7 +309,7 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
|
|||
],
|
||||
}
|
||||
|
||||
prebuilt_boot_image {
|
||||
prebuilt_bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
image_name: "art",
|
||||
apex_available: [
|
||||
|
@ -369,7 +369,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
|
|||
],
|
||||
}
|
||||
|
||||
boot_image {
|
||||
bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
contents: [
|
||||
"foo",
|
|
@ -29,9 +29,9 @@ bootstrap_go_package {
|
|||
"app_import.go",
|
||||
"app_set.go",
|
||||
"base.go",
|
||||
"boot_image.go",
|
||||
"boot_jars.go",
|
||||
"bootclasspath.go",
|
||||
"bootclasspath_fragment.go",
|
||||
"builder.go",
|
||||
"classpath_fragment.go",
|
||||
"device_host_converter.go",
|
||||
|
@ -73,7 +73,7 @@ bootstrap_go_package {
|
|||
"app_import_test.go",
|
||||
"app_set_test.go",
|
||||
"app_test.go",
|
||||
"boot_image_test.go",
|
||||
"bootclasspath_fragment_test.go",
|
||||
"device_host_converter_test.go",
|
||||
"dexpreopt_test.go",
|
||||
"dexpreopt_bootjars_test.go",
|
||||
|
|
|
@ -27,17 +27,17 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
RegisterBootImageBuildComponents(android.InitRegistrationContext)
|
||||
registerBootclasspathFragmentBuildComponents(android.InitRegistrationContext)
|
||||
|
||||
// TODO(b/177892522): Remove after has been replaced by bootclasspath_fragments
|
||||
android.RegisterSdkMemberType(&bootImageMemberType{
|
||||
android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{
|
||||
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
||||
PropertyName: "boot_images",
|
||||
SupportsSdk: true,
|
||||
},
|
||||
})
|
||||
|
||||
android.RegisterSdkMemberType(&bootImageMemberType{
|
||||
android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{
|
||||
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
||||
PropertyName: "bootclasspath_fragments",
|
||||
SupportsSdk: true,
|
||||
|
@ -45,23 +45,23 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
func RegisterBootImageBuildComponents(ctx android.RegistrationContext) {
|
||||
func registerBootclasspathFragmentBuildComponents(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("boot_image", bootclasspathFragmentFactory)
|
||||
ctx.RegisterModuleType("prebuilt_boot_image", prebuiltBootclasspathFragmentFactory)
|
||||
|
||||
ctx.RegisterModuleType("bootclasspath_fragment", bootImageFactory)
|
||||
ctx.RegisterModuleType("prebuilt_bootclasspath_fragment", prebuiltBootImageFactory)
|
||||
ctx.RegisterModuleType("bootclasspath_fragment", bootclasspathFragmentFactory)
|
||||
ctx.RegisterModuleType("prebuilt_bootclasspath_fragment", prebuiltBootclasspathFragmentFactory)
|
||||
}
|
||||
|
||||
type bootclasspathFragmentContentDependencyTag struct {
|
||||
blueprint.BaseDependencyTag
|
||||
}
|
||||
|
||||
// Avoid having to make boot image content visible to the boot image.
|
||||
// Avoid having to make bootclasspath_fragment content visible to the bootclasspath_fragment.
|
||||
//
|
||||
// This is a temporary workaround to make it easier to migrate to boot image modules with proper
|
||||
// dependencies.
|
||||
// This is a temporary workaround to make it easier to migrate to bootclasspath_fragment modules
|
||||
// with proper dependencies.
|
||||
// TODO(b/177892522): Remove this and add needed visibility.
|
||||
func (b bootclasspathFragmentContentDependencyTag) ExcludeFromVisibilityEnforcement() {
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func (b bootclasspathFragmentContentDependencyTag) ReplaceSourceWithPrebuilt() b
|
|||
return false
|
||||
}
|
||||
|
||||
// The tag used for the dependency between the boot image module and its contents.
|
||||
// The tag used for the dependency between the bootclasspath_fragment module and its contents.
|
||||
var bootclasspathFragmentContentDepTag = bootclasspathFragmentContentDependencyTag{}
|
||||
|
||||
var _ android.ExcludeFromVisibilityEnforcementTag = bootclasspathFragmentContentDepTag
|
||||
|
@ -81,13 +81,13 @@ func IsBootclasspathFragmentContentDepTag(tag blueprint.DependencyTag) bool {
|
|||
return tag == bootclasspathFragmentContentDepTag
|
||||
}
|
||||
|
||||
type bootImageProperties struct {
|
||||
type bootclasspathFragmentProperties struct {
|
||||
// The name of the image this represents.
|
||||
//
|
||||
// If specified then it must be one of "art" or "boot".
|
||||
Image_name *string
|
||||
|
||||
// The contents of this boot image, could be either java_library, java_sdk_library, or boot_image.
|
||||
// The contents of this bootclasspath_fragment, could be either java_library, java_sdk_library, or boot_image.
|
||||
//
|
||||
// The order of this list matters as it is the order that is used in the bootclasspath.
|
||||
Contents []string
|
||||
|
@ -95,28 +95,30 @@ type bootImageProperties struct {
|
|||
Hidden_api HiddenAPIFlagFileProperties
|
||||
}
|
||||
|
||||
type BootImageModule struct {
|
||||
type BootclasspathFragmentModule struct {
|
||||
android.ModuleBase
|
||||
android.ApexModuleBase
|
||||
android.SdkBase
|
||||
properties bootImageProperties
|
||||
properties bootclasspathFragmentProperties
|
||||
}
|
||||
|
||||
func bootImageFactory() android.Module {
|
||||
m := &BootImageModule{}
|
||||
func bootclasspathFragmentFactory() android.Module {
|
||||
m := &BootclasspathFragmentModule{}
|
||||
m.AddProperties(&m.properties)
|
||||
android.InitApexModule(m)
|
||||
android.InitSdkAwareModule(m)
|
||||
android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||
|
||||
// Perform some consistency checking to ensure that the configuration is correct.
|
||||
// Initialize the contents property from the image_name.
|
||||
android.AddLoadHook(m, func(ctx android.LoadHookContext) {
|
||||
bootImageConsistencyCheck(ctx, m)
|
||||
bootclasspathFragmentInitContentsFromImage(ctx, m)
|
||||
})
|
||||
return m
|
||||
}
|
||||
|
||||
func bootImageConsistencyCheck(ctx android.EarlyModuleContext, m *BootImageModule) {
|
||||
// bootclasspathFragmentInitContentsFromImage will initialize the contents property from the image_name if
|
||||
// necessary.
|
||||
func bootclasspathFragmentInitContentsFromImage(ctx android.EarlyModuleContext, m *BootclasspathFragmentModule) {
|
||||
contents := m.properties.Contents
|
||||
if m.properties.Image_name == nil && len(contents) == 0 {
|
||||
ctx.ModuleErrorf(`neither of the "image_name" and "contents" properties have been supplied, please supply exactly one`)
|
||||
|
@ -206,7 +208,7 @@ func (i BootImageInfo) AndroidBootImageFilesByArchType() map[android.ArchType]an
|
|||
return files
|
||||
}
|
||||
|
||||
func (b *BootImageModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
|
||||
func (b *BootclasspathFragmentModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
|
||||
tag := ctx.OtherModuleDependencyTag(dep)
|
||||
if IsBootclasspathFragmentContentDepTag(tag) {
|
||||
// Boot image contents are automatically added to apex.
|
||||
|
@ -219,7 +221,7 @@ func (b *BootImageModule) DepIsInSameApex(ctx android.BaseModuleContext, dep and
|
|||
panic(fmt.Errorf("boot_image module %q should not have a dependency on %q via tag %s", b, dep, android.PrettyPrintTag(tag)))
|
||||
}
|
||||
|
||||
func (b *BootImageModule) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
|
||||
func (b *BootclasspathFragmentModule) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -227,9 +229,9 @@ func (b *BootImageModule) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
|||
// corresponding source module are renamed. This means that adding a dependency using a name without
|
||||
// a prebuilt_ prefix will always resolve to a source module and when using a name with that prefix
|
||||
// it will always resolve to a prebuilt module.
|
||||
func (b *BootImageModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
func (b *BootclasspathFragmentModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
module := ctx.Module()
|
||||
_, isSourceModule := module.(*BootImageModule)
|
||||
_, isSourceModule := module.(*BootclasspathFragmentModule)
|
||||
|
||||
for _, name := range b.properties.Contents {
|
||||
// A bootclasspath_fragment must depend only on other source modules, while the
|
||||
|
@ -244,7 +246,7 @@ func (b *BootImageModule) ComponentDepsMutator(ctx android.BottomUpMutatorContex
|
|||
|
||||
}
|
||||
|
||||
func (b *BootImageModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
||||
if SkipDexpreoptBootJars(ctx) {
|
||||
return
|
||||
|
@ -255,7 +257,7 @@ func (b *BootImageModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
dexpreopt.RegisterToolDeps(ctx)
|
||||
}
|
||||
|
||||
func (b *BootImageModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
// Perform hidden API processing.
|
||||
b.generateHiddenAPIBuildActions(ctx)
|
||||
|
||||
|
@ -280,7 +282,7 @@ func (b *BootImageModule) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||
ctx.SetProvider(BootImageInfoProvider, info)
|
||||
}
|
||||
|
||||
func (b *BootImageModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
|
||||
func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
|
||||
// Get a map of the image configs that are supported.
|
||||
imageConfigs := genBootImageConfigs(ctx)
|
||||
|
||||
|
@ -300,7 +302,7 @@ func (b *BootImageModule) getImageConfig(ctx android.EarlyModuleContext) *bootIm
|
|||
}
|
||||
|
||||
// generateHiddenAPIBuildActions generates all the hidden API related build rules.
|
||||
func (b *BootImageModule) generateHiddenAPIBuildActions(ctx android.ModuleContext) {
|
||||
func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext) {
|
||||
// Resolve the properties to paths.
|
||||
flagFileInfo := b.properties.Hidden_api.hiddenAPIFlagFileInfo(ctx)
|
||||
|
||||
|
@ -308,20 +310,20 @@ func (b *BootImageModule) generateHiddenAPIBuildActions(ctx android.ModuleContex
|
|||
ctx.SetProvider(hiddenAPIFlagFileInfoProvider, flagFileInfo)
|
||||
}
|
||||
|
||||
type bootImageMemberType struct {
|
||||
type bootclasspathFragmentMemberType struct {
|
||||
android.SdkMemberTypeBase
|
||||
}
|
||||
|
||||
func (b *bootImageMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
|
||||
func (b *bootclasspathFragmentMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
|
||||
mctx.AddVariationDependencies(nil, dependencyTag, names...)
|
||||
}
|
||||
|
||||
func (b *bootImageMemberType) IsInstance(module android.Module) bool {
|
||||
_, ok := module.(*BootImageModule)
|
||||
func (b *bootclasspathFragmentMemberType) IsInstance(module android.Module) bool {
|
||||
_, ok := module.(*BootclasspathFragmentModule)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (b *bootImageMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
|
||||
func (b *bootclasspathFragmentMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
|
||||
if b.PropertyName == "boot_images" {
|
||||
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "prebuilt_boot_image")
|
||||
} else {
|
||||
|
@ -329,11 +331,11 @@ func (b *bootImageMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, me
|
|||
}
|
||||
}
|
||||
|
||||
func (b *bootImageMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
|
||||
return &bootImageSdkMemberProperties{}
|
||||
func (b *bootclasspathFragmentMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
|
||||
return &bootclasspathFragmentSdkMemberProperties{}
|
||||
}
|
||||
|
||||
type bootImageSdkMemberProperties struct {
|
||||
type bootclasspathFragmentSdkMemberProperties struct {
|
||||
android.SdkMemberPropertiesBase
|
||||
|
||||
// The image name
|
||||
|
@ -346,8 +348,8 @@ type bootImageSdkMemberProperties struct {
|
|||
Flag_files_by_category map[*hiddenAPIFlagFileCategory]android.Paths
|
||||
}
|
||||
|
||||
func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
||||
module := variant.(*BootImageModule)
|
||||
func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
||||
module := variant.(*BootclasspathFragmentModule)
|
||||
|
||||
b.Image_name = module.properties.Image_name
|
||||
if b.Image_name == nil {
|
||||
|
@ -363,7 +365,7 @@ func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMember
|
|||
b.Flag_files_by_category = flagFileInfo.categoryToPaths
|
||||
}
|
||||
|
||||
func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
||||
func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
||||
if b.Image_name != nil {
|
||||
propertySet.AddProperty("image_name", *b.Image_name)
|
||||
}
|
||||
|
@ -390,28 +392,28 @@ func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberCon
|
|||
}
|
||||
}
|
||||
|
||||
var _ android.SdkMemberType = (*bootImageMemberType)(nil)
|
||||
var _ android.SdkMemberType = (*bootclasspathFragmentMemberType)(nil)
|
||||
|
||||
// A prebuilt version of the boot image module.
|
||||
// A prebuilt version of the bootclasspath_fragment module.
|
||||
//
|
||||
// At the moment this is basically just a boot image module that can be used as a prebuilt.
|
||||
// Eventually as more functionality is migrated into the boot image module from the singleton then
|
||||
// this will diverge.
|
||||
type prebuiltBootImageModule struct {
|
||||
BootImageModule
|
||||
// At the moment this is basically just a bootclasspath_fragment module that can be used as a
|
||||
// prebuilt. Eventually as more functionality is migrated into the bootclasspath_fragment module
|
||||
// type from the various singletons then this will diverge.
|
||||
type prebuiltBootclasspathFragmentModule struct {
|
||||
BootclasspathFragmentModule
|
||||
prebuilt android.Prebuilt
|
||||
}
|
||||
|
||||
func (module *prebuiltBootImageModule) Prebuilt() *android.Prebuilt {
|
||||
func (module *prebuiltBootclasspathFragmentModule) Prebuilt() *android.Prebuilt {
|
||||
return &module.prebuilt
|
||||
}
|
||||
|
||||
func (module *prebuiltBootImageModule) Name() string {
|
||||
func (module *prebuiltBootclasspathFragmentModule) Name() string {
|
||||
return module.prebuilt.Name(module.ModuleBase.Name())
|
||||
}
|
||||
|
||||
func prebuiltBootImageFactory() android.Module {
|
||||
m := &prebuiltBootImageModule{}
|
||||
func prebuiltBootclasspathFragmentFactory() android.Module {
|
||||
m := &prebuiltBootclasspathFragmentModule{}
|
||||
m.AddProperties(&m.properties)
|
||||
// This doesn't actually have any prebuilt files of its own so pass a placeholder for the srcs
|
||||
// array.
|
||||
|
@ -420,9 +422,9 @@ func prebuiltBootImageFactory() android.Module {
|
|||
android.InitSdkAwareModule(m)
|
||||
android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||
|
||||
// Perform some consistency checking to ensure that the configuration is correct.
|
||||
// Initialize the contents property from the image_name.
|
||||
android.AddLoadHook(m, func(ctx android.LoadHookContext) {
|
||||
bootImageConsistencyCheck(ctx, &m.BootImageModule)
|
||||
bootclasspathFragmentInitContentsFromImage(ctx, &m.BootclasspathFragmentModule)
|
||||
})
|
||||
return m
|
||||
}
|
|
@ -21,60 +21,60 @@ import (
|
|||
"android/soong/dexpreopt"
|
||||
)
|
||||
|
||||
// Contains some simple tests for boot_image logic, additional tests can be found in
|
||||
// apex/boot_image_test.go as the ART boot image requires modules from the ART apex.
|
||||
// Contains some simple tests for bootclasspath_fragment logic, additional tests can be found in
|
||||
// apex/bootclasspath_fragment_test.go as the ART boot image requires modules from the ART apex.
|
||||
|
||||
var prepareForTestWithBootImage = android.GroupFixturePreparers(
|
||||
var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
dexpreopt.PrepareForTestByEnablingDexpreopt,
|
||||
)
|
||||
|
||||
func TestUnknownBootImage(t *testing.T) {
|
||||
prepareForTestWithBootImage.
|
||||
func TestUnknownBootclasspathFragment(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
|
||||
RunTestWithBp(t, `
|
||||
boot_image {
|
||||
name: "unknown-boot-image",
|
||||
bootclasspath_fragment {
|
||||
name: "unknown-bootclasspath-fragment",
|
||||
image_name: "unknown",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestUnknownBootclasspathFragmentImageName(t *testing.T) {
|
||||
prepareForTestWithBootImage.
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
|
||||
RunTestWithBp(t, `
|
||||
bootclasspath_fragment {
|
||||
name: "unknown-boot-image",
|
||||
name: "unknown-bootclasspath-fragment",
|
||||
image_name: "unknown",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestUnknownPrebuiltBootImage(t *testing.T) {
|
||||
prepareForTestWithBootImage.
|
||||
func TestUnknownPrebuiltBootclasspathFragment(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
|
||||
RunTestWithBp(t, `
|
||||
prebuilt_boot_image {
|
||||
name: "unknown-boot-image",
|
||||
prebuilt_bootclasspath_fragment {
|
||||
name: "unknown-bootclasspath-fragment",
|
||||
image_name: "unknown",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestBootImageInconsistentArtConfiguration_Platform(t *testing.T) {
|
||||
func TestBootclasspathFragmentInconsistentArtConfiguration_Platform(t *testing.T) {
|
||||
android.GroupFixturePreparers(
|
||||
prepareForTestWithBootImage,
|
||||
prepareForTestWithBootclasspathFragment,
|
||||
dexpreopt.FixtureSetArtBootJars("platform:foo", "apex:bar"),
|
||||
).
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\QArtApexJars is invalid as it requests a platform variant of "foo"\E`)).
|
||||
RunTestWithBp(t, `
|
||||
boot_image {
|
||||
name: "boot-image",
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
image_name: "art",
|
||||
apex_available: [
|
||||
"apex",
|
||||
|
@ -83,16 +83,16 @@ func TestBootImageInconsistentArtConfiguration_Platform(t *testing.T) {
|
|||
`)
|
||||
}
|
||||
|
||||
func TestBootImageInconsistentArtConfiguration_ApexMixture(t *testing.T) {
|
||||
func TestBootclasspathFragmentInconsistentArtConfiguration_ApexMixture(t *testing.T) {
|
||||
android.GroupFixturePreparers(
|
||||
prepareForTestWithBootImage,
|
||||
prepareForTestWithBootclasspathFragment,
|
||||
dexpreopt.FixtureSetArtBootJars("apex1:foo", "apex2:bar"),
|
||||
).
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\QArtApexJars configuration is inconsistent, expected all jars to be in the same apex but it specifies apex "apex1" and "apex2"\E`)).
|
||||
RunTestWithBp(t, `
|
||||
boot_image {
|
||||
name: "boot-image",
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
image_name: "art",
|
||||
apex_available: [
|
||||
"apex1",
|
||||
|
@ -102,24 +102,24 @@ func TestBootImageInconsistentArtConfiguration_ApexMixture(t *testing.T) {
|
|||
`)
|
||||
}
|
||||
|
||||
func TestBootImageWithoutImageNameOrContents(t *testing.T) {
|
||||
prepareForTestWithBootImage.
|
||||
func TestBootclasspathFragmentWithoutImageNameOrContents(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qneither of the "image_name" and "contents" properties\E`)).
|
||||
RunTestWithBp(t, `
|
||||
boot_image {
|
||||
name: "boot-image",
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestBootImageWithImageNameAndContents(t *testing.T) {
|
||||
prepareForTestWithBootImage.
|
||||
func TestBootclasspathFragmentWithImageNameAndContents(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qboth of the "image_name" and "contents" properties\E`)).
|
||||
RunTestWithBp(t, `
|
||||
boot_image {
|
||||
name: "boot-image",
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
image_name: "boot",
|
||||
contents: ["other"],
|
||||
}
|
|
@ -233,7 +233,7 @@ func registerRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
|||
RegisterAppImportBuildComponents(ctx)
|
||||
RegisterAppSetBuildComponents(ctx)
|
||||
registerBootclasspathBuildComponents(ctx)
|
||||
RegisterBootImageBuildComponents(ctx)
|
||||
registerBootclasspathFragmentBuildComponents(ctx)
|
||||
RegisterDexpreoptBootJarsComponents(ctx)
|
||||
RegisterDocsBuildComponents(ctx)
|
||||
RegisterGenRuleBuildComponents(ctx)
|
||||
|
|
Loading…
Reference in a new issue