diff options
| author | 2020-06-26 20:17:02 +0100 | |
|---|---|---|
| committer | 2020-07-08 16:46:16 +0100 | |
| commit | 44f1d8404be0159ea95f74b0645157e74fe1b86e (patch) | |
| tree | c86a1b1e463f04ce0ef5923ab6b9dbb21882fdfa /java/sdk_library.go | |
| parent | ecc495fd096871feff67f598fc768ba972a84dd9 (diff) | |
Stop java_sdk_library_import from depending on source modules
Previously, java_sdk_library_import added the dependencies on its child
components in the deps mutator after prebuilts without a matching
source module are renamed to the source module name. That meant that
the java_sdk_library_import has to use the source module name and ended
up depending on the source module unless it was preferred.
This change adds a new component deps mutator that runs before the
PrebuiltRenameMutator so that the java_sdk_library_import can add
dependencies onto the prebuilt modules. It also updates an affected
test.
Bug: 159902351
Test: m nothing
Change-Id: I3576c4873302743e51aff547ea1497bef6d748ac
Diffstat (limited to 'java/sdk_library.go')
| -rw-r--r-- | java/sdk_library.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go index 8f8f8ce63..1fd109ab8 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -973,7 +973,8 @@ func IsXmlPermissionsFileDepTag(depTag blueprint.DependencyTag) bool { var implLibraryTag = sdkLibraryComponentTag{name: "impl-library"} -func (module *SdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { +// Add the dependencies on the child modules in the component deps mutator. +func (module *SdkLibrary) ComponentDepsMutator(ctx android.BottomUpMutatorContext) { for _, apiScope := range module.getGeneratedApiScopes(ctx) { // Add dependencies to the stubs library ctx.AddVariationDependencies(nil, apiScope.stubsTag, module.stubsLibraryModuleName(apiScope)) @@ -998,7 +999,12 @@ func (module *SdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { // Add dependency to the rule for generating the xml permissions file ctx.AddDependency(module, xmlPermissionsFileTag, module.xmlPermissionsModuleName()) } + } +} +// Add other dependencies as normal. +func (module *SdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { + if module.requiresRuntimeImplementationLibrary() { // Only add the deps for the library if it is actually going to be built. module.Library.deps(ctx) } @@ -1874,20 +1880,26 @@ func (module *SdkLibraryImport) createPrebuiltStubsSources(mctx android.Defaulta props.Prefer = proptools.BoolPtr(module.prebuilt.Prefer()) } -func (module *SdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext) { +// Add the dependencies on the child module in the component deps mutator so that it +// creates references to the prebuilt and not the source modules. +func (module *SdkLibraryImport) ComponentDepsMutator(ctx android.BottomUpMutatorContext) { for apiScope, scopeProperties := range module.scopeProperties { if len(scopeProperties.Jars) == 0 { continue } // Add dependencies to the prebuilt stubs library - ctx.AddVariationDependencies(nil, apiScope.stubsTag, module.stubsLibraryModuleName(apiScope)) + ctx.AddVariationDependencies(nil, apiScope.stubsTag, "prebuilt_"+module.stubsLibraryModuleName(apiScope)) if len(scopeProperties.Stub_srcs) > 0 { // Add dependencies to the prebuilt stubs source library - ctx.AddVariationDependencies(nil, apiScope.stubsSourceTag, module.stubsSourceModuleName(apiScope)) + ctx.AddVariationDependencies(nil, apiScope.stubsSourceTag, "prebuilt_"+module.stubsSourceModuleName(apiScope)) } } +} + +// Add other dependencies as normal. +func (module *SdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext) { implName := module.implLibraryModuleName() if ctx.OtherModuleExists(implName) { |