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

Commit 06ccf233 authored by Paul Duffin's avatar Paul Duffin Committed by Automerger Merge Worker
Browse files

java_sdk_library_import: Propagate prefer to child modules am: 38b5785e am: b08ba780

Change-Id: I88dbbef53348faa9dfdaa0cbe41f4fb2e5c7fd24
parents cd20bf7a b08ba780
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -69,6 +69,10 @@ func (p *Prebuilt) ForcePrefer() {
	p.properties.Prefer = proptools.BoolPtr(true)
}

func (p *Prebuilt) Prefer() bool {
	return proptools.Bool(p.properties.Prefer)
}

// The below source-related functions and the srcs, src fields are based on an assumption that
// prebuilt modules have a static source property at the moment. Currently there is only one
// exception, android_app_import, which chooses a source file depending on the product's DPI
+8 −7
Original line number Diff line number Diff line
@@ -1448,11 +1448,8 @@ func (module *sdkLibraryImport) createJavaImportForStubs(mctx android.Defaultabl
	} else if module.SystemExtSpecific() {
		props.System_ext_specific = proptools.BoolPtr(true)
	}
	// If the build should use prebuilt sdks then set prefer to true on the stubs library.
	// That will cause the prebuilt version of the stubs to override the source version.
	if mctx.Config().UnbundledBuildUsePrebuiltSdks() {
		props.Prefer = proptools.BoolPtr(true)
	}
	// The imports are preferred if the java_sdk_library_import is preferred.
	props.Prefer = proptools.BoolPtr(module.prebuilt.Prefer())
	mctx.CreateModule(ImportFactory, &props)
}

@@ -1460,10 +1457,14 @@ func (module *sdkLibraryImport) createPrebuiltStubsSources(mctx android.Defaulta
	props := struct {
		Name   *string
		Srcs   []string
		Prefer *bool
	}{}
	props.Name = proptools.StringPtr(module.stubsSourceModuleName(apiScope))
	props.Srcs = scopeProperties.Stub_srcs
	mctx.CreateModule(PrebuiltStubsSourcesFactory, &props)

	// The stubs source is preferred if the java_sdk_library_import is preferred.
	props.Prefer = proptools.BoolPtr(module.prebuilt.Prefer())
}

func (module *sdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext) {