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
diff --git a/android/bazel.go b/android/bazel.go
index 1f7f7e6..6e87d57 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -126,6 +126,42 @@
)
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 @@
}
// 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 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 {