Merge "Flag 'override' directives." am: 2a8105d19e am: 5f46e246aa am: 5c4824d8f2 am: fbe5e4d243

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

Change-Id: I9b7bf5cc6e32e3d10a30fb34626b4862ae476c4d
This commit is contained in:
Treehugger Robot
2021-11-11 04:21:14 +00:00
committed by Automerger Merge Worker
2 changed files with 23 additions and 0 deletions

View File

@@ -540,6 +540,14 @@ func (ctx *parseContext) handleAssignment(a *mkparser.Assignment) {
return
}
name := a.Name.Strings[0]
// The `override` directive
// override FOO :=
// is parsed as an assignment to a variable named `override FOO`.
// There are very few places where `override` is used, just flag it.
if strings.HasPrefix(name, "override ") {
ctx.errorf(a, "cannot handle override directive")
}
// Soong configuration
if strings.HasPrefix(name, soongNsPrefix) {
ctx.handleSoongNsAssignment(strings.TrimPrefix(name, soongNsPrefix), a)

View File

@@ -1025,6 +1025,21 @@ load("//build/make/core:product_config.rbc", "rblf")
def init(g, handle):
cfg = rblf.cfg(handle)
rblf.warning("product.mk", "partially successful conversion")
`,
},
{
desc: "Flag override",
mkname: "product.mk",
in: `
override FOO:=`,
expected: `# MK2RBC TRANSLATION ERROR: cannot handle override directive
# override FOO :=
load("//build/make/core:product_config.rbc", "rblf")
def init(g, handle):
cfg = rblf.cfg(handle)
g["override FOO"] = ""
rblf.warning("product.mk", "partially successful conversion")
`,
},
}