Convert $(sort) to Starlark
This is mostly so that we can not error out when seeing sort inside a `include $(sort $(wildcard foo/*.mk))`. Bug: 218736658 Test: go test Change-Id: I827ecfc751a908227cb2dd9ed1e4b3f313791a16
This commit is contained in:
@@ -110,6 +110,7 @@ var knownFunctions = map[string]interface {
|
|||||||
"require-artifacts-in-path-relaxed": &simpleCallParser{name: baseName + ".require_artifacts_in_path_relaxed", returnType: starlarkTypeVoid},
|
"require-artifacts-in-path-relaxed": &simpleCallParser{name: baseName + ".require_artifacts_in_path_relaxed", returnType: starlarkTypeVoid},
|
||||||
// TODO(asmundak): remove it once all calls are removed from configuration makefiles. see b/183161002
|
// TODO(asmundak): remove it once all calls are removed from configuration makefiles. see b/183161002
|
||||||
"shell": &shellCallParser{},
|
"shell": &shellCallParser{},
|
||||||
|
"sort": &simpleCallParser{name: baseName + ".mksort", returnType: starlarkTypeList},
|
||||||
"strip": &simpleCallParser{name: baseName + ".mkstrip", returnType: starlarkTypeString},
|
"strip": &simpleCallParser{name: baseName + ".mkstrip", returnType: starlarkTypeString},
|
||||||
"subst": &substCallParser{fname: "subst"},
|
"subst": &substCallParser{fname: "subst"},
|
||||||
"warning": &makeControlFuncParser{name: baseName + ".mkwarning"},
|
"warning": &makeControlFuncParser{name: baseName + ".mkwarning"},
|
||||||
|
@@ -1022,12 +1022,13 @@ def init(g, handle):
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "strip function",
|
desc: "strip/sort functions",
|
||||||
mkname: "product.mk",
|
mkname: "product.mk",
|
||||||
in: `
|
in: `
|
||||||
ifeq ($(filter hwaddress,$(PRODUCT_PACKAGES)),)
|
ifeq ($(filter hwaddress,$(PRODUCT_PACKAGES)),)
|
||||||
PRODUCT_PACKAGES := $(strip $(PRODUCT_PACKAGES) hwaddress)
|
PRODUCT_PACKAGES := $(strip $(PRODUCT_PACKAGES) hwaddress)
|
||||||
endif
|
endif
|
||||||
|
MY_VAR := $(sort b a c)
|
||||||
`,
|
`,
|
||||||
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
||||||
|
|
||||||
@@ -1036,6 +1037,7 @@ def init(g, handle):
|
|||||||
if "hwaddress" not in cfg.get("PRODUCT_PACKAGES", []):
|
if "hwaddress" not in cfg.get("PRODUCT_PACKAGES", []):
|
||||||
rblf.setdefault(handle, "PRODUCT_PACKAGES")
|
rblf.setdefault(handle, "PRODUCT_PACKAGES")
|
||||||
cfg["PRODUCT_PACKAGES"] = (rblf.mkstrip("%s hwaddress" % " ".join(cfg.get("PRODUCT_PACKAGES", [])))).split()
|
cfg["PRODUCT_PACKAGES"] = (rblf.mkstrip("%s hwaddress" % " ".join(cfg.get("PRODUCT_PACKAGES", [])))).split()
|
||||||
|
g["MY_VAR"] = rblf.mksort("b a c")
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user