Remove duplicated shouldUncompressDex logic
shouldUncompressDex has already been computed and stored in deviceProperties.UncompressDex, pass it to dexpreopter instead of recomputing it. Also add a stub for java libraries to set UncompressDex. Test: no change to build.ninja Change-Id: I663d9fbbe768a8dc9a97c7d456dd7a010f43162d
This commit is contained in:
committed by
Nicolas Geoffray
parent
1f8076b42d
commit
2fc72f66d0
@@ -213,7 +213,6 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
installDir = filepath.Join("app", ctx.ModuleName())
|
installDir = filepath.Join("app", ctx.ModuleName())
|
||||||
}
|
}
|
||||||
a.dexpreopter.installPath = android.PathForModuleInstall(ctx, installDir, ctx.ModuleName()+".apk")
|
a.dexpreopter.installPath = android.PathForModuleInstall(ctx, installDir, ctx.ModuleName()+".apk")
|
||||||
a.dexpreopter.isPrivApp = Bool(a.appProperties.Privileged)
|
|
||||||
|
|
||||||
if ctx.ModuleName() != "framework-res" {
|
if ctx.ModuleName() != "framework-res" {
|
||||||
a.Module.compile(ctx, a.aaptSrcJar)
|
a.Module.compile(ctx, a.aaptSrcJar)
|
||||||
|
@@ -28,11 +28,11 @@ import (
|
|||||||
type dexpreopter struct {
|
type dexpreopter struct {
|
||||||
dexpreoptProperties DexpreoptProperties
|
dexpreoptProperties DexpreoptProperties
|
||||||
|
|
||||||
installPath android.OutputPath
|
installPath android.OutputPath
|
||||||
isPrivApp bool
|
uncompressedDex bool
|
||||||
isSDKLibrary bool
|
isSDKLibrary bool
|
||||||
isTest bool
|
isTest bool
|
||||||
isInstallable bool
|
isInstallable bool
|
||||||
|
|
||||||
builtInstalled []string
|
builtInstalled []string
|
||||||
}
|
}
|
||||||
@@ -145,19 +145,13 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
|
|||||||
deps = append(deps, profileClassListing.Path())
|
deps = append(deps, profileClassListing.Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
uncompressedDex := false
|
|
||||||
if ctx.Config().UncompressPrivAppDex() &&
|
|
||||||
(d.isPrivApp || inList(ctx.ModuleName(), ctx.Config().ModulesLoadedByPrivilegedModules())) {
|
|
||||||
uncompressedDex = true
|
|
||||||
}
|
|
||||||
|
|
||||||
dexpreoptConfig := dexpreopt.ModuleConfig{
|
dexpreoptConfig := dexpreopt.ModuleConfig{
|
||||||
Name: ctx.ModuleName(),
|
Name: ctx.ModuleName(),
|
||||||
DexLocation: dexLocation,
|
DexLocation: dexLocation,
|
||||||
BuildPath: android.PathForModuleOut(ctx, "dexpreopt", ctx.ModuleName()+".jar").String(),
|
BuildPath: android.PathForModuleOut(ctx, "dexpreopt", ctx.ModuleName()+".jar").String(),
|
||||||
DexPath: dexJarFile.String(),
|
DexPath: dexJarFile.String(),
|
||||||
PreferCodeIntegrity: false,
|
PreferCodeIntegrity: false,
|
||||||
UncompressedDex: uncompressedDex,
|
UncompressedDex: d.uncompressedDex,
|
||||||
HasApkLibraries: false,
|
HasApkLibraries: false,
|
||||||
PreoptFlags: nil,
|
PreoptFlags: nil,
|
||||||
|
|
||||||
|
@@ -1327,6 +1327,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
|
|||||||
j.dexJarFile = dexOutputFile
|
j.dexJarFile = dexOutputFile
|
||||||
|
|
||||||
j.dexpreopter.isInstallable = Bool(j.properties.Installable)
|
j.dexpreopter.isInstallable = Bool(j.properties.Installable)
|
||||||
|
j.dexpreopter.uncompressedDex = j.deviceProperties.UncompressDex
|
||||||
dexOutputFile = j.dexpreopt(ctx, dexOutputFile)
|
dexOutputFile = j.dexpreopt(ctx, dexOutputFile)
|
||||||
|
|
||||||
j.maybeStrippedDexJarFile = dexOutputFile
|
j.maybeStrippedDexJarFile = dexOutputFile
|
||||||
@@ -1499,9 +1500,14 @@ type Library struct {
|
|||||||
Module
|
Module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j *Library) shouldUncompressDex(ctx android.ModuleContext) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", ctx.ModuleName()+".jar")
|
j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", ctx.ModuleName()+".jar")
|
||||||
j.dexpreopter.isSDKLibrary = j.deviceProperties.IsSDKLibrary
|
j.dexpreopter.isSDKLibrary = j.deviceProperties.IsSDKLibrary
|
||||||
|
j.deviceProperties.UncompressDex = j.shouldUncompressDex(ctx)
|
||||||
j.compile(ctx)
|
j.compile(ctx)
|
||||||
|
|
||||||
if Bool(j.properties.Installable) || ctx.Host() {
|
if Bool(j.properties.Installable) || ctx.Host() {
|
||||||
|
Reference in New Issue
Block a user