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
This commit is contained in:
Colin Cross 2019-02-26 21:13:48 -08:00
parent f8711f053c
commit c9a4c36634
1 changed files with 47 additions and 0 deletions

View File

@ -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