aboutsummaryrefslogtreecommitdiff
path: root/java/dexpreopt_bootjars.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/dexpreopt_bootjars.go')
-rw-r--r--java/dexpreopt_bootjars.go52
1 files changed, 50 insertions, 2 deletions
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index fe468a9e0..2a142baee 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -216,6 +216,7 @@ func buildBootImage(ctx android.SingletonContext, config bootImageConfig) *bootI
}
profile := bootImageProfileRule(ctx, image, missingDeps)
+ bootFrameworkProfileRule(ctx, image, missingDeps)
var allFiles android.Paths
@@ -229,7 +230,7 @@ func buildBootImage(ctx android.SingletonContext, config bootImageConfig) *bootI
if image.zip != nil {
rule := android.NewRuleBuilder()
rule.Command().
- Tool(ctx.Config().HostToolPath(ctx, "soong_zip")).
+ BuiltTool(ctx, "soong_zip").
FlagWithOutput("-o ", image.zip).
FlagWithArg("-C ", image.dir.String()).
FlagWithInputList("-f ", allFiles, " -f ")
@@ -297,6 +298,7 @@ func buildBootImageRuleForArch(ctx android.SingletonContext, image *bootImage,
FlagForEachArg("--dex-location=", image.dexLocations).
Flag("--generate-debug-info").
Flag("--generate-build-id").
+ Flag("--image-format=lz4hc").
FlagWithOutput("--oat-symbols=", symbolsFile).
Flag("--strip").
FlagWithOutput("--oat-file=", outputPath.ReplaceExtension(ctx, "oat")).
@@ -424,6 +426,52 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin
var bootImageProfileRuleKey = android.NewOnceKey("bootImageProfileRule")
+func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImage, missingDeps []string) android.WritablePath {
+ global := dexpreoptGlobalConfig(ctx)
+
+ if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
+ return nil
+ }
+ return ctx.Config().Once(bootFrameworkProfileRuleKey, func() interface{} {
+ tools := global.Tools
+
+ rule := android.NewRuleBuilder()
+ rule.MissingDeps(missingDeps)
+
+ // Some branches like master-art-host don't have frameworks/base, so manually
+ // handle the case that the default is missing. Those branches won't attempt to build the profile rule,
+ // and if they do they'll get a missing deps error.
+ defaultProfile := "frameworks/base/config/boot-profile.txt"
+ path := android.ExistentPathForSource(ctx, defaultProfile)
+ var bootFrameworkProfile android.Path
+ if path.Valid() {
+ bootFrameworkProfile = path.Path()
+ } else {
+ missingDeps = append(missingDeps, defaultProfile)
+ bootFrameworkProfile = android.PathForOutput(ctx, "missing")
+ }
+
+ profile := image.dir.Join(ctx, "boot.bprof")
+
+ rule.Command().
+ Text(`ANDROID_LOG_TAGS="*:e"`).
+ Tool(tools.Profman).
+ Flag("--generate-boot-profile").
+ FlagWithInput("--create-profile-from=", bootFrameworkProfile).
+ FlagForEachInput("--apk=", image.dexPaths.Paths()).
+ FlagForEachArg("--dex-location=", image.dexLocations).
+ FlagWithOutput("--reference-profile-file=", profile)
+
+ rule.Install(profile, "/system/etc/boot-image.bprof")
+ rule.Build(pctx, ctx, "bootFrameworkProfile", "profile boot framework jars")
+ image.profileInstalls = append(image.profileInstalls, rule.Installs()...)
+
+ return profile
+ }).(android.WritablePath)
+}
+
+var bootFrameworkProfileRuleKey = android.NewOnceKey("bootFrameworkProfileRule")
+
func dumpOatRules(ctx android.SingletonContext, image *bootImage) {
var archs []android.ArchType
for arch := range image.images {
@@ -438,7 +486,7 @@ func dumpOatRules(ctx android.SingletonContext, image *bootImage) {
rule := android.NewRuleBuilder()
rule.Command().
// TODO: for now, use the debug version for better error reporting
- Tool(ctx.Config().HostToolPath(ctx, "oatdumpd")).
+ BuiltTool(ctx, "oatdumpd").
FlagWithInputList("--runtime-arg -Xbootclasspath:", image.dexPaths.Paths(), ":").
FlagWithList("--runtime-arg -Xbootclasspath-locations:", image.dexLocations, ":").
FlagWithArg("--image=", dexpreopt.PathToLocation(image.images[arch], arch)).Implicit(image.images[arch]).