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
This commit is contained in:
@@ -821,6 +821,12 @@ func (c *config) UnbundledBuildApps() bool {
|
||||
return Bool(c.productVariables.Unbundled_build_apps)
|
||||
}
|
||||
|
||||
// Returns true if building image that aren't bundled with the platform.
|
||||
// UnbundledBuild() is always true when this is true.
|
||||
func (c *config) UnbundledBuildImage() bool {
|
||||
return Bool(c.productVariables.Unbundled_build_image)
|
||||
}
|
||||
|
||||
// Returns true if building modules against prebuilt SDKs.
|
||||
func (c *config) AlwaysUsePrebuiltSdks() bool {
|
||||
return Bool(c.productVariables.Always_use_prebuilt_sdks)
|
||||
|
@@ -225,6 +225,7 @@ type productVariables struct {
|
||||
Allow_missing_dependencies *bool `json:",omitempty"`
|
||||
Unbundled_build *bool `json:",omitempty"`
|
||||
Unbundled_build_apps *bool `json:",omitempty"`
|
||||
Unbundled_build_image *bool `json:",omitempty"`
|
||||
Always_use_prebuilt_sdks *bool `json:",omitempty"`
|
||||
Skip_boot_jars_check *bool `json:",omitempty"`
|
||||
Malloc_not_svelte *bool `json:",omitempty"`
|
||||
|
11
java/app.go
11
java/app.go
@@ -1213,7 +1213,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
|
||||
@@ -1249,15 +1249,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).
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user