Allow seeing include $(x) when there is an include_top comment

Previously, seeing anything other than an interpolate variable
was not allowed.

Bug: 226974242
Test: go test
Change-Id: I48a060f9a3fd19cd67a114d2cb0756ab2be25ce1
This commit is contained in:
Cole Faust
2022-04-26 16:27:22 -07:00
parent 12097e3109
commit 9df1d73657
3 changed files with 57 additions and 22 deletions

View File

@@ -1142,6 +1142,11 @@ def init(g, handle):
MY_PATH:=foo
#RBC# include_top vendor/foo1
$(call inherit-product,$(MY_PATH)/cfg.mk)
#RBC# include_top vendor/foo1
$(call inherit-product,$(MY_OTHER_PATH))
#RBC# include_top vendor/foo1
$(foreach f,$(MY_MAKEFILES), \
$(call inherit-product,$(f)))
`,
expected: `load("//build/make/core:product_config.rbc", "rblf")
load("//vendor/foo1:cfg.star|init", _cfg_init = "init")
@@ -1156,6 +1161,21 @@ def init(g, handle):
if not _varmod_init:
rblf.mkerror("product.mk", "Cannot find %s" % ("%s/cfg.mk" % g["MY_PATH"]))
rblf.inherit(handle, _varmod, _varmod_init)
_entry = {
"vendor/foo1/cfg.mk": ("vendor/foo1/cfg", _cfg_init),
}.get(g.get("MY_OTHER_PATH", ""))
(_varmod, _varmod_init) = _entry if _entry else (None, None)
if not _varmod_init:
rblf.mkerror("product.mk", "Cannot find %s" % (g.get("MY_OTHER_PATH", "")))
rblf.inherit(handle, _varmod, _varmod_init)
for f in rblf.words(g.get("MY_MAKEFILES", "")):
_entry = {
"vendor/foo1/cfg.mk": ("vendor/foo1/cfg", _cfg_init),
}.get(f)
(_varmod, _varmod_init) = _entry if _entry else (None, None)
if not _varmod_init:
rblf.mkerror("product.mk", "Cannot find %s" % (f))
rblf.inherit(handle, _varmod, _varmod_init)
`,
},
{