Merge "Show module's type and path when reporting dependency problems" am: 39291b9682

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2175945

Change-Id: I5cb37e4a5c115c8d9f81dcafe37ff463f06b5307
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-08-05 19:59:50 +00:00 committed by Automerger Merge Worker
commit c57e3e2661
2 changed files with 5 additions and 3 deletions

View file

@ -320,7 +320,8 @@ func GenerateBazelTargets(ctx *CodegenContext, generateFilegroups bool) (convers
// Handle modules with unconverted deps. By default, emit a warning.
if unconvertedDeps := aModule.GetUnconvertedBp2buildDeps(); len(unconvertedDeps) > 0 {
msg := fmt.Sprintf("%q depends on unconverted modules: %s", m.Name(), strings.Join(unconvertedDeps, ", "))
msg := fmt.Sprintf("%s %s:%s depends on unconverted modules: %s",
moduleType, bpCtx.ModuleDir(m), m.Name(), strings.Join(unconvertedDeps, ", "))
if ctx.unconvertedDepMode == warnUnconvertedDeps {
metrics.moduleWithUnconvertedDepsMsgs = append(metrics.moduleWithUnconvertedDepsMsgs, msg)
} else if ctx.unconvertedDepMode == errorModulesUnconvertedDeps {
@ -329,7 +330,8 @@ func GenerateBazelTargets(ctx *CodegenContext, generateFilegroups bool) (convers
}
}
if unconvertedDeps := aModule.GetMissingBp2buildDeps(); len(unconvertedDeps) > 0 {
msg := fmt.Sprintf("%q depends on missing modules: %s", m.Name(), strings.Join(unconvertedDeps, ", "))
msg := fmt.Sprintf("%s %s:%s depends on missing modules: %s",
moduleType, bpCtx.ModuleDir(m), m.Name(), strings.Join(unconvertedDeps, ", "))
if ctx.unconvertedDepMode == warnUnconvertedDeps {
metrics.moduleWithMissingDepsMsgs = append(metrics.moduleWithMissingDepsMsgs, msg)
} else if ctx.unconvertedDepMode == errorModulesUnconvertedDeps {

View file

@ -1032,7 +1032,7 @@ func TestModuleTypeBp2Build(t *testing.T) {
],
bazel_module: { bp2build_available: true },
}`,
ExpectedErr: fmt.Errorf(`"foobar" depends on unconverted modules: foo`),
ExpectedErr: fmt.Errorf(`filegroup .:foobar depends on unconverted modules: foo`),
Filesystem: map[string]string{
"other/Android.bp": `filegroup {
name: "foo",