From 864116ce3f76ef7bcde9a5779a1df0d9facaa4ea Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 2 Apr 2021 10:24:13 +0100 Subject: [PATCH] Add PrebuiltNameFromSource Bug: 177892522 Test: m nothing Change-Id: I45274836d59adbd6b2a2a848705b189398f1e766 --- android/prebuilt.go | 6 ++++++ apex/prebuilt.go | 2 +- java/sdk_library.go | 4 ++-- java/system_modules.go | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/android/prebuilt.go b/android/prebuilt.go index b43d23881..817629948 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -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 } diff --git a/apex/prebuilt.go b/apex/prebuilt.go index 3280cd8e5..68f285936 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -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 } diff --git a/java/sdk_library.go b/java/sdk_library.go index 37b8d9f62..eb9ba9bde 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -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))) } } } diff --git a/java/system_modules.go b/java/system_modules.go index 8c69051ae..320a2bbbf 100644 --- a/java/system_modules.go +++ b/java/system_modules.go @@ -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)) } }