bp2build: add allowlist for package-level conversions.
This CL adds the support for specifying lists of directories in
build/soong/android/bazel.go, which are then written into
out/soong/bp2build/MANIFEST. Using this configuration,
modules/directories can either default to bp2build_available: true or
false, while still retaining the ability to opt-in or out at the module level.
It also ensures that ConvertWithBp2Build returns true iff the module
type has a registered bp2build converter.
Test: go tests
Test: demo.sh full
Test: TreeHugger presubmits for bp2build and mixed builds.
Change-Id: I0e0f6f4b1b2ec045f2f1c338f7084defc5d23a55
diff --git a/android/mutator.go b/android/mutator.go
index 9552aa1..9e99bee 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -226,7 +226,7 @@
var bp2buildPreArchMutators = []RegisterMutatorFunc{}
var bp2buildDepsMutators = []RegisterMutatorFunc{}
-var bp2buildMutators = []RegisterMutatorFunc{}
+var bp2buildMutators = map[string]RegisterMutatorFunc{}
// RegisterBp2BuildMutator registers specially crafted mutators for
// converting Blueprint/Android modules into special modules that can
@@ -237,7 +237,7 @@
f := func(ctx RegisterMutatorsContext) {
ctx.TopDown(moduleType, m)
}
- bp2buildMutators = append(bp2buildMutators, f)
+ bp2buildMutators[moduleType] = f
}
// PreArchBp2BuildMutators adds mutators to be register for converting Android Blueprint modules