create, but dont register, bp2build_deps mutator

This is the bulk of the "allowlist v2" feature. It will disable bp2build
generation for modules which have transitive dependencies without a
bazel build definition.

This CL includes this mutator, but doesn't register it as a bp2build
mutator (outside of a few unit tests). This allows us to easily iterate
on completion of this feature and ensure there are no launch blockers
before we finalize the change in AOSP.

Bug: 285631638
Test: Unit tests
Change-Id: Ifb0a079c409ca19b02cafa3fab2efa0d3deebc50
This commit is contained in:
Chris Parsons
2023-09-28 20:41:03 +00:00
parent dec9ce6693
commit 5f1b3c7ad8
12 changed files with 360 additions and 136 deletions

View File

@@ -14,12 +14,6 @@
package android
import (
"github.com/google/blueprint"
"android/soong/bazel"
)
func init() {
RegisterApiDomainBuildComponents(InitRegistrationContext)
}
@@ -97,13 +91,3 @@ const (
func ApiContributionTargetName(moduleName string) string {
return moduleName + apiContributionSuffix
}
// For each contributing cc_library, format the name to its corresponding contribution bazel target in the bp2build workspace
func contributionBazelAttributes(ctx TopDownMutatorContext, contributions []string) bazel.LabelListAttribute {
addSuffix := func(ctx BazelConversionPathContext, module blueprint.Module) string {
baseLabel := BazelModuleLabel(ctx, module)
return ApiContributionTargetName(baseLabel)
}
bazelLabels := BazelLabelForModuleDepsWithFn(ctx, contributions, addSuffix)
return bazel.MakeLabelListAttribute(bazelLabels)
}