Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75d719fd authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "dexpreopt.config should be created even though unbundled image is built"

parents e88944c5 4b073cd0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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)
+1 −0
Original line number Diff line number Diff line
@@ -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"`
+6 −5
Original line number Diff line number Diff line
@@ -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).
+2 −3
Original line number Diff line number Diff line
@@ -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
	}