Extract duplicate code to common helper functions.
Also, fall back to using a default name for the dexpreopt directory if
we are not building for Android.
Bug: 290583827
Test: m nothing
Change-Id: I3fc6ff9142a2dcdf995796f75891b242fe2848d0
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 9057a1c..794bc4a 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -505,8 +505,7 @@
// No module has enabled dexpreopting, so we assume there will be no boot image to make.
return
}
- archType := ctx.Config().Targets[android.Android][0].Arch.ArchType
- d.dexpreoptConfigForMake = android.PathForOutput(ctx, toDexpreoptDirName(archType), "dexpreopt.config")
+ d.dexpreoptConfigForMake = android.PathForOutput(ctx, getDexpreoptDirName(ctx), "dexpreopt.config")
writeGlobalConfigForMake(ctx, d.dexpreoptConfigForMake)
global := dexpreopt.GetGlobalConfig(ctx)