Ignore assignments to .KATI_READONLY

Since the rbc results file is sorted, .KATI_READONLY
ends up trying to make a variable that hasn't been defined
yet readonly, which is an error.

It's not really worth supporting moving it down in the list,
because it wouldn't affect the variable being writable while
still in Starlark code.

Bug: 226974242
Test: go test
Change-Id: I9402f69be97e5c7cf010ad86f124422ea55fda7f
This commit is contained in:
Cole Faust
2022-04-26 18:02:05 -07:00
parent 12097e3109
commit 5d5fcc3092
2 changed files with 20 additions and 0 deletions

View File

@@ -542,6 +542,12 @@ func (ctx *parseContext) handleAssignment(a *mkparser.Assignment) []starlarkNode
if strings.HasPrefix(name, "override ") {
return []starlarkNode{ctx.newBadNode(a, "cannot handle override directive")}
}
if name == ".KATI_READONLY" {
// Skip assignments to .KATI_READONLY. If it was in the output file, it
// would be an error because it would be sorted before the definition of
// the variable it's trying to make readonly.
return []starlarkNode{}
}
// Soong configuration
if strings.HasPrefix(name, soongNsPrefix) {