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

Commit 3452ac84 authored by Alexander Smundak's avatar Alexander Smundak Committed by Automerger Merge Worker
Browse files

Merge "Fix wildcard ('%') handling in the filter pattern." am: 636a2132 am: 7040352e

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1831853

Change-Id: I5d13fc90bc0c58515f0c1c836ccc8537d65400be
parents 710f9ae1 7040352e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1162,17 +1162,21 @@ func (ctx *parseContext) parseCompareFilterFuncResult(cond *mkparser.Directive,
		}
		// Either pattern or text should be const, and the
		// non-const one should be varRefExpr
		if xInList, ok = xPattern.(*stringLiteralExpr); ok {
		if xInList, ok = xPattern.(*stringLiteralExpr); ok && !strings.ContainsRune(xInList.literal, '%') && xText.typ() == starlarkTypeList {
			expr = xText
		} else if xInList, ok = xText.(*stringLiteralExpr); ok {
			expr = xPattern
		} else {
			return &callExpr{
			expr = &callExpr{
				object:     nil,
				name:       filterFuncCall.name,
				args:       filterFuncCall.args,
				returnType: starlarkTypeBool,
			}
			if negate {
				expr = &notExpr{expr: expr}
			}
			return expr
		}
	case *variableRefExpr:
		if v, ok := xPattern.(*variableRefExpr); ok {
+10 −3
Original line number Diff line number Diff line
@@ -360,20 +360,27 @@ ifeq ($(TARGET_BUILD_VARIANT), $(filter $(TARGET_BUILD_VARIANT), userdebug eng))
endif
ifneq (,$(filter true, $(v1)$(v2)))
endif
ifeq (,$(filter barbet coral%,$(TARGET_PRODUCT)))
else ifneq (,$(filter barbet%,$(TARGET_PRODUCT)))
endif
`,
		expected: `load("//build/make/core:product_config.rbc", "rblf")

def init(g, handle):
  cfg = rblf.cfg(handle)
  if g["TARGET_BUILD_VARIANT"] not in ["userdebug", "eng"]:
  if not rblf.filter("userdebug eng", g["TARGET_BUILD_VARIANT"]):
    pass
  if g["TARGET_BUILD_VARIANT"] == "userdebug":
  if rblf.filter("userdebug", g["TARGET_BUILD_VARIANT"]):
    pass
  if "plaf" in g.get("PLATFORM_LIST", []):
    pass
  if g["TARGET_BUILD_VARIANT"] in ["userdebug", "eng"]:
    pass
  if "%s%s" % (_v1, _v2) == "true":
  if rblf.filter("true", "%s%s" % (_v1, _v2)):
    pass
  if not rblf.filter("barbet coral%", g["TARGET_PRODUCT"]):
    pass
  elif rblf.filter("barbet%", g["TARGET_PRODUCT"]):
    pass
`,
	},