Merge "Allow dexpreopt of source sdklib in prebuilt apex builds" into main am: 17b9a5b8b4 am: 5f7e0106d7

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

Change-Id: Icfa72baf95d3c17830213afe70853bb15b44a6c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-04-18 02:05:49 +00:00
committed by Automerger Merge Worker
6 changed files with 47 additions and 17 deletions

View File

@@ -243,10 +243,6 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext, libName s
return true
}
if disableSourceApexVariant(ctx) {
return true
}
if _, isApex := android.ModuleProvider(ctx, android.ApexBundleInfoProvider); isApex {
// dexpreopt rules for system server jars can be generated in the ModuleCtx of prebuilt apexes
return false
@@ -501,8 +497,12 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
Output(appProductPackages)
productPackagesRule.Restat().Build("product_packages."+dexJarStem, "dexpreopt product_packages")
// Prebuilts are active, do not copy the dexpreopt'd source javalib to out/soong/system_server_dexjars
// The javalib from the deapexed prebuilt will be copied to this location.
// TODO (b/331665856): Implement a principled solution for this.
copyApexSystemServerJarDex := !disableSourceApexVariant(ctx)
dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(
ctx, globalSoong, global, dexpreoptConfig, appProductPackages)
ctx, globalSoong, global, dexpreoptConfig, appProductPackages, copyApexSystemServerJarDex)
if err != nil {
ctx.ModuleErrorf("error generating dexpreopt rule: %s", err.Error())
return

View File

@@ -886,6 +886,12 @@ func init() {
}
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if disableSourceApexVariant(ctx) {
// Prebuilts are active, do not create the installation rules for the source javalib.
// Even though the source javalib is not used, we need to hide it to prevent duplicate installation rules.
// TODO (b/331665856): Implement a principled solution for this.
j.HideFromMake()
}
j.provideHiddenAPIPropertyInfo(ctx)
j.sdkVersion = j.SdkVersion(ctx)

View File

@@ -1562,6 +1562,12 @@ func (module *SdkLibrary) OutputFiles(tag string) (android.Paths, error) {
}
func (module *SdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if disableSourceApexVariant(ctx) {
// Prebuilts are active, do not create the installation rules for the source javalib.
// Even though the source javalib is not used, we need to hide it to prevent duplicate installation rules.
// TODO (b/331665856): Implement a principled solution for this.
module.HideFromMake()
}
if proptools.String(module.deviceProperties.Min_sdk_version) != "" {
module.CheckMinSdkVersion(ctx)
}