summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJeongik Cha <jeongik@google.com>2021-06-08 11:35:00 +0900
committerYi-Yo Chiang <yochiang@google.com>2021-07-15 15:30:02 +0800
commite64464306404bb00c04190e2e44cb0952e824646 (patch)
tree6ea9cd373443f8ee9405b97dc35c89e12a3d4cae /java
parent99aa53c0ca6687a30729b9c9eb1189b53a06a822 (diff)
dexpreopt.config should be created even though unbundled image is built
Bug: 188179858 Test: compare dexpreopt_config.zip files from 1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip 2. m dexpreopt_config_zip (note that m clean should run between steps) Change-Id: I36a6e8b10b9922cc5522accaf90af1aa05049a86 (cherry picked from commit 4b073cd0835555597c2b05320f1b36f60adbf63a)
Diffstat (limited to 'java')
-rwxr-xr-xjava/app.go11
-rw-r--r--java/dexpreopt.go5
2 files changed, 8 insertions, 8 deletions
diff --git a/java/app.go b/java/app.go
index 235966a88..477b9909b 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1268,7 +1268,7 @@ func (u *usesLibrary) addLib(lib string, optional bool) {
}
func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs bool) {
- if !ctx.Config().UnbundledBuild() {
+ if !ctx.Config().UnbundledBuild() || ctx.Config().UnbundledBuildImage() {
ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...)
ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...)
// Only add these extra dependencies if the module depends on framework libs. This avoids
@@ -1304,15 +1304,16 @@ func replaceInList(list []string, oldstr, newstr string) {
// to their dex jars on host and on device.
func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext) dexpreopt.ClassLoaderContextMap {
clcMap := make(dexpreopt.ClassLoaderContextMap)
-
- if !ctx.Config().UnbundledBuild() {
+ // Skip when UnbundledBuild() is true, but UnbundledBuildImage() is false.
+ // Added UnbundledBuildImage() condition to generate dexpreopt.config even though unbundled image is built.
+ if !ctx.Config().UnbundledBuild() || ctx.Config().UnbundledBuildImage() {
ctx.VisitDirectDeps(func(m android.Module) {
if tag, ok := ctx.OtherModuleDependencyTag(m).(usesLibraryDependencyTag); ok {
dep := ctx.OtherModuleName(m)
if lib, ok := m.(UsesLibraryDependency); ok {
- libName := dep
+ libName := android.RemoveOptionalPrebuiltPrefix(dep)
if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil {
- libName = *ulib.ProvidesUsesLib()
+ libName = android.RemoveOptionalPrebuiltPrefix(*ulib.ProvidesUsesLib())
// Replace module name with library name in `uses_libs`/`optional_uses_libs`
// in order to pass verify_uses_libraries check (which compares these
// properties against library names written in the manifest).
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 2e46d74fa..0faae36ba 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -141,10 +141,9 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
}
}
- // If it is neither app nor test, make config files regardless of its dexpreopt setting.
+ // If it is test, make config files regardless of its dexpreopt setting.
// The config files are required for apps defined in make which depend on the lib.
- // TODO(b/158843648): The config for apps should be generated as well regardless of setting.
- if (d.isApp || d.isTest) && d.dexpreoptDisabled(ctx) {
+ if d.isTest && d.dexpreoptDisabled(ctx) {
return
}