Merge "Propagate profile_guided requirement of imports to top-level apex" into main am: f3c63e6743 am: e0d8cb2569

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2929189

Change-Id: I995aeca38f5691d58330e2bb99d202946a3e7540
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Spandan Das
2024-01-31 02:59:47 +00:00
committed by Automerger Merge Worker
9 changed files with 69 additions and 10 deletions

View File

@@ -1105,6 +1105,10 @@ func (module *PrebuiltBootclasspathFragmentModule) RequiredFilesFromPrebuiltApex
return nil
}
func (module *PrebuiltBootclasspathFragmentModule) UseProfileGuidedDexpreopt() bool {
return false
}
var _ android.RequiredFilesFromPrebuiltApex = (*PrebuiltBootclasspathFragmentModule)(nil)
func prebuiltBootclasspathFragmentFactory() android.Module {

View File

@@ -282,6 +282,17 @@ func (d *Dexpreopter) DexpreoptPrebuiltApexSystemServerJars(ctx android.ModuleCo
d.installPath = android.PathForModuleInPartitionInstall(ctx, "", strings.TrimPrefix(dexpreopt.GetSystemServerDexLocation(ctx, dc, libraryName), "/"))
// generate the rules for creating the .odex and .vdex files for this system server jar
dexJarFile := di.PrebuiltExportPath(ApexRootRelativePathToJavaLib(libraryName))
d.inputProfilePathOnHost = nil // reset: TODO(spandandas): Make dexpreopter stateless
if android.InList(libraryName, di.GetDexpreoptProfileGuidedExportedModuleNames()) {
// Set the profile path to guide optimization
prof := di.PrebuiltExportPath(ApexRootRelativePathToJavaLib(libraryName) + ".prof")
if prof == nil {
ctx.ModuleErrorf("Could not find a .prof file in this prebuilt apex")
}
d.inputProfilePathOnHost = prof
}
d.dexpreopt(ctx, libraryName, dexJarFile)
}
@@ -354,6 +365,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
var profileClassListing android.OptionalPath
var profileBootListing android.OptionalPath
profileIsTextListing := false
if d.inputProfilePathOnHost != nil {
profileClassListing = android.OptionalPathForPath(d.inputProfilePathOnHost)
} else if BoolDefault(d.dexpreoptProperties.Dex_preopt.Profile_guided, true) && !forPrebuiltApex(ctx) {

View File

@@ -2463,6 +2463,10 @@ func (j *Import) RequiredFilesFromPrebuiltApex(_ android.BaseModuleContext) []st
return requiredFilesFromPrebuiltApexForImport(name, &j.dexpreopter)
}
func (j *Import) UseProfileGuidedDexpreopt() bool {
return proptools.Bool(j.importDexpreoptProperties.Dex_preopt.Profile_guided)
}
// Add compile time check for interface implementation
var _ android.IDEInfo = (*Import)(nil)
var _ android.IDECustomizedModuleName = (*Import)(nil)

View File

@@ -3019,6 +3019,10 @@ func (module *SdkLibraryImport) RequiredFilesFromPrebuiltApex(ctx android.BaseMo
return requiredFilesFromPrebuiltApexForImport(name, &module.dexpreopter)
}
func (j *SdkLibraryImport) UseProfileGuidedDexpreopt() bool {
return proptools.Bool(j.importDexpreoptProperties.Dex_preopt.Profile_guided)
}
// java_sdk_library_xml
type sdkLibraryXml struct {
android.ModuleBase

View File

@@ -313,6 +313,10 @@ func (module *prebuiltSystemServerClasspathModule) RequiredFilesFromPrebuiltApex
return nil
}
func (module *prebuiltSystemServerClasspathModule) UseProfileGuidedDexpreopt() bool {
return false
}
var _ android.RequiredFilesFromPrebuiltApex = (*prebuiltSystemServerClasspathModule)(nil)
func prebuiltSystemServerClasspathModuleFactory() android.Module {