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/build_conversion.go b/bp2build/build_conversion.go
index 2cbb557..f7b392b 100644
--- a/bp2build/build_conversion.go
+++ b/bp2build/build_conversion.go
@@ -249,7 +249,6 @@
type conversionResults struct {
buildFileToTargets map[string]BazelTargets
metrics CodegenMetrics
- compatLayer CodegenCompatLayer
}
func (r conversionResults) BuildDirToTargets() map[string]BazelTargets {
@@ -265,10 +264,6 @@
RuleClassCount: make(map[string]int),
}
- compatLayer := CodegenCompatLayer{
- NameToLabelMap: make(map[string]string),
- }
-
dirs := make(map[string]bool)
var errs []error
@@ -285,7 +280,7 @@
if b, ok := m.(android.Bazelable); ok && b.HasHandcraftedLabel() {
metrics.handCraftedTargetCount += 1
metrics.TotalModuleCount += 1
- compatLayer.AddNameToLabelEntry(m.Name(), b.HandcraftedLabel())
+ metrics.AddConvertedModule(m.Name())
pathToBuildFile := getBazelPackagePath(b)
// We are using the entire contents of handcrafted build file, so if multiple targets within
// a package have handcrafted targets, we only want to include the contents one time.
@@ -314,10 +309,8 @@
}
targets = generateBazelTargets(bpCtx, aModule)
for _, t := range targets {
- if t.name == m.Name() {
- // only add targets that exist in Soong to compatibility layer
- compatLayer.AddNameToLabelEntry(m.Name(), t.Label())
- }
+ // only add targets that exist in Soong to compatibility layer
+ metrics.AddConvertedModule(m.Name())
metrics.RuleClassCount[t.ruleClass] += 1
}
} else {
@@ -360,7 +353,6 @@
return conversionResults{
buildFileToTargets: buildFileToTargets,
metrics: metrics,
- compatLayer: compatLayer,
}, errs
}