Write dexpreopt.config again during the build

Writing $OUT/dexpreopt.config during build setup and then using
it during the build causes bad incremental builds if a cleanspec
removes $OUT/dexpreopt.config.  Create a rule in Soong to write
out a copy so that it is a normal build artifact.

Bug: 132379813
Test: m checkbuild
Change-Id: I7755a7f8c1d6561fc83022a7f4cf7e4a64e989c9
This commit is contained in:
Colin Cross
2019-05-09 21:50:00 -07:00
parent a1591ab08c
commit 2d00f0dcae
4 changed files with 50 additions and 19 deletions

View File

@@ -115,6 +115,8 @@ func skipDexpreoptBootJars(ctx android.PathContext) bool {
type dexpreoptBootJars struct {
defaultBootImage *bootImage
otherImages []*bootImage
dexpreoptConfigForMake android.WritablePath
}
// dexpreoptBoot singleton rules
@@ -123,6 +125,9 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) {
return
}
d.dexpreoptConfigForMake = android.PathForOutput(ctx, ctx.Config().DeviceName(), "dexpreopt.config")
writeGlobalConfigForMake(ctx, d.dexpreoptConfigForMake)
global := dexpreoptGlobalConfig(ctx)
// Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
@@ -453,8 +458,24 @@ func dumpOatRules(ctx android.SingletonContext, image *bootImage) {
}
func writeGlobalConfigForMake(ctx android.SingletonContext, path android.WritablePath) {
data := dexpreoptGlobalConfigRaw(ctx).data
ctx.Build(pctx, android.BuildParams{
Rule: android.WriteFile,
Output: path,
Args: map[string]string{
"content": string(data),
},
})
}
// Export paths for default boot image to Make
func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
if d.dexpreoptConfigForMake != nil {
ctx.Strict("DEX_PREOPT_CONFIG_FOR_MAKE", d.dexpreoptConfigForMake.String())
}
image := d.defaultBootImage
if image != nil {
ctx.Strict("DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED", image.profileInstalls.String())