adding /out/soong_injection/metrics/converted_modules_path_map.json
This file can be used by atest/scripts/tools to determine which modules
have been converted and what their bazel build path is.
Test: b build //packages/modules/adb/...
will generate the file at /out/soong_injection/metrics/converted_modules_path_map.json
Also added a unit test to check that the file is created.
{
"adbd": "//packages/modules/adb",
"adbd_test": "//packages/modules/adb",
"add_ext4_encrypt": "//external/e2fsprogs/contrib",
....
}
Change-Id: Ibd424c487840d84c8a4fb635828a73541220b36b
diff --git a/bp2build/metrics.go b/bp2build/metrics.go
index 3a21c34..0b45996 100644
--- a/bp2build/metrics.go
+++ b/bp2build/metrics.go
@@ -9,6 +9,7 @@
"android/soong/android"
"android/soong/shared"
"android/soong/ui/metrics/bp2build_metrics_proto"
+
"github.com/google/blueprint"
)
@@ -38,6 +39,9 @@
// List of converted modules
convertedModules []string
+ // Map of converted modules and paths to call
+ convertedModulePathMap map[string]string
+
// Counts of converted modules by module type.
convertedModuleTypeCount map[string]uint64
@@ -147,10 +151,11 @@
Handcrafted
)
-func (metrics *CodegenMetrics) AddConvertedModule(m blueprint.Module, moduleType string, conversionType ConversionType) {
+func (metrics *CodegenMetrics) AddConvertedModule(m blueprint.Module, moduleType string, dir string, conversionType ConversionType) {
// Undo prebuilt_ module name prefix modifications
moduleName := android.RemoveOptionalPrebuiltPrefix(m.Name())
metrics.convertedModules = append(metrics.convertedModules, moduleName)
+ metrics.convertedModulePathMap[moduleName] = "//" + dir
metrics.convertedModuleTypeCount[moduleType] += 1
metrics.totalModuleTypeCount[moduleType] += 1