Expand handling of unconverted deps in bp2build
Support three options for converting modules with unconverted
dependencies
1. (default) Warn when converting a module if it has unconverted deps.
2. Error when encountering a module with unconverted deps. (not hooked
up yet)
Test: build/bazel/ci/bp2build.sh
Test: build/bazel/ci/mixed_libc.sh
Test: BP2BUILD_ERROR_UNCONVERTED=1 build/bazel/ci/bp2build.sh with
unconverted deps -- get appropriate error
Bug: 181155349
Change-Id: Ifaabf0cd2e43e963366dc137159c705294165c3d
diff --git a/bp2build/metrics.go b/bp2build/metrics.go
index 65b06c6..645ef2d 100644
--- a/bp2build/metrics.go
+++ b/bp2build/metrics.go
@@ -3,6 +3,7 @@
import (
"android/soong/android"
"fmt"
+ "strings"
)
// Simple metrics struct to collect information about a Blueprint to BUILD
@@ -16,6 +17,8 @@
// Total number of handcrafted targets
handCraftedTargetCount int
+
+ moduleWithUnconvertedDepsMsgs []string
}
// Print the codegen metrics to stdout.
@@ -27,8 +30,10 @@
generatedTargetCount += count
}
fmt.Printf(
- "[bp2build] Generated %d total BUILD targets and included %d handcrafted BUILD targets from %d Android.bp modules.\n",
+ "[bp2build] Generated %d total BUILD targets and included %d handcrafted BUILD targets from %d Android.bp modules.\n With %d modules with unconverted deps \n\t%s",
generatedTargetCount,
metrics.handCraftedTargetCount,
- metrics.TotalModuleCount)
+ metrics.TotalModuleCount,
+ len(metrics.moduleWithUnconvertedDepsMsgs),
+ strings.Join(metrics.moduleWithUnconvertedDepsMsgs, "\n\t"))
}