Rename UpdatableBootJars to ApexBootJars.

Note that ART apex boot jars and core-icu4j are exceptions here as they
are not part of ApexBootJars. ART apex boot jars are defined in their
own variable, while core-icu4j is treated as a regular non-updatable
boot jar.

Bug: 191127295
Test: atest CtsClasspathsTestCases
Change-Id: I3cea3d82ef521655a1a5ffa8cae2258ab9d08bfc
This commit is contained in:
satayev
2021-07-21 14:23:52 +01:00
parent ae86338676
commit d604b210c4
18 changed files with 105 additions and 112 deletions

View File

@@ -1847,16 +1847,16 @@ var earlyBootJarsKey = NewOnceKey("earlyBootJars")
func (c *config) BootJars() []string { func (c *config) BootJars() []string {
return c.Once(earlyBootJarsKey, func() interface{} { return c.Once(earlyBootJarsKey, func() interface{} {
list := c.productVariables.BootJars.CopyOfJars() list := c.productVariables.BootJars.CopyOfJars()
return append(list, c.productVariables.UpdatableBootJars.CopyOfJars()...) return append(list, c.productVariables.ApexBootJars.CopyOfJars()...)
}).([]string) }).([]string)
} }
func (c *config) NonUpdatableBootJars() ConfiguredJarList { func (c *config) NonApexBootJars() ConfiguredJarList {
return c.productVariables.BootJars return c.productVariables.BootJars
} }
func (c *config) UpdatableBootJars() ConfiguredJarList { func (c *config) ApexBootJars() ConfiguredJarList {
return c.productVariables.UpdatableBootJars return c.productVariables.ApexBootJars
} }
func (c *config) RBEWrapper() string { func (c *config) RBEWrapper() string {

View File

@@ -252,8 +252,8 @@ type productVariables struct {
UncompressPrivAppDex *bool `json:",omitempty"` UncompressPrivAppDex *bool `json:",omitempty"`
ModulesLoadedByPrivilegedModules []string `json:",omitempty"` ModulesLoadedByPrivilegedModules []string `json:",omitempty"`
BootJars ConfiguredJarList `json:",omitempty"` BootJars ConfiguredJarList `json:",omitempty"`
UpdatableBootJars ConfiguredJarList `json:",omitempty"` ApexBootJars ConfiguredJarList `json:",omitempty"`
IntegerOverflowExcludePaths []string `json:",omitempty"` IntegerOverflowExcludePaths []string `json:",omitempty"`
@@ -442,8 +442,8 @@ func (v *productVariables) SetDefaultConfig() {
Malloc_pattern_fill_contents: boolPtr(false), Malloc_pattern_fill_contents: boolPtr(false),
Safestack: boolPtr(false), Safestack: boolPtr(false),
BootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}}, BootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}},
UpdatableBootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}}, ApexBootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}},
} }
if runtime.GOOS == "linux" { if runtime.GOOS == "linux" {

View File

@@ -7194,7 +7194,7 @@ func TestDexpreoptAccessDexFilesFromPrebuiltApex(t *testing.T) {
}) })
} }
func testApexPermittedPackagesRules(t *testing.T, errmsg, bp string, apexBootJars []string, rules []android.Rule) { func testApexPermittedPackagesRules(t *testing.T, errmsg, bp string, bootJars []string, rules []android.Rule) {
t.Helper() t.Helper()
bp += ` bp += `
apex_key { apex_key {
@@ -7219,11 +7219,11 @@ func testApexPermittedPackagesRules(t *testing.T, errmsg, bp string, apexBootJar
PrepareForTestWithApexBuildComponents, PrepareForTestWithApexBuildComponents,
android.PrepareForTestWithNeverallowRules(rules), android.PrepareForTestWithNeverallowRules(rules),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
updatableBootJars := make([]string, 0, len(apexBootJars)) apexBootJars := make([]string, 0, len(bootJars))
for _, apexBootJar := range apexBootJars { for _, apexBootJar := range bootJars {
updatableBootJars = append(updatableBootJars, "myapex:"+apexBootJar) apexBootJars = append(apexBootJars, "myapex:"+apexBootJar)
} }
variables.UpdatableBootJars = android.CreateTestConfiguredJarList(updatableBootJars) variables.ApexBootJars = android.CreateTestConfiguredJarList(apexBootJars)
}), }),
fs.AddToFixture(), fs.AddToFixture(),
). ).

View File

