Allow exporting bazel mixed build allowlists to simple text files
So that they the allowlists can be read from build_mainline_modules_bundles.sh.
Bug: 262302253
Test: m out/soong/bazel_prod_mixed_builds_enabled_list.txt out/soong/bazel_staging_mixed_builds_enabled_list.txt && cat out/soong/bazel_prod_mixed_builds_enabled_list.txt && echo && cat out/soong/bazel_staging_mixed_builds_enabled_list.txt
Change-Id: Id5f89ebb651a52dc5368681a20d6183703e05bd4
diff --git a/bp2build/conversion.go b/bp2build/conversion.go
index 6eb93bc..e15dd59 100644
--- a/bp2build/conversion.go
+++ b/bp2build/conversion.go
@@ -55,6 +55,10 @@
files = append(files, newFile("api_levels", "api_levels.json", string(apiLevelsContent)))
files = append(files, newFile("api_levels", "api_levels.bzl", android.StarlarkApiLevelConfigs(cfg)))
+ // TODO(b/262781701): Create an alternate soong_build entrypoint for writing out these files only when requested
+ files = append(files, newFile("allowlists", "mixed_build_prod_allowlist.txt", strings.Join(android.GetBazelEnabledModules(android.BazelProdMode), "\n")+"\n"))
+ files = append(files, newFile("allowlists", "mixed_build_staging_allowlist.txt", strings.Join(android.GetBazelEnabledModules(android.BazelStagingMode), "\n")+"\n"))
+
return files
}
diff --git a/bp2build/conversion_test.go b/bp2build/conversion_test.go
index 8de2f83..dfc7f0b 100644
--- a/bp2build/conversion_test.go
+++ b/bp2build/conversion_test.go
@@ -147,6 +147,14 @@
dir: "api_levels",
basename: "api_levels.bzl",
},
+ {
+ dir: "allowlists",
+ basename: "mixed_build_prod_allowlist.txt",
+ },
+ {
+ dir: "allowlists",
+ basename: "mixed_build_staging_allowlist.txt",
+ },
}
if len(files) != len(expectedFilePaths) {