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
diff --git a/mk2rbc/node.go b/mk2rbc/node.go
index 4f7c4f0..dea4dc8 100644
--- a/mk2rbc/node.go
+++ b/mk2rbc/node.go
@@ -86,6 +86,8 @@
path interpolateExpr
candidateModules []*moduleInfo
loadAlways bool
+ location ErrorLocation
+ needsWarning bool
}
func (i inheritedDynamicModule) name() string {
@@ -97,6 +99,10 @@
}
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++