aboutsummaryrefslogtreecommitdiffstats
path: root/java/dexpreopt.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-02-11 14:21:24 -0800
committerColin Cross <ccross@android.com>2019-02-15 16:16:25 -0800
commit800fe13146c98a8b1ed06df33d5ab50a8c4b688e (patch)
treefb5669e135a769298a9a0d96d754c17857515335 /java/dexpreopt.go
parent25397f52ff20778cb83902239e07534f717c7d44 (diff)
downloadbuild_soong-800fe13146c98a8b1ed06df33d5ab50a8c4b688e.tar.gz
build_soong-800fe13146c98a8b1ed06df33d5ab50a8c4b688e.tar.bz2
build_soong-800fe13146c98a8b1ed06df33d5ab50a8c4b688e.zip
Move dexpreopting of boot jars into Soong
Implement the dexpreopting of boot jars in singleton rules in Soong. Test: m checkbuild Change-Id: Ic02ce941fa5e238b839b3eb4c06a3e10c62d98ff
Diffstat (limited to 'java/dexpreopt.go')
-rw-r--r--java/dexpreopt.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 127deab9..0a565297 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -56,7 +56,11 @@ type DexpreoptProperties struct {
}
func (d *dexpreopter) dexpreoptDisabled(ctx android.ModuleContext) bool {
- if ctx.Config().DisableDexPreopt(ctx.ModuleName()) {
+ if ctx.Config().DisableDexPreopt() {
+ return true
+ }
+
+ if ctx.Config().DisableDexPreoptForModule(ctx.ModuleName()) {
return true
}
@@ -83,8 +87,8 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.ModuleContext) bool {
var dexpreoptGlobalConfigKey = android.NewOnceKey("DexpreoptGlobalConfig")
-func getGlobalConfig(ctx android.ModuleContext) dexpreopt.GlobalConfig {
- globalConfig := ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} {
+func dexpreoptGlobalConfig(ctx android.PathContext) dexpreopt.GlobalConfig {
+ return ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} {
if f := ctx.Config().DexpreoptGlobalConfig(); f != "" {
ctx.AddNinjaFileDeps(f)
globalConfig, err := dexpreopt.LoadGlobalConfig(f)
@@ -95,11 +99,10 @@ func getGlobalConfig(ctx android.ModuleContext) dexpreopt.GlobalConfig {
}
return dexpreopt.GlobalConfig{}
}).(dexpreopt.GlobalConfig)
- return globalConfig
}
func odexOnSystemOther(ctx android.ModuleContext, installPath android.OutputPath) bool {
- return dexpreopt.OdexOnSystemOtherByName(ctx.ModuleName(), android.InstallPathToOnDevicePath(ctx, installPath), getGlobalConfig(ctx))
+ return dexpreopt.OdexOnSystemOtherByName(ctx.ModuleName(), android.InstallPathToOnDevicePath(ctx, installPath), dexpreoptGlobalConfig(ctx))
}
func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.ModuleOutPath) android.ModuleOutPath {
@@ -107,7 +110,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
return dexJarFile
}
- globalConfig := getGlobalConfig(ctx)
+ info := dexpreoptBootJarsInfo(ctx)
var archs []android.ArchType
for _, a := range ctx.MultiTargets() {
@@ -118,7 +121,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
for _, target := range ctx.Config().Targets[android.Android] {
archs = append(archs, target.Arch.ArchType)
}
- if inList(ctx.ModuleName(), globalConfig.SystemServerJars) && !d.isSDKLibrary {
+ if inList(ctx.ModuleName(), info.global.SystemServerJars) && !d.isSDKLibrary {
// If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
archs = archs[:1]
}
@@ -130,7 +133,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
var images []string
for _, arch := range archs {
- images = append(images, globalConfig.DefaultDexPreoptImage[arch])
+ images = append(images, info.images[arch].String())
}
dexLocation := android.InstallPathToOnDevicePath(ctx, d.installPath)
@@ -178,6 +181,9 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
Archs: archs,
DexPreoptImages: images,
+ PreoptBootClassPathDexFiles: info.preoptBootDex.Strings(),
+ PreoptBootClassPathDexLocations: info.preoptBootLocations,
+
PreoptExtractedApk: false,
NoCreateAppImage: !BoolDefault(d.dexpreoptProperties.Dex_preopt.App_image, true),
@@ -188,7 +194,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
StripOutputPath: strippedDexJarFile.String(),
}
- dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(globalConfig, dexpreoptConfig)
+ dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(info.global, dexpreoptConfig)
if err != nil {
ctx.ModuleErrorf("error generating dexpreopt rule: %s", err.Error())
return dexJarFile
@@ -198,7 +204,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
d.builtInstalled = dexpreoptRule.Installs().String()
- stripRule, err := dexpreopt.GenerateStripRule(globalConfig, dexpreoptConfig)
+ stripRule, err := dexpreopt.GenerateStripRule(info.global, dexpreoptConfig)
if err != nil {
ctx.ModuleErrorf("error generating dexpreopt strip rule: %s", err.Error())
return dexJarFile