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
This commit is contained in:
Jingwen Chen
2021-03-10 02:05:59 -05:00
parent dca349a782
commit 12b4c2706d
20 changed files with 409 additions and 57 deletions

View File

@@ -140,6 +140,9 @@ type config struct {
fs pathtools.FileSystem
mockBpList string
bp2buildPackageConfig Bp2BuildConfig
bp2buildModuleTypeConfig map[string]bool
// If testAllowNonExistentPaths is true then PathForSource and PathForModuleSrc won't error
// in tests when a path doesn't exist.
TestAllowNonExistentPaths bool
@@ -281,6 +284,8 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
config.mockFileSystem(bp, fs)
config.bp2buildModuleTypeConfig = map[string]bool{}
return Config{config}
}
@@ -452,6 +457,8 @@ func NewConfig(srcDir, buildDir string, moduleListFile string) (Config, error) {
Bool(config.productVariables.ClangCoverage))
config.BazelContext, err = NewBazelContext(config)
config.bp2buildPackageConfig = bp2buildDefaultConfig
config.bp2buildModuleTypeConfig = make(map[string]bool)
return Config{config}, err
}