ba3ea16f14
If both bp2build_available and label are specified, label will be preferred. Initially, we copy the entire BUILD.bazel file. Eventually we may move this to use bazel query for a more accurate result. Test: go test * Test: build/bazel/scripts/milestone-2/demo.sh full Test: GENERATE_BAZEL_FILES=true m nothing edit bionic/libc/tools/BUILD.bazel GENERATE_BAZEL_FILES=true m nothing and verify changes picked up Bug: 180516554 Change-Id: I43025583300e6b10d2c18032cd4a76237b578d59
34 lines
967 B
Go
34 lines
967 B
Go
package bp2build
|
|
|
|
import (
|
|
"android/soong/android"
|
|
"fmt"
|
|
)
|
|
|
|
// Simple metrics struct to collect information about a Blueprint to BUILD
|
|
// conversion process.
|
|
type CodegenMetrics struct {
|
|
// Total number of Soong/Blueprint modules
|
|
TotalModuleCount int
|
|
|
|
// Counts of generated Bazel targets per Bazel rule class
|
|
RuleClassCount map[string]int
|
|
|
|
// Total number of handcrafted targets
|
|
handCraftedTargetCount int
|
|
}
|
|
|
|
// Print the codegen metrics to stdout.
|
|
func (metrics CodegenMetrics) Print() {
|
|
generatedTargetCount := 0
|
|
for _, ruleClass := range android.SortedStringKeys(metrics.RuleClassCount) {
|
|
count := metrics.RuleClassCount[ruleClass]
|
|
fmt.Printf("[bp2build] %s: %d targets\n", ruleClass, count)
|
|
generatedTargetCount += count
|
|
}
|
|
fmt.Printf(
|
|
"[bp2build] Generated %d total BUILD targets and included %d handcrafted BUILD targets from %d Android.bp modules.\n",
|
|
generatedTargetCount,
|
|
metrics.handCraftedTargetCount,
|
|
metrics.TotalModuleCount)
|
|
}
|