aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-02-26 21:13:48 -0800
committerColin Cross <ccross@android.com>2019-02-28 22:00:21 -0800
commitc9a4c36634583490f4849dc1fc186af98ec1cbf9 (patch)
treecd2eccaebdbe0a4902bdc3b376e852bcf942d3eb /java
parentf8711f053c2c1d07aa6e42fb3a85177dd39fbbef (diff)
downloadandroid_build_soong-c9a4c36634583490f4849dc1fc186af98ec1cbf9.tar.gz
android_build_soong-c9a4c36634583490f4849dc1fc186af98ec1cbf9.tar.bz2
android_build_soong-c9a4c36634583490f4849dc1fc186af98ec1cbf9.zip
Move boot image oatdump phony rules into Soong
The boot image oatdump rules depend on the details of dexpreopting the boot image. Instead of exporting all of the necessary values to make, move the rules into Soong instead. Also removes the ART_DUMP_OAT_PATH variable, and moves the output to out/soong/boot.*.oatdump.txt. Test: m dump-oat-boot Change-Id: I055b1c39918ba3425c8393b3e1b5359df055472a
Diffstat (limited to 'java')
-rw-r--r--java/dexpreopt_bootjars.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index a35e0114..ca688326 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -16,6 +16,7 @@ package java
import (
"path/filepath"
+ "sort"
"strings"
"android/soong/android"
@@ -137,6 +138,8 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) {
if global.GenerateApexImage {
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
}
+
+ dumpOatRules(ctx, d.defaultBootImage)
}
// buildBootImage takes a bootImageConfig, creates rules to build it, and returns a *bootImage.
@@ -389,6 +392,50 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin
var bootImageProfileRuleKey = android.NewOnceKey("bootImageProfileRule")
+func dumpOatRules(ctx android.SingletonContext, image *bootImage) {
+ var archs []android.ArchType
+ for arch := range image.images {
+ archs = append(archs, arch)
+ }
+ sort.Slice(archs, func(i, j int) bool { return archs[i].String() < archs[j].String() })
+
+ var allPhonies android.Paths
+ for _, arch := range archs {
+ // Create a rule to call oatdump.
+ output := android.PathForOutput(ctx, "boot."+arch.String()+".oatdump.txt")
+ rule := android.NewRuleBuilder()
+ rule.Command().
+ // TODO: for now, use the debug version for better error reporting
+ Tool(ctx.Config().HostToolPath(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]).
+ FlagWithOutput("--output=", output).
+ FlagWithArg("--instruction-set=", arch.String())
+ rule.Build(pctx, ctx, "dump-oat-boot-"+arch.String(), "dump oat boot "+arch.String())
+
+ // Create a phony rule that depends on the output file and prints the path.
+ phony := android.PathForPhony(ctx, "dump-oat-boot-"+arch.String())
+ rule = android.NewRuleBuilder()
+ rule.Command().
+ Implicit(output).
+ ImplicitOutput(phony).
+ Text("echo").FlagWithArg("Output in ", output.String())
+ rule.Build(pctx, ctx, "phony-dump-oat-boot-"+arch.String(), "dump oat boot "+arch.String())
+
+ allPhonies = append(allPhonies, phony)
+ }
+
+ phony := android.PathForPhony(ctx, "dump-oat-boot")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Phony,
+ Output: phony,
+ Inputs: allPhonies,
+ Description: "dump-oat-boot",
+ })
+
+}
+
// Export paths for default boot image to Make
func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
image := d.defaultBootImage