@@ -734,7 +734,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) {
prepareForTestWithMyapex, prepareForTestWithMyapex,
// Configure bootclasspath jars to ensure that hidden API encoding is performed on them. // Configure bootclasspath jars to ensure that hidden API encoding is performed on them.
java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"), java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"),
java.FixtureConfigureUpdatableBootJars("myapex:foo", "myapex:bar"), java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"),
// Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding // Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding
// is disabled. // is disabled.
android.FixtureAddTextFile("frameworks/base/Android.bp", ""), android.FixtureAddTextFile("frameworks/base/Android.bp", ""),

View File

@@ -173,7 +173,7 @@ func TestPlatformBootclasspathDependencies(t *testing.T) {
prepareForTestWithMyapex, prepareForTestWithMyapex,
// 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"), java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz", "platform:foo"),
java.FixtureConfigureUpdatableBootJars("myapex:bar"), java.FixtureConfigureApexBootJars("myapex:bar"),
java.PrepareForTestWithJavaSdkLibraryFiles, java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("foo"), java.FixtureWithLastReleaseApis("foo"),
).RunTestWithBp(t, ` ).RunTestWithBp(t, `
@@ -288,7 +288,7 @@ func TestPlatformBootclasspathDependencies(t *testing.T) {
"com.android.art:quuz", "com.android.art:quuz",
"platform:foo", "platform:foo",
// The configured contents of UpdatableBootJars. // The configured contents of ApexBootJars.
"myapex:bar", "myapex:bar",
}) })
@@ -313,7 +313,7 @@ func TestPlatformBootclasspathDependencies(t *testing.T) {
`com.android.art:quuz`, `com.android.art:quuz`,
`platform:foo`, `platform:foo`,
// The configured contents of UpdatableBootJars. // The configured contents of ApexBootJars.
`myapex:bar`, `myapex:bar`,
// The fragments. // The fragments.
@@ -348,7 +348,7 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
// if the dependency on myapex:foo is filtered out because of either of those conditions then // if the dependency on myapex:foo is filtered out because of either of those conditions then
// the dependencies resolved by the platform_bootclasspath will not match the configured list // the dependencies resolved by the platform_bootclasspath will not match the configured list
// and so will fail the test. // and so will fail the test.
java.FixtureConfigureUpdatableBootJars("myapex:foo", "myapex:bar"), java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"),
java.PrepareForTestWithJavaSdkLibraryFiles, java.PrepareForTestWithJavaSdkLibraryFiles,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Always_use_prebuilt_sdks = proptools.BoolPtr(true) variables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
@@ -490,7 +490,7 @@ func TestPlatformBootclasspath_IncludesRemainingApexJars(t *testing.T) {
result := android.GroupFixturePreparers( result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath, prepareForTestWithPlatformBootclasspath,
prepareForTestWithMyapex, prepareForTestWithMyapex,
java.FixtureConfigureUpdatableBootJars("myapex:foo"), java.FixtureConfigureApexBootJars("myapex:foo"),
android.FixtureWithRootAndroidBp(` android.FixtureWithRootAndroidBp(`
platform_bootclasspath { platform_bootclasspath {
name: "platform-bootclasspath", name: "platform-bootclasspath",

View File

@@ -44,8 +44,8 @@ type GlobalConfig struct {
DisableGenerateProfile bool // don't generate profiles DisableGenerateProfile bool // don't generate profiles
ProfileDir string // directory to find profiles in ProfileDir string // directory to find profiles in
BootJars android.ConfiguredJarList // modules for jars that form the boot class path BootJars android.ConfiguredJarList // modules for jars that form the boot class path
UpdatableBootJars android.ConfiguredJarList // jars within apex that form the boot class path ApexBootJars android.ConfiguredJarList // jars within apex that form the boot class path
ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX
@@ -531,7 +531,7 @@ func ParseGlobalSoongConfig(ctx android.PathContext, data []byte) (*GlobalSoongC
return config, nil return config, nil
} }
// checkBootJarsConfigConsistency checks the consistency of BootJars and UpdatableBootJars fields in // checkBootJarsConfigConsistency checks the consistency of BootJars and ApexBootJars fields in
// DexpreoptGlobalConfig and Config.productVariables. // DexpreoptGlobalConfig and Config.productVariables.
func checkBootJarsConfigConsistency(ctx android.SingletonContext, dexpreoptConfig *GlobalConfig, config android.Config) { func checkBootJarsConfigConsistency(ctx android.SingletonContext, dexpreoptConfig *GlobalConfig, config android.Config) {
compareBootJars := func(property string, dexpreoptJars, variableJars android.ConfiguredJarList) { compareBootJars := func(property string, dexpreoptJars, variableJars android.ConfiguredJarList) {
@@ -545,8 +545,8 @@ func checkBootJarsConfigConsistency(ctx android.SingletonContext, dexpreoptConfi
} }
} }
compareBootJars("BootJars", dexpreoptConfig.BootJars, config.NonUpdatableBootJars()) compareBootJars("BootJars", dexpreoptConfig.BootJars, config.NonApexBootJars())
compareBootJars("UpdatableBootJars", dexpreoptConfig.UpdatableBootJars, config.UpdatableBootJars()) compareBootJars("ApexBootJars", dexpreoptConfig.ApexBootJars, config.ApexBootJars())
} }
func (s *globalSoongConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) { func (s *globalSoongConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
@@ -614,7 +614,7 @@ func GlobalConfigForTests(ctx android.PathContext) *GlobalConfig {
DisableGenerateProfile: false, DisableGenerateProfile: false,
ProfileDir: "", ProfileDir: "",
BootJars: android.EmptyConfiguredJarList(), BootJars: android.EmptyConfiguredJarList(),
UpdatableBootJars: android.EmptyConfiguredJarList(), ApexBootJars: android.EmptyConfiguredJarList(),
ArtApexJars: android.EmptyConfiguredJarList(), ArtApexJars: android.EmptyConfiguredJarList(),
SystemServerJars: android.EmptyConfiguredJarList(), SystemServerJars: android.EmptyConfiguredJarList(),
SystemServerApps: nil, SystemServerApps: nil,

View File

@@ -118,10 +118,10 @@ func FixtureSetBootJars(bootJars ...string) android.FixturePreparer {
}) })
} }
// FixtureSetUpdatableBootJars sets the UpdatableBootJars property in the global config. // FixtureSetApexBootJars sets the ApexBootJars property in the global config.
func FixtureSetUpdatableBootJars(bootJars ...string) android.FixturePreparer { func FixtureSetApexBootJars(bootJars ...string) android.FixturePreparer {
return FixtureModifyGlobalConfig(func(dexpreoptConfig *GlobalConfig) { return FixtureModifyGlobalConfig(func(dexpreoptConfig *GlobalConfig) {
dexpreoptConfig.UpdatableBootJars = android.CreateTestConfiguredJarList(bootJars) dexpreoptConfig.ApexBootJars = android.CreateTestConfiguredJarList(bootJars)
}) })
} }

View File

@@ -2471,7 +2471,7 @@ func TestDexpreoptBcp(t *testing.T) {
PrepareForTestWithJavaSdkLibraryFiles, PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("runtime-library", "foo", "bar"), FixtureWithLastReleaseApis("runtime-library", "foo", "bar"),
dexpreopt.FixtureSetBootJars("platform:foo"), dexpreopt.FixtureSetBootJars("platform:foo"),
dexpreopt.FixtureSetUpdatableBootJars("platform:bar"), dexpreopt.FixtureSetApexBootJars("platform:bar"),
dexpreopt.FixtureSetPreoptWithUpdatableBcp(test.with), dexpreopt.FixtureSetPreoptWithUpdatableBcp(test.with),
).RunTestWithBp(t, bp) ).RunTestWithBp(t, bp)

View File

@@ -537,15 +537,11 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext)
global := dexpreopt.GetGlobalConfig(ctx) global := dexpreopt.GetGlobalConfig(ctx)
possibleUpdatableModules := gatherPossibleUpdatableModuleNamesAndStems(ctx, b.properties.Contents, bootclasspathFragmentContentDepTag) possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, b.properties.Contents, bootclasspathFragmentContentDepTag)
jars := global.ApexBootJars.Filter(possibleUpdatableModules)
// Only create configs for updatable boot jars. Non-updatable boot jars must be part of the
// platform_bootclasspath's classpath proto config to guarantee that they come before any
// updatable jars at runtime.
jars := global.UpdatableBootJars.Filter(possibleUpdatableModules)
// TODO(satayev): for apex_test we want to include all contents unconditionally to classpaths // TODO(satayev): for apex_test we want to include all contents unconditionally to classpaths
// config. However, any test specific jars would not be present in UpdatableBootJars. Instead, // config. However, any test specific jars would not be present in ApexBootJars. Instead,
// we should check if we are creating a config for apex_test via ApexInfo and amend the values. // we should check if we are creating a config for apex_test via ApexInfo and amend the values.
// This is an exception to support end-to-end test for SdkExtensions, until such support exists. // This is an exception to support end-to-end test for SdkExtensions, until such support exists.
if android.InList("test_framework-sdkextensions", possibleUpdatableModules) { if android.InList("test_framework-sdkextensions", possibleUpdatableModules) {

View File

@@ -91,8 +91,8 @@ type classpathJar struct {
maxSdkVersion int32 maxSdkVersion int32
} }
// gatherPossibleUpdatableModuleNamesAndStems returns a set of module and stem names from the // gatherPossibleApexModuleNamesAndStems returns a set of module and stem names from the
// supplied contents that may be in the updatable boot jars. // supplied contents that may be in the apex boot jars.
// //
// The module names are included because sometimes the stem is set to just change the name of // The module names are included because sometimes the stem is set to just change the name of
// the installed file and it expects the configuration to still use the actual module name. // the installed file and it expects the configuration to still use the actual module name.
@@ -100,7 +100,7 @@ type classpathJar struct {
// The stem names are included because sometimes the stem is set to change the effective name of the // The stem names are included because sometimes the stem is set to change the effective name of the
// module that is used in the configuration as well,e .g. when a test library is overriding an // module that is used in the configuration as well,e .g. when a test library is overriding an
// actual boot jar // actual boot jar
func gatherPossibleUpdatableModuleNamesAndStems(ctx android.ModuleContext, contents []string, tag blueprint.DependencyTag) []string { func gatherPossibleApexModuleNamesAndStems(ctx android.ModuleContext, contents []string, tag blueprint.DependencyTag) []string {
set := map[string]struct{}{} set := map[string]struct{}{}
for _, name := range contents { for _, name := range contents {
dep := ctx.GetDirectDepWithTag(name, tag) dep := ctx.GetDirectDepWithTag(name, tag)

View File

@@ -167,10 +167,10 @@ import (
// regardless which APEX goes into the product. See also android.ApexInfo.ApexVariationName and // regardless which APEX goes into the product. See also android.ApexInfo.ApexVariationName and
// apex.apexBundleProperties.Apex_name. // apex.apexBundleProperties.Apex_name.
// //
// A related variable PRODUCT_UPDATABLE_BOOT_JARS contains bootclasspath libraries that are in // A related variable PRODUCT_APEX_BOOT_JARS contains bootclasspath libraries that are in APEXes.
// APEXes. They are not included in the boot image. The only exception here is core-icu4j.jar that // They are not included in the boot image. The only exception here are ART jars and core-icu4j.jar
// has been historically part of the boot image and is now in a non updatable apex; it is treated // that have been historically part of the boot image and are now in apexes; they are in boot images
// as being part of PRODUCT_BOOT_JARS and is in the boot image. // and core-icu4j.jar is generally treated as being part of PRODUCT_BOOT_JARS.
// //
// One exception to the above rules are "coverage" builds (a special build flavor which requires // One exception to the above rules are "coverage" builds (a special build flavor which requires
// setting environment variable EMMA_INSTRUMENT_FRAMEWORK=true). In coverage builds the Java code in // setting environment variable EMMA_INSTRUMENT_FRAMEWORK=true). In coverage builds the Java code in
@@ -810,10 +810,10 @@ func bootFrameworkProfileRule(ctx android.ModuleContext, image *bootImageConfig)
// generateUpdatableBcpPackagesRule generates the rule to create the updatable-bcp-packages.txt file // generateUpdatableBcpPackagesRule generates the rule to create the updatable-bcp-packages.txt file
// and returns a path to the generated file. // and returns a path to the generated file.
func generateUpdatableBcpPackagesRule(ctx android.ModuleContext, image *bootImageConfig, updatableModules []android.Module) android.WritablePath { func generateUpdatableBcpPackagesRule(ctx android.ModuleContext, image *bootImageConfig, apexModules []android.Module) android.WritablePath {
// Collect `permitted_packages` for updatable boot jars. // Collect `permitted_packages` for updatable boot jars.
var updatablePackages []string var updatablePackages []string
for _, module := range updatableModules { for _, module := range apexModules {
if j, ok := module.(PermittedPackagesForUpdatableBootJars); ok { if j, ok := module.(PermittedPackagesForUpdatableBootJars); ok {
pp := j.PermittedPackagesForUpdatableBootJars() pp := j.PermittedPackagesForUpdatableBootJars()
if len(pp) > 0 { if len(pp) > 0 {

View File

@@ -142,14 +142,14 @@ func defaultBootImageConfig(ctx android.PathContext) *bootImageConfig {
return genBootImageConfigs(ctx)[frameworkBootImageName] return genBootImageConfigs(ctx)[frameworkBootImageName]
} }
// Updatable boot config allows to access build/install paths of updatable boot jars without going // Apex boot config allows to access build/install paths of apex boot jars without going
// through the usual trouble of registering dependencies on those modules and extracting build paths // through the usual trouble of registering dependencies on those modules and extracting build paths
// from those dependencies. // from those dependencies.
type updatableBootConfig struct { type apexBootConfig struct {
// A list of updatable boot jars. // A list of apex boot jars.
modules android.ConfiguredJarList modules android.ConfiguredJarList
// A list of predefined build paths to updatable boot jars. They are configured very early, // A list of predefined build paths to apex boot jars. They are configured very early,
// before the modules for these jars are processed and the actual paths are generated, and // before the modules for these jars are processed and the actual paths are generated, and
// later on a singleton adds commands to copy actual jars to the predefined paths. // later on a singleton adds commands to copy actual jars to the predefined paths.
dexPaths android.WritablePaths dexPaths android.WritablePaths
@@ -161,21 +161,21 @@ type updatableBootConfig struct {
dexLocations []string dexLocations []string
} }
var updatableBootConfigKey = android.NewOnceKey("updatableBootConfig") var updatableBootConfigKey = android.NewOnceKey("apexBootConfig")
// Returns updatable boot config. // Returns apex boot config.
func GetUpdatableBootConfig(ctx android.PathContext) updatableBootConfig { func GetApexBootConfig(ctx android.PathContext) apexBootConfig {
return ctx.Config().Once(updatableBootConfigKey, func() interface{} { return ctx.Config().Once(updatableBootConfigKey, func() interface{} {
updatableBootJars := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars apexBootJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
dir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "updatable_bootjars") dir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "apex_bootjars")
dexPaths := updatableBootJars.BuildPaths(ctx, dir) dexPaths := apexBootJars.BuildPaths(ctx, dir)
dexPathsByModuleName := updatableBootJars.BuildPathsByModule(ctx, dir) dexPathsByModuleName := apexBootJars.BuildPathsByModule(ctx, dir)
dexLocations := updatableBootJars.DevicePaths(ctx.Config(), android.Android) dexLocations := apexBootJars.DevicePaths(ctx.Config(), android.Android)
return updatableBootConfig{updatableBootJars, dexPaths, dexPathsByModuleName, dexLocations} return apexBootConfig{apexBootJars, dexPaths, dexPathsByModuleName, dexLocations}
}).(updatableBootConfig) }).(apexBootConfig)
} }
// Returns a list of paths and a list of locations for the boot jars used in dexpreopt (to be // Returns a list of paths and a list of locations for the boot jars used in dexpreopt (to be
@@ -188,10 +188,10 @@ func bcpForDexpreopt(ctx android.PathContext, withUpdatable bool) (android.Writa
dexLocations := bootImage.getAnyAndroidVariant().dexLocationsDeps dexLocations := bootImage.getAnyAndroidVariant().dexLocationsDeps
if withUpdatable { if withUpdatable {
// Updatable boot jars (they are used only in dexpreopt, but not in the boot image). // Apex boot jars (they are used only in dexpreopt, but not in the boot image).
updBootConfig := GetUpdatableBootConfig(ctx) apexBootConfig := GetApexBootConfig(ctx)
dexPaths = append(dexPaths, updBootConfig.dexPaths...) dexPaths = append(dexPaths, apexBootConfig.dexPaths...)
dexLocations = append(dexLocations, updBootConfig.dexLocations...) dexLocations = append(dexLocations, apexBootConfig.dexLocations...)
} }
return dexPaths, dexLocations return dexPaths, dexLocations

View File

@@ -118,11 +118,11 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar, classesJar
} }
func isModuleInBootClassPath(ctx android.BaseModuleContext, module android.Module) bool { func isModuleInBootClassPath(ctx android.BaseModuleContext, module android.Module) bool {
// Get the configured non-updatable and updatable boot jars. // Get the configured platform and apex boot jars.
nonUpdatableBootJars := ctx.Config().NonUpdatableBootJars() nonApexBootJars := ctx.Config().NonApexBootJars()
updatableBootJars := ctx.Config().UpdatableBootJars() apexBootJars := ctx.Config().ApexBootJars()
active := isModuleInConfiguredList(ctx, module, nonUpdatableBootJars) || active := isModuleInConfiguredList(ctx, module, nonApexBootJars) ||
isModuleInConfiguredList(ctx, module, updatableBootJars) isModuleInConfiguredList(ctx, module, apexBootJars)
return active return active
} }

View File

@@ -457,7 +457,7 @@ type Library struct {
var _ android.ApexModule = (*Library)(nil) var _ android.ApexModule = (*Library)(nil)
// Provides access to the list of permitted packages from updatable boot jars. // Provides access to the list of permitted packages from apex boot jars.
type PermittedPackagesForUpdatableBootJars interface { type PermittedPackagesForUpdatableBootJars interface {
PermittedPackagesForUpdatableBootJars() []string PermittedPackagesForUpdatableBootJars() []string
} }

View File

@@ -32,9 +32,9 @@ func registerPlatformBootclasspathBuildComponents(ctx android.RegistrationContex
// The tags used for the dependencies between the platform bootclasspath and any configured boot // The tags used for the dependencies between the platform bootclasspath and any configured boot
// jars. // jars.
var ( var (
platformBootclasspathArtBootJarDepTag = bootclasspathDependencyTag{name: "art-boot-jar"} platformBootclasspathArtBootJarDepTag = bootclasspathDependencyTag{name: "art-boot-jar"}
platformBootclasspathNonUpdatableBootJarDepTag = bootclasspathDependencyTag{name: "non-updatable-boot-jar"} platformBootclasspathBootJarDepTag = bootclasspathDependencyTag{name: "platform-boot-jar"}
platformBootclasspathUpdatableBootJarDepTag = bootclasspathDependencyTag{name: "updatable-boot-jar"} platformBootclasspathApexBootJarDepTag = bootclasspathDependencyTag{name: "apex-boot-jar"}
) )
type platformBootclasspathModule struct { type platformBootclasspathModule struct {
@@ -131,11 +131,11 @@ func (b *platformBootclasspathModule) BootclasspathDepsMutator(ctx android.Botto
// Add dependencies on all the non-updatable module configured in the "boot" boot image. That does // Add dependencies on all the non-updatable module configured in the "boot" boot image. That does
// not include modules configured in the "art" boot image. // not include modules configured in the "art" boot image.
bootImageConfig := b.getImageConfig(ctx) bootImageConfig := b.getImageConfig(ctx)
addDependenciesOntoBootImageModules(ctx, bootImageConfig.modules, platformBootclasspathNonUpdatableBootJarDepTag) addDependenciesOntoBootImageModules(ctx, bootImageConfig.modules, platformBootclasspathBootJarDepTag)
// Add dependencies on all the updatable modules. // Add dependencies on all the apex jars.
updatableModules := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars apexJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
addDependenciesOntoBootImageModules(ctx, updatableModules, platformBootclasspathUpdatableBootJarDepTag) addDependenciesOntoBootImageModules(ctx, apexJars, platformBootclasspathApexBootJarDepTag)
// Add dependencies on all the fragments. // Add dependencies on all the fragments.
b.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx) b.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx)
@@ -163,16 +163,16 @@ func (d *platformBootclasspathModule) MakeVars(ctx android.MakeVarsContext) {
} }
func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Gather all the dependencies from the art, updatable and non-updatable boot jars. // Gather all the dependencies from the art, platform, and apex boot jars.
artModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathArtBootJarDepTag) artModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathArtBootJarDepTag)
nonUpdatableModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathNonUpdatableBootJarDepTag) platformModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathBootJarDepTag)
updatableModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathUpdatableBootJarDepTag) apexModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathApexBootJarDepTag)
// Concatenate them all, in order as they would appear on the bootclasspath. // Concatenate them all, in order as they would appear on the bootclasspath.
var allModules []android.Module var allModules []android.Module
allModules = append(allModules, artModules...) allModules = append(allModules, artModules...)
allModules = append(allModules, nonUpdatableModules...) allModules = append(allModules, platformModules...)
allModules = append(allModules, updatableModules...) allModules = append(allModules, apexModules...)
b.configuredModules = allModules b.configuredModules = allModules
// Gather all the fragments dependencies. // Gather all the fragments dependencies.
@@ -180,8 +180,8 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
// Check the configuration of the boot modules. // Check the configuration of the boot modules.
// ART modules are checked by the art-bootclasspath-fragment. // ART modules are checked by the art-bootclasspath-fragment.
b.checkNonUpdatableModules(ctx, nonUpdatableModules) b.checkPlatformModules(ctx, platformModules)
b.checkUpdatableModules(ctx, updatableModules) b.checkApexModules(ctx, apexModules)
b.generateClasspathProtoBuildActions(ctx) b.generateClasspathProtoBuildActions(ctx)
@@ -193,7 +193,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
return return
} }
b.generateBootImageBuildActions(ctx, nonUpdatableModules, updatableModules) b.generateBootImageBuildActions(ctx, platformModules, apexModules)
} }
// Generate classpaths.proto config // Generate classpaths.proto config
@@ -209,7 +209,7 @@ func (b *platformBootclasspathModule) configuredJars(ctx android.ModuleContext)
jars := b.getImageConfig(ctx).modules jars := b.getImageConfig(ctx).modules
// Include jars from APEXes that don't populate their classpath proto config. // Include jars from APEXes that don't populate their classpath proto config.
remainingJars := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars remainingJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
for _, fragment := range b.fragments { for _, fragment := range b.fragments {
info := ctx.OtherModuleProvider(fragment, ClasspathFragmentProtoContentInfoProvider).(ClasspathFragmentProtoContentInfo) info := ctx.OtherModuleProvider(fragment, ClasspathFragmentProtoContentInfoProvider).(ClasspathFragmentProtoContentInfo)
if info.ClasspathFragmentProtoGenerated { if info.ClasspathFragmentProtoGenerated {
@@ -223,9 +223,10 @@ func (b *platformBootclasspathModule) configuredJars(ctx android.ModuleContext)
return jars return jars
} }
// checkNonUpdatableModules ensures that the non-updatable modules supplied are not part of an // checkPlatformModules ensures that the non-updatable modules supplied are not part of an
// updatable module. // apex module.
func (b *platformBootclasspathModule) checkNonUpdatableModules(ctx android.ModuleContext, modules []android.Module) { func (b *platformBootclasspathModule) checkPlatformModules(ctx android.ModuleContext, modules []android.Module) {
// TODO(satayev): change this check to only allow core-icu4j, all apex jars should not be here.
for _, m := range modules { for _, m := range modules {
apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo) apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
fromUpdatableApex := apexInfo.Updatable fromUpdatableApex := apexInfo.Updatable
@@ -238,8 +239,8 @@ func (b *platformBootclasspathModule) checkNonUpdatableModules(ctx android.Modul
} }
} }
// checkUpdatableModules ensures that the updatable modules supplied are not from the platform. // checkApexModules ensures that the apex modules supplied are not from the platform.
func (b *platformBootclasspathModule) checkUpdatableModules(ctx android.ModuleContext, modules []android.Module) { func (b *platformBootclasspathModule) checkApexModules(ctx android.ModuleContext, modules []android.Module) {
for _, m := range modules { for _, m := range modules {
apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo) apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
fromUpdatableApex := apexInfo.Updatable fromUpdatableApex := apexInfo.Updatable
@@ -255,12 +256,12 @@ func (b *platformBootclasspathModule) checkUpdatableModules(ctx android.ModuleCo
// modules is complete. // modules is complete.
if !ctx.Config().AlwaysUsePrebuiltSdks() { if !ctx.Config().AlwaysUsePrebuiltSdks() {
// error: this jar is part of the platform // error: this jar is part of the platform
ctx.ModuleErrorf("module %q from platform is not allowed in the updatable boot jars list", name) ctx.ModuleErrorf("module %q from platform is not allowed in the apex boot jars list", name)
} }
} else { } else {
// TODO(b/177892522): Treat this as an error. // TODO(b/177892522): Treat this as an error.
// Cannot do that at the moment because framework-wifi and framework-tethering are in the // Cannot do that at the moment because framework-wifi and framework-tethering are in the
// PRODUCT_UPDATABLE_BOOT_JARS but not marked as updatable in AOSP. // PRODUCT_APEX_BOOT_JARS but not marked as updatable in AOSP.
} }
} }
} }
@@ -405,7 +406,7 @@ func (b *platformBootclasspathModule) generateHiddenApiMakeVars(ctx android.Make
} }
// generateBootImageBuildActions generates ninja rules related to the boot image creation. // generateBootImageBuildActions generates ninja rules related to the boot image creation.
func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.ModuleContext, nonUpdatableModules, updatableModules []android.Module) { func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.ModuleContext, platformModules, apexModules []android.Module) {
// Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
// GenerateSingletonBuildActions method as it cannot create it for itself. // GenerateSingletonBuildActions method as it cannot create it for itself.
dexpreopt.GetGlobalSoongConfig(ctx) dexpreopt.GetGlobalSoongConfig(ctx)
@@ -428,17 +429,17 @@ func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.
// TODO(b/193889859): Remove when the prebuilts have been updated. // TODO(b/193889859): Remove when the prebuilts have been updated.
if !ctx.Config().AlwaysUsePrebuiltSdks() { if !ctx.Config().AlwaysUsePrebuiltSdks() {
// Generate the updatable bootclasspath packages rule. // Generate the updatable bootclasspath packages rule.
generateUpdatableBcpPackagesRule(ctx, imageConfig, updatableModules) generateUpdatableBcpPackagesRule(ctx, imageConfig, apexModules)
} }
// Copy non-updatable module dex jars to their predefined locations. // Copy platform module dex jars to their predefined locations.
nonUpdatableBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, nonUpdatableModules) platformBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, platformModules)
copyBootJarsToPredefinedLocations(ctx, nonUpdatableBootDexJarsByModule, imageConfig.dexPathsByModule) copyBootJarsToPredefinedLocations(ctx, platformBootDexJarsByModule, imageConfig.dexPathsByModule)
// Copy updatable module dex jars to their predefined locations. // Copy apex module dex jars to their predefined locations.
config := GetUpdatableBootConfig(ctx) config := GetApexBootConfig(ctx)
updatableBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, updatableModules) apexBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, apexModules)
copyBootJarsToPredefinedLocations(ctx, updatableBootDexJarsByModule, config.dexPathsByModule) copyBootJarsToPredefinedLocations(ctx, apexBootDexJarsByModule, config.dexPathsByModule)
// Build a profile for the image config and then use that to build the boot image. // Build a profile for the image config and then use that to build the boot image.
profile := bootImageProfileRule(ctx, imageConfig) profile := bootImageProfileRule(ctx, imageConfig)

