Merge "Consolidate conversions of is-board-platform(2)"

This commit is contained in:
Treehugger Robot
2022-01-11 03:51:21 +00:00
committed by Gerrit Code Review
2 changed files with 4 additions and 30 deletions

View File

@@ -91,9 +91,9 @@ var knownFunctions = map[string]interface {
"foreach": &foreachCallPaser{},
"if": &ifCallParser{},
"info": &makeControlFuncParser{name: baseName + ".mkinfo"},
"is-board-platform": &isBoardPlatformCallParser{},
"is-board-platform": &simpleCallParser{name: baseName + ".board_platform_is", returnType: starlarkTypeBool, addGlobals: true},
"is-board-platform2": &simpleCallParser{name: baseName + ".board_platform_is", returnType: starlarkTypeBool, addGlobals: true},
"is-board-platform-in-list": &isBoardPlatformInListCallParser{},
"is-board-platform-in-list": &simpleCallParser{name: baseName + ".board_platform_in", returnType: starlarkTypeBool, addGlobals: true},
"is-board-platform-in-list2": &simpleCallParser{name: baseName + ".board_platform_in", returnType: starlarkTypeBool, addGlobals: true},
"is-product-in-list": &isProductInListCallParser{},
"is-vendor-board-platform": &isVendorBoardPlatformCallParser{},
@@ -1439,32 +1439,6 @@ func (p *myDirCallParser) parse(ctx *parseContext, node mkparser.Node, args *mkp
return &variableRefExpr{ctx.addVariable("LOCAL_PATH"), true}
}
type isBoardPlatformCallParser struct{}
func (p *isBoardPlatformCallParser) parse(ctx *parseContext, node mkparser.Node, args *mkparser.MakeString) starlarkExpr {
if args.Empty() {
return ctx.newBadExpr(node, "is-board-platform requires an argument")
}
return &eqExpr{
left: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
right: ctx.parseMakeString(node, args),
isEq: true,
}
}
type isBoardPlatformInListCallParser struct{}
func (p *isBoardPlatformInListCallParser) parse(ctx *parseContext, node mkparser.Node, args *mkparser.MakeString) starlarkExpr {
if args.Empty() {
return ctx.newBadExpr(node, "is-board-platform-in-list requires an argument")
}
return &inExpr{
expr: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
list: maybeConvertToStringList(ctx.parseMakeString(node, args)),
isNot: false,
}
}
type isProductInListCallParser struct{}
func (p *isProductInListCallParser) parse(ctx *parseContext, node mkparser.Node, args *mkparser.MakeString) starlarkExpr {

View File

@@ -598,9 +598,9 @@ endif
def init(g, handle):
cfg = rblf.cfg(handle)
if g.get("TARGET_BOARD_PLATFORM", "") in ["msm8998"]:
if rblf.board_platform_in(g, "msm8998"):
pass
elif g.get("TARGET_BOARD_PLATFORM", "") != "copper":
elif not rblf.board_platform_is(g, "copper"):
pass
elif g.get("TARGET_BOARD_PLATFORM", "") not in g["QCOM_BOARD_PLATFORMS"]:
pass