Convert is-board-platform2/is-board-platform-in-list2/is-vendor-board-qcom macros.
Bug: 193540681 Test: internal Change-Id: I76c46d89f10b16b75438803479fec4aa468e3010
This commit is contained in:
@@ -111,13 +111,16 @@ var knownFunctions = map[string]struct {
|
|||||||
"is-android-codename": {"!is-android-codename", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
"is-android-codename": {"!is-android-codename", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
||||||
"is-android-codename-in-list": {"!is-android-codename-in-list", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
"is-android-codename-in-list": {"!is-android-codename-in-list", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
||||||
"is-board-platform": {"!is-board-platform", starlarkTypeBool, hiddenArgNone},
|
"is-board-platform": {"!is-board-platform", starlarkTypeBool, hiddenArgNone},
|
||||||
|
"is-board-platform2": {baseName + ".board_platform_is", starlarkTypeBool, hiddenArgGlobal},
|
||||||
"is-board-platform-in-list": {"!is-board-platform-in-list", starlarkTypeBool, hiddenArgNone},
|
"is-board-platform-in-list": {"!is-board-platform-in-list", starlarkTypeBool, hiddenArgNone},
|
||||||
|
"is-board-platform-in-list2": {baseName + ".board_platform_in", starlarkTypeBool, hiddenArgGlobal},
|
||||||
"is-chipset-in-board-platform": {"!is-chipset-in-board-platform", starlarkTypeUnknown, hiddenArgNone}, // unused by product config
|
"is-chipset-in-board-platform": {"!is-chipset-in-board-platform", starlarkTypeUnknown, hiddenArgNone}, // unused by product config
|
||||||
"is-chipset-prefix-in-board-platform": {"!is-chipset-prefix-in-board-platform", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
"is-chipset-prefix-in-board-platform": {"!is-chipset-prefix-in-board-platform", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
||||||
"is-not-board-platform": {"!is-not-board-platform", starlarkTypeBool, hiddenArgNone}, // defined but never used
|
"is-not-board-platform": {"!is-not-board-platform", starlarkTypeBool, hiddenArgNone}, // defined but never used
|
||||||
"is-platform-sdk-version-at-least": {"!is-platform-sdk-version-at-least", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
"is-platform-sdk-version-at-least": {"!is-platform-sdk-version-at-least", starlarkTypeBool, hiddenArgNone}, // unused by product config
|
||||||
"is-product-in-list": {"!is-product-in-list", starlarkTypeBool, hiddenArgNone},
|
"is-product-in-list": {"!is-product-in-list", starlarkTypeBool, hiddenArgNone},
|
||||||
"is-vendor-board-platform": {"!is-vendor-board-platform", starlarkTypeBool, hiddenArgNone},
|
"is-vendor-board-platform": {"!is-vendor-board-platform", starlarkTypeBool, hiddenArgNone},
|
||||||
|
"is-vendor-board-qcom": {"!is-vendor-board-qcom", starlarkTypeBool, hiddenArgNone},
|
||||||
callLoadAlways: {"!inherit-product", starlarkTypeVoid, hiddenArgNone},
|
callLoadAlways: {"!inherit-product", starlarkTypeVoid, hiddenArgNone},
|
||||||
callLoadIf: {"!inherit-product-if-exists", starlarkTypeVoid, hiddenArgNone},
|
callLoadIf: {"!inherit-product-if-exists", starlarkTypeVoid, hiddenArgNone},
|
||||||
"lastword": {"!lastword", starlarkTypeString, hiddenArgNone},
|
"lastword": {"!lastword", starlarkTypeString, hiddenArgNone},
|
||||||
@@ -1141,6 +1144,34 @@ func (ctx *parseContext) parseCheckFunctionCallResult(directive *mkparser.Direct
|
|||||||
list: &variableRefExpr{ctx.addVariable(s + "_BOARD_PLATFORMS"), true},
|
list: &variableRefExpr{ctx.addVariable(s + "_BOARD_PLATFORMS"), true},
|
||||||
isNot: negate,
|
isNot: negate,
|
||||||
}, true
|
}, true
|
||||||
|
|
||||||
|
case "is-board-platform2", "is-board-platform-in-list2":
|
||||||
|
if s, ok := maybeString(xValue); !ok || s != "" {
|
||||||
|
return ctx.newBadExpr(directive,
|
||||||
|
fmt.Sprintf("the result of %s can be compared only to empty", x.name)), true
|
||||||
|
}
|
||||||
|
if len(x.args) != 1 {
|
||||||
|
return ctx.newBadExpr(directive, "%s requires an argument", x.name), true
|
||||||
|
}
|
||||||
|
cc := &callExpr{
|
||||||
|
name: x.name,
|
||||||
|
args: []starlarkExpr{x.args[0]},
|
||||||
|
returnType: starlarkTypeBool,
|
||||||
|
}
|
||||||
|
if !negate {
|
||||||
|
return ¬Expr{cc}, true
|
||||||
|
}
|
||||||
|
return cc, true
|
||||||
|
case "is-vendor-board-qcom":
|
||||||
|
if s, ok := maybeString(xValue); !ok || s != "" {
|
||||||
|
return ctx.newBadExpr(directive,
|
||||||
|
fmt.Sprintf("the result of %s can be compared only to empty", x.name)), true
|
||||||
|
}
|
||||||
|
return &inExpr{
|
||||||
|
expr: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
|
||||||
|
list: &variableRefExpr{ctx.addVariable("QCOM_BOARD_PLATFORMS"), true},
|
||||||
|
isNot: negate,
|
||||||
|
}, true
|
||||||
default:
|
default:
|
||||||
return ctx.newBadExpr(directive, "Unknown function in ifeq: %s", x.name), true
|
return ctx.newBadExpr(directive, "Unknown function in ifeq: %s", x.name), true
|
||||||
}
|
}
|
||||||
|
@@ -560,6 +560,27 @@ def init(g, handle):
|
|||||||
pass
|
pass
|
||||||
elif g["TARGET_PRODUCT"] in g.get("PLATFORM_LIST", []):
|
elif g["TARGET_PRODUCT"] in g.get("PLATFORM_LIST", []):
|
||||||
pass
|
pass
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc: "new is-board calls",
|
||||||
|
mkname: "product.mk",
|
||||||
|
in: `
|
||||||
|
ifneq (,$(call is-board-platform-in-list2,msm8998 $(X))
|
||||||
|
else ifeq (,$(call is-board-platform2,copper)
|
||||||
|
else ifneq (,$(call is-vendor-board-qcom))
|
||||||
|
endif
|
||||||
|
`,
|
||||||
|
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
||||||
|
|
||||||
|
def init(g, handle):
|
||||||
|
cfg = rblf.cfg(handle)
|
||||||
|
if rblf.board_platform_in(g, "msm8998 %s" % g.get("X", "")):
|
||||||
|
pass
|
||||||
|
elif not rblf.board_platform_is(g, "copper"):
|
||||||
|
pass
|
||||||
|
elif g.get("TARGET_BOARD_PLATFORM", "") not in g["QCOM_BOARD_PLATFORMS"]:
|
||||||
|
pass
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user