View File

@@ -106,11 +106,7 @@ func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.Mo
func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList { func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList {
global := dexpreopt.GetGlobalConfig(ctx) global := dexpreopt.GetGlobalConfig(ctx)
possibleUpdatableModules := gatherPossibleUpdatableModuleNamesAndStems(ctx, s.properties.Contents, systemServerClasspathFragmentContentDepTag) possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Contents, systemServerClasspathFragmentContentDepTag)
// Only create configs for updatable boot jars. Non-updatable system server jars must be part of the
// platform_systemserverclasspath's classpath proto config to guarantee that they come before any
// updatable jars at runtime.
return global.UpdatableSystemServerJars.Filter(possibleUpdatableModules) return global.UpdatableSystemServerJars.Filter(possibleUpdatableModules)
} }

View File

@@ -214,15 +214,15 @@ func FixtureConfigureBootJars(bootJars ...string) android.FixturePreparer {
) )
} }
// FixtureConfigureUpdatableBootJars configures the updatable boot jars in both the // FixtureConfigureApexBootJars configures the apex boot jars in both the
// dexpreopt.GlobalConfig and Config.productVariables structs. As a side effect that enables // dexpreopt.GlobalConfig and Config.productVariables structs. As a side effect that enables
// dexpreopt. // dexpreopt.
func FixtureConfigureUpdatableBootJars(bootJars ...string) android.FixturePreparer { func FixtureConfigureApexBootJars(bootJars ...string) android.FixturePreparer {
return android.GroupFixturePreparers( return android.GroupFixturePreparers(
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.UpdatableBootJars = android.CreateTestConfiguredJarList(bootJars) variables.ApexBootJars = android.CreateTestConfiguredJarList(bootJars)
}), }),
dexpreopt.FixtureSetUpdatableBootJars(bootJars...), dexpreopt.FixtureSetApexBootJars(bootJars...),
// Add a fake dex2oatd module. // Add a fake dex2oatd module.
dexpreopt.PrepareForTestWithFakeDex2oatd, dexpreopt.PrepareForTestWithFakeDex2oatd,

