Add PrebuiltNameFromSource

Bug: 177892522
Test: m nothing
Change-Id: I45274836d59adbd6b2a2a848705b189398f1e766
This commit is contained in:
Paul Duffin 2021-04-02 10:24:13 +01:00
parent e1d3837645
commit 864116ce3f
4 changed files with 10 additions and 4 deletions

View file

@ -82,6 +82,12 @@ func RemoveOptionalPrebuiltPrefix(name string) string {
}
func (p *Prebuilt) Name(name string) string {
return PrebuiltNameFromSource(name)
}
// PrebuiltNameFromSource returns the result of prepending the "prebuilt_" prefix to the supplied
// name.
func PrebuiltNameFromSource(name string) string {
return "prebuilt_" + name
}

View file

@ -250,7 +250,7 @@ func prebuiltApexExportedModuleName(ctx android.BottomUpMutatorContext, name str
// the unprefixed name is the one to use. If the unprefixed one turns out to be a source module
// and not a renamed prebuilt module then that will be detected and reported as an error when
// processing the dependency in ApexInfoMutator().
prebuiltName := "prebuilt_" + name
prebuiltName := android.PrebuiltNameFromSource(name)
if ctx.OtherModuleExists(prebuiltName) {
name = prebuiltName
}

View file

@ -1945,11 +1945,11 @@ func (module *SdkLibraryImport) ComponentDepsMutator(ctx android.BottomUpMutator
}
// Add dependencies to the prebuilt stubs library
ctx.AddVariationDependencies(nil, apiScope.stubsTag, "prebuilt_"+module.stubsLibraryModuleName(apiScope))
ctx.AddVariationDependencies(nil, apiScope.stubsTag, android.PrebuiltNameFromSource(module.stubsLibraryModuleName(apiScope)))
if len(scopeProperties.Stub_srcs) > 0 {
// Add dependencies to the prebuilt stubs source library
ctx.AddVariationDependencies(nil, apiScope.stubsSourceTag, "prebuilt_"+module.stubsSourceModuleName(apiScope))
ctx.AddVariationDependencies(nil, apiScope.stubsSourceTag, android.PrebuiltNameFromSource(module.stubsSourceModuleName(apiScope)))
}
}
}

View file

@ -236,7 +236,7 @@ func (system *systemModulesImport) Prebuilt() *android.Prebuilt {
// modules.
func (system *systemModulesImport) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
for _, lib := range system.properties.Libs {
ctx.AddVariationDependencies(nil, systemModulesLibsTag, "prebuilt_"+lib)
ctx.AddVariationDependencies(nil, systemModulesLibsTag, android.PrebuiltNameFromSource(lib))
}
}