Generate BUILD files for every directory that has an Android.bp file.

Test: Added an integration test
Test: bazel build --package_path=out/soong/workspace //bionic/...

Change-Id: Ie34bd23ab3c5428e6c9c9919e5fb6fcb4e709adc
This commit is contained in:
Rupert Shuttleworth
2021-04-21 07:10:09 -04:00
parent b21166e236
commit 2a4fc3ecdc
11 changed files with 180 additions and 19 deletions

View File

@@ -126,6 +126,42 @@ const (
)
var (
// Do not write BUILD files for these directories
// NOTE: this is not recursive
bp2buildDoNotWriteBuildFileList = []string{
// Don't generate these BUILD files - because external BUILD files already exist
"external/boringssl",
"external/brotli",
"external/dagger2",
"external/flatbuffers",
"external/gflags",
"external/google-fruit",
"external/grpc-grpc",
"external/grpc-grpc/test/core/util",
"external/grpc-grpc/test/cpp/common",
"external/grpc-grpc/third_party/address_sorting",
"external/nanopb-c",
"external/nos/host/generic",
"external/nos/host/generic/libnos",
"external/nos/host/generic/libnos/generator",
"external/nos/host/generic/libnos_datagram",
"external/nos/host/generic/libnos_transport",
"external/nos/host/generic/nugget/proto",
"external/perfetto",
"external/protobuf",
"external/rust/cxx",
"external/rust/cxx/demo",
"external/ruy",
"external/tensorflow",
"external/tensorflow/tensorflow/lite",
"external/tensorflow/tensorflow/lite/java",
"external/tensorflow/tensorflow/lite/kernels",
"external/tflite-support",
"external/tinyalsa_new",
"external/wycheproof",
"external/libyuv",
}
// Configure modules in these directories to enable bp2build_available: true or false by default.
bp2buildDefaultConfig = Bp2BuildConfig{
"bionic": Bp2BuildDefaultTrueRecursively,
@@ -190,11 +226,16 @@ var (
}
// Used for quicker lookups
bp2buildModuleDoNotConvert = map[string]bool{}
mixedBuildsDisabled = map[string]bool{}
bp2buildDoNotWriteBuildFile = map[string]bool{}
bp2buildModuleDoNotConvert = map[string]bool{}
mixedBuildsDisabled = map[string]bool{}
)
func init() {
for _, moduleName := range bp2buildDoNotWriteBuildFileList {
bp2buildDoNotWriteBuildFile[moduleName] = true
}
for _, moduleName := range bp2buildModuleDoNotConvertList {
bp2buildModuleDoNotConvert[moduleName] = true
}
@@ -204,6 +245,14 @@ func init() {
}
}
func ShouldWriteBuildFileForDir(dir string) bool {
if _, ok := bp2buildDoNotWriteBuildFile[dir]; ok {
return false
} else {
return true
}
}
// MixedBuildsEnabled checks that a module is ready to be replaced by a
// converted or handcrafted Bazel target.
func (b *BazelModuleBase) MixedBuildsEnabled(ctx BazelConversionPathContext) bool {