Merge changes I55a5a295,I9c09451d,I05177388 am: c004bf3b7e am: 766f6ac1c3 am: a78d49303f

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

Change-Id: I9b02faeffca703d7806640b3ccba7c2ba9a0a047
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-02-16 16:41:48 +00:00
committed by Automerger Merge Worker
7 changed files with 264 additions and 32 deletions

View File

@@ -801,6 +801,8 @@ type librarySdkMemberProperties struct {
// The value of the min_sdk_version property, translated into a number where possible.
MinSdkVersion *string `supported_build_releases:"Tiramisu+"`
DexPreoptProfileGuided *bool `supported_build_releases:"UpsideDownCake+"`
}
func (p *librarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
@@ -818,6 +820,10 @@ func (p *librarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberCo
canonical := android.ReplaceFinalizedCodenames(ctx.SdkModuleContext().Config(), j.minSdkVersion.ApiLevel.String())
p.MinSdkVersion = proptools.StringPtr(canonical)
}
if j.dexpreopter.dexpreoptProperties.Dex_preopt_result.Profile_guided {
p.DexPreoptProfileGuided = proptools.BoolPtr(true)
}
}
func (p *librarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
@@ -844,6 +850,11 @@ func (p *librarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberConte
propertySet.AddProperty("permitted_packages", p.PermittedPackages)
}
dexPreoptSet := propertySet.AddPropertySet("dex_preopt")
if p.DexPreoptProfileGuided != nil {
dexPreoptSet.AddProperty("profile_guided", proptools.Bool(p.DexPreoptProfileGuided))
}
// Do not copy anything else to the snapshot.
if memberType.onlyCopyJarToSnapshot {
return
@@ -2013,7 +2024,8 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if di == nil {
return // An error has been reported by FindDeapexerProviderForModule.
}
if dexOutputPath := di.PrebuiltExportPath(apexRootRelativePathToJavaLib(j.BaseModuleName())); dexOutputPath != nil {
dexJarFileApexRootRelative := apexRootRelativePathToJavaLib(j.BaseModuleName())
if dexOutputPath := di.PrebuiltExportPath(dexJarFileApexRootRelative); dexOutputPath != nil {
dexJarFile := makeDexJarPathFromPath(dexOutputPath)
j.dexJarFile = dexJarFile
installPath := android.PathForModuleInPartitionInstall(ctx, "apex", ai.ApexVariationName, apexRootRelativePathToJavaLib(j.BaseModuleName()))
@@ -2022,6 +2034,11 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.dexpreopter.installPath = j.dexpreopter.getInstallPath(ctx, installPath)
setUncompressDex(ctx, &j.dexpreopter, &j.dexer)
j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex
if profilePath := di.PrebuiltExportPath(dexJarFileApexRootRelative + ".prof"); profilePath != nil {
j.dexpreopter.inputProfilePathOnHost = profilePath
}
j.dexpreopt(ctx, dexOutputPath)
// Initialize the hiddenapi structure.
@@ -2156,11 +2173,16 @@ func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
// requiredFilesFromPrebuiltApexForImport returns information about the files that a java_import or
// java_sdk_library_import with the specified base module name requires to be exported from a
// prebuilt_apex/apex_set.
func requiredFilesFromPrebuiltApexForImport(name string) []string {
func requiredFilesFromPrebuiltApexForImport(name string, d *dexpreopter) []string {
dexJarFileApexRootRelative := apexRootRelativePathToJavaLib(name)
// Add the dex implementation jar to the set of exported files.
return []string{
apexRootRelativePathToJavaLib(name),
files := []string{
dexJarFileApexRootRelative,
}
if BoolDefault(d.importDexpreoptProperties.Dex_preopt.Profile_guided, false) {
files = append(files, dexJarFileApexRootRelative+".prof")
}
return files
}
// apexRootRelativePathToJavaLib returns the path, relative to the root of the apex's contents, for
@@ -2173,7 +2195,7 @@ var _ android.RequiredFilesFromPrebuiltApex = (*Import)(nil)
func (j *Import) RequiredFilesFromPrebuiltApex(_ android.BaseModuleContext) []string {
name := j.BaseModuleName()
return requiredFilesFromPrebuiltApexForImport(name)
return requiredFilesFromPrebuiltApexForImport(name, &j.dexpreopter)
}
// Add compile time check for interface implementation
@@ -2214,6 +2236,7 @@ func ImportFactory() android.Module {
module.AddProperties(
&module.properties,
&module.dexer.dexProperties,
&module.importDexpreoptProperties,
)
module.initModuleAndImport(module)