Merge changes I9c94a54a,Idc0c73a7
* changes: Preopt system server jars with updatable bootclasspath. Preopt APEX system server jars from prebuilts.
This commit is contained in:
@@ -73,7 +73,7 @@ type DeapexerInfo struct {
|
|||||||
// exported file name is the apex relative path, e.g. javalib/core-libart.jar.
|
// exported file name is the apex relative path, e.g. javalib/core-libart.jar.
|
||||||
//
|
//
|
||||||
// See Prebuilt.ApexInfoMutator for more information.
|
// See Prebuilt.ApexInfoMutator for more information.
|
||||||
exports map[string]Path
|
exports map[string]WritablePath
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrebuiltExportPath provides the path, or nil if not available, of a file exported from the
|
// PrebuiltExportPath provides the path, or nil if not available, of a file exported from the
|
||||||
@@ -82,7 +82,7 @@ type DeapexerInfo struct {
|
|||||||
// The exported file is identified by the apex relative path, e.g. "javalib/core-libart.jar".
|
// The exported file is identified by the apex relative path, e.g. "javalib/core-libart.jar".
|
||||||
//
|
//
|
||||||
// See apex/deapexer.go for more information.
|
// See apex/deapexer.go for more information.
|
||||||
func (i DeapexerInfo) PrebuiltExportPath(apexRelativePath string) Path {
|
func (i DeapexerInfo) PrebuiltExportPath(apexRelativePath string) WritablePath {
|
||||||
path := i.exports[apexRelativePath]
|
path := i.exports[apexRelativePath]
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ var DeapexerProvider = blueprint.NewProvider(DeapexerInfo{})
|
|||||||
// for use with a prebuilt_apex module.
|
// for use with a prebuilt_apex module.
|
||||||
//
|
//
|
||||||
// See apex/deapexer.go for more information.
|
// See apex/deapexer.go for more information.
|
||||||
func NewDeapexerInfo(exports map[string]Path) DeapexerInfo {
|
func NewDeapexerInfo(exports map[string]WritablePath) DeapexerInfo {
|
||||||
return DeapexerInfo{
|
return DeapexerInfo{
|
||||||
exports: exports,
|
exports: exports,
|
||||||
}
|
}
|
||||||
|
@@ -97,7 +97,7 @@ func (p *Deapexer) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// Create and remember the directory into which the .apex file's contents will be unpacked.
|
// Create and remember the directory into which the .apex file's contents will be unpacked.
|
||||||
deapexerOutput := android.PathForModuleOut(ctx, "deapexer")
|
deapexerOutput := android.PathForModuleOut(ctx, "deapexer")
|
||||||
|
|
||||||
exports := make(map[string]android.Path)
|
exports := make(map[string]android.WritablePath)
|
||||||
|
|
||||||
// Create mappings from apex relative path to the extracted file's path.
|
// Create mappings from apex relative path to the extracted file's path.
|
||||||
exportedPaths := make(android.Paths, 0, len(exports))
|
exportedPaths := make(android.Paths, 0, len(exports))
|
||||||
|
@@ -178,13 +178,19 @@ func (p *prebuiltCommon) initApexFilesForAndroidMk(ctx android.ModuleContext) {
|
|||||||
// If the exported java module provides a dex jar path then add it to the list of apexFiles.
|
// If the exported java module provides a dex jar path then add it to the list of apexFiles.
|
||||||
path := child.(interface{ DexJarBuildPath() android.Path }).DexJarBuildPath()
|
path := child.(interface{ DexJarBuildPath() android.Path }).DexJarBuildPath()
|
||||||
if path != nil {
|
if path != nil {
|
||||||
p.apexFilesForAndroidMk = append(p.apexFilesForAndroidMk, apexFile{
|
af := apexFile{
|
||||||
module: child,
|
module: child,
|
||||||
moduleDir: ctx.OtherModuleDir(child),
|
moduleDir: ctx.OtherModuleDir(child),
|
||||||
androidMkModuleName: name,
|
androidMkModuleName: name,
|
||||||
builtFile: path,
|
builtFile: path,
|
||||||
class: javaSharedLib,
|
class: javaSharedLib,
|
||||||
})
|
}
|
||||||
|
if module, ok := child.(java.DexpreopterInterface); ok {
|
||||||
|
for _, install := range module.DexpreoptBuiltInstalledForApex() {
|
||||||
|
af.requiredModuleNames = append(af.requiredModuleNames, install.FullModuleName())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.apexFilesForAndroidMk = append(p.apexFilesForAndroidMk, af)
|
||||||
}
|
}
|
||||||
} else if tag == exportedBootclasspathFragmentTag {
|
} else if tag == exportedBootclasspathFragmentTag {
|
||||||
// Visit the children of the bootclasspath_fragment.
|
// Visit the children of the bootclasspath_fragment.
|
||||||
@@ -195,6 +201,14 @@ func (p *prebuiltCommon) initApexFilesForAndroidMk(ctx android.ModuleContext) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *prebuiltCommon) addRequiredModules(entries *android.AndroidMkEntries) {
|
||||||
|
for _, fi := range p.apexFilesForAndroidMk {
|
||||||
|
entries.AddStrings("LOCAL_REQUIRED_MODULES", fi.requiredModuleNames...)
|
||||||
|
entries.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", fi.targetRequiredModuleNames...)
|
||||||
|
entries.AddStrings("LOCAL_HOST_REQUIRED_MODULES", fi.hostRequiredModuleNames...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries {
|
func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
entriesList := []android.AndroidMkEntries{
|
entriesList := []android.AndroidMkEntries{
|
||||||
{
|
{
|
||||||
@@ -213,6 +227,7 @@ func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
if len(postInstallCommands) > 0 {
|
if len(postInstallCommands) > 0 {
|
||||||
entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(postInstallCommands, " && "))
|
entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(postInstallCommands, " && "))
|
||||||
}
|
}
|
||||||
|
p.addRequiredModules(entries)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -160,6 +160,10 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !android.IsModulePreferred(ctx.Module()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: contains no java code
|
// TODO: contains no java code
|
||||||
|
|
||||||
return false
|
return false
|
||||||
@@ -232,8 +236,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
|||||||
bootImage = artBootImageConfig(ctx)
|
bootImage = artBootImageConfig(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// System server jars are an exception: they are dexpreopted without updatable bootclasspath.
|
dexFiles, dexLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp)
|
||||||
dexFiles, dexLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp && !isSystemServerJar)
|
|
||||||
|
|
||||||
targets := ctx.MultiTargets()
|
targets := ctx.MultiTargets()
|
||||||
if len(targets) == 0 {
|
if len(targets) == 0 {
|
||||||
|
@@ -1907,6 +1907,7 @@ type SdkLibraryImport struct {
|
|||||||
android.SdkBase
|
android.SdkBase
|
||||||
|
|
||||||
hiddenAPI
|
hiddenAPI
|
||||||
|
dexpreopter
|
||||||
|
|
||||||
properties sdkLibraryImportProperties
|
properties sdkLibraryImportProperties
|
||||||
|
|
||||||
@@ -2111,6 +2112,14 @@ func (module *SdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (module *SdkLibraryImport) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
|
// For an SDK library imported from a prebuilt APEX, we don't need a Make module for itself, as we
|
||||||
|
// don't need to install it. However, we need to add its dexpreopt outputs as sub-modules, if it
|
||||||
|
// is preopted.
|
||||||
|
dexpreoptEntries := module.dexpreopter.AndroidMkEntriesForApex()
|
||||||
|
return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
|
||||||
|
}
|
||||||
|
|
||||||
var _ android.ApexModule = (*SdkLibraryImport)(nil)
|
var _ android.ApexModule = (*SdkLibraryImport)(nil)
|
||||||
|
|
||||||
// Implements android.ApexModule
|
// Implements android.ApexModule
|
||||||
@@ -2208,8 +2217,16 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
|
|||||||
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
|
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
|
||||||
if dexOutputPath := di.PrebuiltExportPath(apexRootRelativePathToJavaLib(module.BaseModuleName())); dexOutputPath != nil {
|
if dexOutputPath := di.PrebuiltExportPath(apexRootRelativePathToJavaLib(module.BaseModuleName())); dexOutputPath != nil {
|
||||||
module.dexJarFile = dexOutputPath
|
module.dexJarFile = dexOutputPath
|
||||||
module.installFile = android.PathForModuleInPartitionInstall(ctx, "apex", ai.ApexVariationName, apexRootRelativePathToJavaLib(module.BaseModuleName()))
|
installPath := android.PathForModuleInPartitionInstall(
|
||||||
|
ctx, "apex", ai.ApexVariationName, apexRootRelativePathToJavaLib(module.BaseModuleName()))
|
||||||
|
module.installFile = installPath
|
||||||
module.initHiddenAPI(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0], nil)
|
module.initHiddenAPI(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0], nil)
|
||||||
|
|
||||||
|
// Dexpreopting.
|
||||||
|
module.dexpreopter.installPath = module.dexpreopter.getInstallPath(ctx, installPath)
|
||||||
|
module.dexpreopter.isSDKLibrary = true
|
||||||
|
module.dexpreopter.uncompressedDex = shouldUncompressDex(ctx, &module.dexpreopter)
|
||||||
|
module.dexpreopt(ctx, dexOutputPath)
|
||||||
} else {
|
} else {
|
||||||
// This should never happen as a variant for a prebuilt_apex is only created if the
|
// This should never happen as a variant for a prebuilt_apex is only created if the
|
||||||
// prebuilt_apex has been configured to export the java library dex file.
|
// prebuilt_apex has been configured to export the java library dex file.
|
||||||
@@ -2328,6 +2345,11 @@ func (module *SdkLibraryImport) ImplementationAndResourcesJars() android.Paths {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to satisfy java.DexpreopterInterface interface
|
||||||
|
func (module *SdkLibraryImport) IsInstallable() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
var _ android.RequiredFilesFromPrebuiltApex = (*SdkLibraryImport)(nil)
|
var _ android.RequiredFilesFromPrebuiltApex = (*SdkLibraryImport)(nil)
|
||||||
|
|
||||||
func (module *SdkLibraryImport) RequiredFilesFromPrebuiltApex(ctx android.BaseModuleContext) []string {
|
func (module *SdkLibraryImport) RequiredFilesFromPrebuiltApex(ctx android.BaseModuleContext) []string {
|
||||||
|
@@ -598,6 +598,7 @@ func TestJavaSdkLibraryImport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
||||||
|
`dex2oatd`,
|
||||||
`prebuilt_sdklib.stubs`,
|
`prebuilt_sdklib.stubs`,
|
||||||
`prebuilt_sdklib.stubs.source.test`,
|
`prebuilt_sdklib.stubs.source.test`,
|
||||||
`prebuilt_sdklib.stubs.system`,
|
`prebuilt_sdklib.stubs.system`,
|
||||||
@@ -674,7 +675,6 @@ func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
||||||
`dex2oatd`,
|
|
||||||
`prebuilt_sdklib`,
|
`prebuilt_sdklib`,
|
||||||
`sdklib.impl`,
|
`sdklib.impl`,
|
||||||
`sdklib.stubs`,
|
`sdklib.stubs`,
|
||||||
@@ -683,6 +683,7 @@ func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
CheckModuleDependencies(t, result.TestContext, "prebuilt_sdklib", "android_common", []string{
|
CheckModuleDependencies(t, result.TestContext, "prebuilt_sdklib", "android_common", []string{
|
||||||
|
`dex2oatd`,
|
||||||
`prebuilt_sdklib.stubs`,
|
`prebuilt_sdklib.stubs`,
|
||||||
`sdklib.impl`,
|
`sdklib.impl`,
|
||||||
`sdklib.xml`,
|
`sdklib.xml`,
|
||||||
|
Reference in New Issue
Block a user