Move generation of the dexpreopt tool paths into Soong.

The dexpreopt global config is now split into the part that is generated
from make (in build/make/core/dex_preopt_config.mk) and the part that is
generated from Soong. Since the goal is to generate the dex2oat path from
Soong dependencies, the old GlobalConfig.Tools struct is simply repurposed
for the Soong generated config, although the intention is to allow more
settings to migrate from make to Soong, and hence from GlobalConfig to
GlobalSoongConfig.

Since the new dexpreopt_soong.config is written from a Soong-created ninja
rule, it doesn't need to be rewritten to out/soong/<device>/ like the old
make-created config file.

Test: m
Test: env USE_DEX2OAT_DEBUG=false m
  (check that out/soong/dexpreopt_soong.config points to dex2oat instead of dex2oatd)
Bug: 145934348

Change-Id: Ifd45c4a08e2ec55b86f4a93f0d85bd39cf2cf189
This commit is contained in:
Martin Stjernholm
2020-01-06 23:11:37 +00:00
parent 99d522b5df
commit c52aaf11d0
5 changed files with 165 additions and 56 deletions

View File

@@ -335,7 +335,7 @@ func buildBootImageRuleForArch(ctx android.SingletonContext, image *bootImage,
invocationPath := outputPath.ReplaceExtension(ctx, "invocation")
cmd.Tool(global.Tools.Dex2oat).
cmd.Tool(global.SoongConfig.Dex2oat).
Flag("--avoid-storing-invocation").
FlagWithOutput("--write-invocation-to=", invocationPath).ImplicitOutput(invocationPath).
Flag("--runtime-arg").FlagWithArg("-Xms", global.Dex2oatImageXms).
@@ -444,7 +444,6 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin
return nil
}
profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
tools := global.Tools
defaultProfile := "frameworks/base/config/boot-image-profile.txt"
rule := android.NewRuleBuilder()
@@ -470,7 +469,7 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin
rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
Tool(tools.Profman).
Tool(global.SoongConfig.Profman).
FlagWithInput("--create-profile-from=", bootImageProfile).
FlagForEachInput("--apk=", image.dexPathsDeps.Paths()).
FlagForEachArg("--dex-location=", image.dexLocationsDeps).
@@ -499,8 +498,6 @@ func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImage, mi
return nil
}
return ctx.Config().Once(bootFrameworkProfileRuleKey, func() interface{} {
tools := global.Tools
rule := android.NewRuleBuilder()
rule.MissingDeps(missingDeps)
@@ -521,7 +518,7 @@ func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImage, mi
rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
Tool(tools.Profman).
Tool(global.SoongConfig.Profman).
Flag("--generate-boot-profile").
FlagWithInput("--create-profile-from=", bootFrameworkProfile).
FlagForEachInput("--apk=", image.dexPathsDeps.Paths()).
@@ -598,6 +595,7 @@ func writeGlobalConfigForMake(ctx android.SingletonContext, path android.Writabl
func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
if d.dexpreoptConfigForMake != nil {
ctx.Strict("DEX_PREOPT_CONFIG_FOR_MAKE", d.dexpreoptConfigForMake.String())
ctx.Strict("DEX_PREOPT_SOONG_CONFIG_FOR_MAKE", android.PathForOutput(ctx, "dexpreopt_soong.config").String())
}
image := d.defaultBootImage