View File

@@ -224,7 +224,7 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
java.PrepareForTestWithJavaDefaultModules, java.PrepareForTestWithJavaDefaultModules,
java.PrepareForTestWithJavaSdkLibraryFiles, java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"), java.FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"),
java.FixtureConfigureUpdatableBootJars("myapex:mybootlib", "myapex:myothersdklibrary"), java.FixtureConfigureApexBootJars("myapex:mybootlib", "myapex:myothersdklibrary"),
prepareForSdkTestWithApex, prepareForSdkTestWithApex,
// Add a platform_bootclasspath that depends on the fragment. // Add a platform_bootclasspath that depends on the fragment.
@@ -728,7 +728,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
java.PrepareForTestWithJavaDefaultModules, java.PrepareForTestWithJavaDefaultModules,
java.PrepareForTestWithJavaSdkLibraryFiles, java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("mysdklibrary"), java.FixtureWithLastReleaseApis("mysdklibrary"),
java.FixtureConfigureUpdatableBootJars("myapex:mybootlib"), java.FixtureConfigureApexBootJars("myapex:mybootlib"),
prepareForSdkTestWithApex, prepareForSdkTestWithApex,
// Add a platform_bootclasspath that depends on the fragment. // Add a platform_bootclasspath that depends on the fragment.