Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2e0b601 authored by Cole Faust's avatar Cole Faust
Browse files

Consolidate conversions of is-board-platform(2)

mk2rbc implements conversions for both
is-board-platform(-in-list) and
is-board-platform(-in-list)2. The conversions
are not the same despite the functions being the
same. Make them convert to the same thing.

Bug: 201477826
Test: go test
Change-Id: I688a2f6114e1688c713e42f0f9229cbc5ee6a917
parent fe306aba
Loading
Loading
Loading
Loading
+2 −28
Original line number Diff line number Diff line
@@ -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{},
@@ -1406,32 +1406,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 {
+2 −2
Original line number Diff line number Diff line
@@ -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