diff options
author | Colin Cross <ccross@android.com> | 2019-03-01 07:47:34 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-01 07:47:34 -0800 |
commit | ba358c6c90213016e858c20539b08380f0335adb (patch) | |
tree | 7ee0b84a4c9e1184792f79a0eab8cc26ea279d8c /java | |
parent | 4ea7fb7c07b408fc25c28ba0d6ae9aa38a1366dd (diff) | |
parent | e3c13d6778a5bf9a7681101d89a7c7b4e925f1a1 (diff) | |
download | android_build_soong-ba358c6c90213016e858c20539b08380f0335adb.tar.gz android_build_soong-ba358c6c90213016e858c20539b08380f0335adb.tar.bz2 android_build_soong-ba358c6c90213016e858c20539b08380f0335adb.zip |
Merge "Move boot image oatdump phony rules into Soong" am: 292d6cfd73 am: 7cd2df4887
am: e3c13d6778
Change-Id: Ieb6f4e4b1af4340051012ad8fa2f7bbac34261f3
Diffstat (limited to 'java')
-rw-r--r-- | java/dexpreopt_bootjars.go | 47 |
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 |