Merge "Fix false pos in bp2build-prog due to prebulits" into main
This commit is contained in:
commit
8d7f2e41d1
3 changed files with 19 additions and 2 deletions
|
@ -48,7 +48,11 @@ func soongInjectionFiles(cfg android.Config, metrics CodegenMetrics) ([]BazelFil
|
|||
}
|
||||
files = append(files, newFile("apex_toolchain", "constants.bzl", apexToolchainVars))
|
||||
|
||||
files = append(files, newFile("metrics", "converted_modules.txt", strings.Join(metrics.Serialize().ConvertedModules, "\n")))
|
||||
if buf, err := json.MarshalIndent(metrics.convertedModuleWithType, "", " "); err != nil {
|
||||
return []BazelFile{}, err
|
||||
} else {
|
||||
files = append(files, newFile("metrics", "converted_modules.json", string(buf)))
|
||||
}
|
||||
|
||||
convertedModulePathMap, err := json.MarshalIndent(metrics.convertedModulePathMap, "", "\t")
|
||||
if err != nil {
|
||||
|
|
|
@ -134,7 +134,7 @@ func TestCreateBazelFiles_Bp2Build_CreatesDefaultFiles(t *testing.T) {
|
|||
},
|
||||
{
|
||||
dir: "metrics",
|
||||
basename: "converted_modules.txt",
|
||||
basename: "converted_modules.json",
|
||||
},
|
||||
{
|
||||
dir: "metrics",
|
||||
|
|
|
@ -9,11 +9,17 @@ import (
|
|||
"android/soong/android"
|
||||
"android/soong/shared"
|
||||
"android/soong/ui/metrics/bp2build_metrics_proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
)
|
||||
|
||||
type moduleInfo struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// CodegenMetrics represents information about the Blueprint-to-BUILD
|
||||
// conversion process.
|
||||
// Use CreateCodegenMetrics() to get a properly initialized instance
|
||||
|
@ -30,6 +36,9 @@ type CodegenMetrics struct {
|
|||
// Map of converted modules and paths to call
|
||||
// NOTE: NOT in the .proto
|
||||
convertedModulePathMap map[string]string
|
||||
|
||||
// Name and type of converted modules
|
||||
convertedModuleWithType []moduleInfo
|
||||
}
|
||||
|
||||
func CreateCodegenMetrics() CodegenMetrics {
|
||||
|
@ -191,6 +200,10 @@ func (metrics *CodegenMetrics) AddConvertedModule(m blueprint.Module, moduleType
|
|||
// Undo prebuilt_ module name prefix modifications
|
||||
moduleName := android.RemoveOptionalPrebuiltPrefix(m.Name())
|
||||
metrics.serialized.ConvertedModules = append(metrics.serialized.ConvertedModules, moduleName)
|
||||
metrics.convertedModuleWithType = append(metrics.convertedModuleWithType, moduleInfo{
|
||||
moduleName,
|
||||
moduleType,
|
||||
})
|
||||
metrics.convertedModulePathMap[moduleName] = "//" + dir
|
||||
metrics.serialized.ConvertedModuleTypeCount[moduleType] += 1
|
||||
metrics.serialized.TotalModuleTypeCount[moduleType] += 1
|
||||
|
|
Loading…
Reference in a new issue