Enable Mixed Builds for Prebuilt Library

This change provides support for mixed builds for
cc_prebuilt_library modules and allowlists some such modules.

Fixes: 225938765
Test: Unit tests, run mixed builds and verify correctness
Change-Id: I04396c79661df6b9a43907859e4f96d0191e8e1b
This commit is contained in:
Trevor Radcliffe
2022-05-17 21:59:36 +00:00
parent 59d37c8bb6
commit 5d6fa4d857
5 changed files with 219 additions and 47 deletions

View File

@@ -110,6 +110,18 @@ func RemoveOptionalPrebuiltPrefix(name string) string {
return strings.TrimPrefix(name, "prebuilt_")
}
// RemoveOptionalPrebuiltPrefixFromBazelLabel removes the "prebuilt_" prefix from the *target name* of a Bazel label.
// This differs from RemoveOptionalPrebuiltPrefix in that it does not remove it from the start of the string, but
// instead removes it from the target name itself.
func RemoveOptionalPrebuiltPrefixFromBazelLabel(label string) string {
splitLabel := strings.Split(label, ":")
bazelModuleNameNoPrebuilt := RemoveOptionalPrebuiltPrefix(splitLabel[1])
return strings.Join([]string{
splitLabel[0],
bazelModuleNameNoPrebuilt,
}, ":")
}
func (p *Prebuilt) Name(name string) string {
return PrebuiltNameFromSource(name)
}