Merge "Create $(findstring) starlark implementation" am: 12beaaf4ac
Original change: https://android-review.googlesource.com/c/platform/build/+/1921319 Change-Id: Ia0c7f1283732e6f3368fc2fc3680d85978e6fc29
This commit is contained in:
@@ -476,6 +476,12 @@ def _find_and_copy(pattern, from_dir, to_dir):
|
||||
return sorted(["%s/%s:%s/%s" % (
|
||||
from_dir, f, to_dir, f) for f in rblf_find_files(from_dir, pattern, only_files=1)])
|
||||
|
||||
def _findstring(needle, haystack):
|
||||
"""Equivalent to GNU make's $(findstring)."""
|
||||
if haystack.find(needle) < 0:
|
||||
return ""
|
||||
return needle
|
||||
|
||||
def _filter_out(pattern, text):
|
||||
"""Return all the words from `text' that do not match any word in `pattern'.
|
||||
|
||||
@@ -727,6 +733,7 @@ rblf = struct(
|
||||
filter = _filter,
|
||||
filter_out = _filter_out,
|
||||
find_and_copy = _find_and_copy,
|
||||
findstring = _findstring,
|
||||
inherit = _inherit,
|
||||
indirect = _indirect,
|
||||
mk2rbc_error = _mk2rbc_error,
|
||||
|
Reference in New Issue
Block a user