Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -706,13 +706,14 @@ def _get_cc_flags_make_variable(ctx, common, cc_toolchain):
cc_flags.extend(feature_config_cc_flags)
return {"CC_FLAGS": " ".join(cc_flags)}

def _expand_nested_variable(ctx, additional_vars, exp, execpath = True, targets = []):
def _expand_nested_variable(ctx, additional_vars, exp, execpath = True, targets = None):
# If make variable is predefined path variable(like $(location ...))
# we will expand it first.
if exp.find(" ") != -1:
if not execpath:
if exp.startswith("location"):
exp = exp.replace("location", "rootpath", 1)
targets = targets or []
if ctx.attr.data != None:
targets.extend(ctx.attr.data)
return ctx.expand_location("$({})".format(exp), targets = targets)
Expand All @@ -738,7 +739,7 @@ def _expand_nested_variable(ctx, additional_vars, exp, execpath = True, targets
fail("potentially unbounded recursion during expansion of {}".format(exp))
return exp

def _expand(ctx, expression, additional_make_variable_substitutions, execpath = True, targets = []):
def _expand(ctx, expression, additional_make_variable_substitutions, execpath = True, targets = None):
idx = 0
last_make_var_end = 0
result = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ py_test(
cc_test(
name = "cc_test",
srcs = ["main.cc"],
data = ["datafile.txt"],
dynamic_deps = ["foo_so"],
env = {
"ENV_GENDIR": "$(GENDIR)",
"ENV_LOCATION": "$(location :datafile.txt)",
},
features = ["-dynamic_link_test_srcs"],
deps = ["foo"],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello