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
diff --git a/java/Android.bp b/java/Android.bp
index e367a00..a17140c 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -29,9 +29,9 @@
"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 @@
"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",
diff --git a/java/boot_image.go b/java/bootclasspath_fragment.go
similarity index 74%
rename from java/boot_image.go
rename to java/bootclasspath_fragment.go
index 6f50c27..fa9bd56 100644
--- a/java/boot_image.go
+++ b/java/bootclasspath_fragment.go
@@ -27,17 +27,17 @@
)
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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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) DepsMutator(ctx android.BottomUpMutatorContext) {
+func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorContext) {
if SkipDexpreoptBootJars(ctx) {
return
@@ -255,7 +257,7 @@
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 @@
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 @@
}
// 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 @@
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) 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 @@
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 @@
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 @@
}
}
-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 @@
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
}
diff --git a/java/boot_image_test.go b/java/bootclasspath_fragment_test.go
similarity index 65%
rename from java/boot_image_test.go
rename to java/bootclasspath_fragment_test.go
index e1866de..524a226 100644
--- a/java/boot_image_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -21,60 +21,60 @@
"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_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 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"],
}
diff --git a/java/testing.go b/java/testing.go
index e9cdddc..649d27b 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -233,7 +233,7 @@
RegisterAppImportBuildComponents(ctx)
RegisterAppSetBuildComponents(ctx)
registerBootclasspathBuildComponents(ctx)
- RegisterBootImageBuildComponents(ctx)
+ registerBootclasspathFragmentBuildComponents(ctx)
RegisterDexpreoptBootJarsComponents(ctx)
RegisterDocsBuildComponents(ctx)
RegisterGenRuleBuildComponents(ctx)