Allow variable-prefixed include statements in mk2rbc

mk2rbc was already searching the whole android tree
for Makefiles, so allowing variable-prefixed include
statements doesn't affect performance on the file searching
front. On the generated code front, there's already a cap
of 150 potentially-included makefiles that prevents the
performance from getting too bad, and it can be lowered
if necessary.

Bug: 213508006
Test: go test
Change-Id: I3a4e81acb3d97bee08ac3dbe63052a274acf5793
This commit is contained in:
Cole Faust
2022-01-26 17:47:33 -08:00
parent 4012047331
commit 069aba64f6
3 changed files with 29 additions and 42 deletions

View File

@@ -86,6 +86,8 @@ type inheritedDynamicModule struct {
path interpolateExpr
candidateModules []*moduleInfo
loadAlways bool
location ErrorLocation
needsWarning bool
}
func (i inheritedDynamicModule) name() string {
@@ -97,6 +99,10 @@ func (i inheritedDynamicModule) entryName() string {
}
func (i inheritedDynamicModule) emitSelect(gctx *generationContext) {
if i.needsWarning {
gctx.newLine()
gctx.writef("%s.mkwarning(%q, %q)", baseName, i.location, "Including a path with a non-constant prefix, please convert this to a simple literal to generate cleaner starlark.")
}
gctx.newLine()
gctx.writef("_entry = {")
gctx.indentLevel++