Fix how the rule is displayed in the error message. am: 2afb9d7722

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

Change-Id: I68e91a903606d7033a88fc353386378baf890757
This commit is contained in:
Sasha Smundak
2021-10-28 20:13:01 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 1 deletions

View File

@@ -1466,7 +1466,7 @@ func (ctx *parseContext) handleSimpleStatement(node mkparser.Node) bool {
handled = false
}
default:
ctx.errorf(x, "unsupported line %s", x.Dump())
ctx.errorf(x, "unsupported line %s", strings.ReplaceAll(x.Dump(), "\n", "\n#"))
}
return handled
}

View File

@@ -961,6 +961,23 @@ def init(g, handle):
if not _varmod_init:
rblf.mkerror("cannot")
rblf.inherit(handle, _varmod, _varmod_init)
`,
},
{
desc: "Ignore make rules",
mkname: "product.mk",
in: `
foo: foo.c
gcc -o $@ $*`,
expected: `# MK2RBC TRANSLATION ERROR: unsupported line rule: foo: foo.c
#gcc -o $@ $*
# rule: foo: foo.c
# gcc -o $@ $*
load("//build/make/core:product_config.rbc", "rblf")
def init(g, handle):
cfg = rblf.cfg(handle)
rblf.warning("product.mk", "partially successful conversion")
`,
},
}