bp2build: add converted modules to codegen metrics, and remove the
compat layer.
The list of converted modules is used for tracking bp2build progress.
The module_name_to_label aliases weren't really adding much value to
mixed builds, so let's drop the feature for now and simplify the code.
Test: CI
Test: USE_BAZEL_ANALYSIS=1 m droid
Change-Id: I3269344cfe6d1c72c108d66c6e820bc0ec19bb34
diff --git a/bp2build/conversion.go b/bp2build/conversion.go
index 75bc2b4..354abf6 100644
--- a/bp2build/conversion.go
+++ b/bp2build/conversion.go
@@ -16,29 +16,19 @@
Contents string
}
-func CreateSoongInjectionFiles(compatLayer CodegenCompatLayer) []BazelFile {
+func CreateSoongInjectionFiles(metrics CodegenMetrics) []BazelFile {
var files []BazelFile
files = append(files, newFile("cc_toolchain", GeneratedBuildFileName, "")) // Creates a //cc_toolchain package.
files = append(files, newFile("cc_toolchain", "constants.bzl", config.BazelCcToolchainVars()))
- files = append(files, newFile("module_name_to_label", GeneratedBuildFileName, nameToLabelAliases(compatLayer.NameToLabelMap)))
+ files = append(files, newFile("metrics", "converted_modules.txt", strings.Join(metrics.convertedModules, "\n")))
return files
}
-func nameToLabelAliases(nameToLabelMap map[string]string) string {
- ret := make([]string, len(nameToLabelMap))
-
- for k, v := range nameToLabelMap {
- // v is the fully qualified label rooted at '//'
- ret = append(ret, fmt.Sprintf(
- `alias(
- name = "%s",
- actual = "@%s",
-)`, k, v))
- }
- return strings.Join(ret, "\n\n")
+func convertedModules(convertedModules []string) string {
+ return strings.Join(convertedModules, "\n")
}
func CreateBazelFiles(