Merge changes from topics "dist_for_goals", "mk2star" am: 613ae210f6
Original change: https://android-review.googlesource.com/c/platform/build/+/1890801 Change-Id: I9dbe243c6941b04fe8262e59c072fa6a2839d0e2
This commit is contained in:
@@ -17,6 +17,7 @@ load("//build/make/core:envsetup.rbc", _envsetup_init = "init")
|
||||
"""Runtime functions."""
|
||||
|
||||
_soong_config_namespaces_key = "$SOONG_CONFIG_NAMESPACES"
|
||||
_dist_for_goals_key = "$dist_for_goals"
|
||||
def _init_globals(version_info):
|
||||
"""Returns dict created from the runtime environment."""
|
||||
globals = dict()
|
||||
@@ -90,6 +91,18 @@ def _printglobals(globals, globals_base):
|
||||
__print_attr("SOONG_CONFIG_%s_%s" % (nsname, var), val)
|
||||
else:
|
||||
print("SOONG_CONFIG_%s_%s :=" % (nsname, var))
|
||||
elif attr == _dist_for_goals_key:
|
||||
goals = []
|
||||
src_dst_list = []
|
||||
goal_dst_list = []
|
||||
for goal_name, goal_src_dst_list in sorted(val.items()):
|
||||
goals.append(goal_name)
|
||||
for sd in sorted(goal_src_dst_list):
|
||||
src_dst_list.append(":".join(sd))
|
||||
goal_dst_list.append(":".join((goal_name, sd[1])))
|
||||
print("_all_dist_goal_output_pairs:=", " ".join(goal_dst_list))
|
||||
print("_all_dist_goals:=", " ".join(goals))
|
||||
print("_all_dist_src_dst_pairs:=", " ".join(src_dst_list))
|
||||
elif attr not in globals_base or globals_base[attr] != val:
|
||||
__print_attr(attr, val)
|
||||
|
||||
@@ -513,6 +526,21 @@ def _expand_wildcard(pattern):
|
||||
"""Expands shell wildcard pattern."""
|
||||
return rblf_wildcard(pattern)
|
||||
|
||||
def _mkdist_for_goals(g, goal, src_dst_list):
|
||||
"""Implements dist-for-goals macro."""
|
||||
goals_map = g.get(_dist_for_goals_key, {})
|
||||
pairs = goals_map.get(goal)
|
||||
if pairs == None:
|
||||
pairs = []
|
||||
g[_dist_for_goals_key] = dict([(k,v) for k,v in goals_map.items()] + [(goal, pairs)])
|
||||
for src_dst in __words(src_dst_list):
|
||||
pair=src_dst.split(":")
|
||||
if len(pair) > 2:
|
||||
fail(src_dst + " should be a :-separated pair")
|
||||
pairs.append((pair[0],pair[1] if len(pair) == 2 and pair[1] else __base(pair[0])))
|
||||
g[_dist_for_goals_key][goal] = pairs
|
||||
|
||||
|
||||
def _mkerror(file, message = ""):
|
||||
"""Prints error and stops."""
|
||||
fail("%s: %s. Stop" % (file, message))
|
||||
@@ -521,6 +549,18 @@ def _mkwarning(file, message = ""):
|
||||
"""Prints warning."""
|
||||
rblf_log(file, "warning", message, sep = ':')
|
||||
|
||||
def _mk2rbc_error(loc, message):
|
||||
"""Prints a message about conversion error and stops.
|
||||
|
||||
If RBC_MK2RBC_CONTINUE environment variable is set,
|
||||
the execution will continue after the message is printed.
|
||||
"""
|
||||
if _options.mk2rbc_continue:
|
||||
rblf_log(loc, message, sep = ':')
|
||||
else:
|
||||
_mkerror(loc, message)
|
||||
|
||||
|
||||
def _mkinfo(file, message = ""):
|
||||
"""Prints info."""
|
||||
rblf_log(message)
|
||||
@@ -631,6 +671,7 @@ def __get_options():
|
||||
rearrange = "",
|
||||
trace_modules = False,
|
||||
trace_variables = [],
|
||||
mk2rbc_continue = False,
|
||||
)
|
||||
for x in getattr(rblf_cli, "RBC_OUT", "").split(","):
|
||||
if x == "sort" or x == "unique":
|
||||
@@ -648,6 +689,8 @@ def __get_options():
|
||||
settings["trace_modules"] = True
|
||||
elif x != "":
|
||||
settings["trace_variables"].append(x)
|
||||
if getattr(rblf_cli, "RBC_MK2RBC_CONTINUE", ""):
|
||||
settings["mk2rbc_continue"] = True
|
||||
return struct(**settings)
|
||||
|
||||
# Settings used during debugging.
|
||||
@@ -675,6 +718,8 @@ rblf = struct(
|
||||
init_globals = _init_globals,
|
||||
inherit = _inherit,
|
||||
indirect = _indirect,
|
||||
mk2rbc_error = _mk2rbc_error,
|
||||
mkdist_for_goals = _mkdist_for_goals,
|
||||
mkinfo = _mkinfo,
|
||||
mkerror = _mkerror,
|
||||
mkpatsubst = _mkpatsubst,
|
||||
|
||||
Reference in New Issue
Block a user