Merge "Move generation of the dexpreopt tool paths into Soong."

This commit is contained in:
Martin Stjernholm
2020-01-08 10:40:28 +00:00
committed by Gerrit Code Review
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

View File

@@ -37,8 +37,9 @@ type globalConfigAndRaw struct {
func dexpreoptGlobalConfigRaw(ctx android.PathContext) globalConfigAndRaw {
return ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} {
if f := ctx.Config().DexpreoptGlobalConfig(); f != "" {
soongConfig := dexpreopt.CreateGlobalSoongConfig(ctx)
ctx.AddNinjaFileDeps(f)
globalConfig, data, err := dexpreopt.LoadGlobalConfig(ctx, f)
globalConfig, data, err := dexpreopt.LoadGlobalConfig(ctx, f, soongConfig)
if err != nil {
panic(err)
}