Skip to content

Commit 8f0ee2e

Browse files
committed
Use {}s around env vars
1 parent 6cfa523 commit 8f0ee2e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cargo/cargo_build_script_runner/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl BuildScriptOutput {
162162
}
163163
CompileAndLinkFlags {
164164
compile_flags: compile_flags.join(" "),
165-
link_flags: link_flags.join(" ").replace(exec_root, "$EXEC_ROOT"),
165+
link_flags: link_flags.join(" ").replace(exec_root, "${EXEC_ROOT}"),
166166
}
167167
}
168168
}
@@ -216,7 +216,7 @@ cargo:version_number=1010107f
216216
// -Lblah was output as a rustc-flags, so even though it probably _should_ be a link
217217
// flag, we don't treat it like one.
218218
compile_flags: "-Lblah --cfg=feature=awesome".to_owned(),
219-
link_flags: "-lsdfsdf -L$EXEC_ROOT/bleh".to_owned(),
219+
link_flags: "-lsdfsdf -L${EXEC_ROOT}/bleh".to_owned(),
220220
}
221221
);
222222
}

rust/private/rustc.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def construct_arguments(
375375
# `exec_root`. Since we cannot (seemingly) get the `exec_root` from skylark, we cheat a little
376376
# and use `$(pwd)` which resolves the `exec_root` at action execution time.
377377
package_dir = ctx.build_file_path[:ctx.build_file_path.rfind("/")]
378-
dynamic_env["CARGO_MANIFEST_DIR"] = "$EXEC_ROOT/{}".format(package_dir)
378+
dynamic_env["CARGO_MANIFEST_DIR"] = "${{EXEC_ROOT}}/{}".format(package_dir)
379379

380380
return args, env, dynamic_env
381381

@@ -408,7 +408,7 @@ def construct_compile_command(
408408
if src != dst:
409409
maybe_rename = " && /bin/mv {src} {dst}".format(src=src, dst=dst)
410410

411-
# Set $EXEC_ROOT so that actions which chdir still work.
411+
# Set ${EXEC_ROOT} so that actions which chdir still work.
412412
# See https://github.com/google/cargo-raze/issues/71#issuecomment-433225853 for the rationale as
413413
# to why.
414414
return 'export EXEC_ROOT=$(pwd) && {} && {} "$@" --remap-path-prefix="$(pwd)"=__bazel_redacted_pwd {}{}'.format(
@@ -533,19 +533,19 @@ def _create_out_dir_action(ctx, file, build_info, dep_info):
533533
if build_info:
534534
prep_commands.append("export $(cat %s)" % build_info.rustc_env.path)
535535
# out_dir will be added as input by the transitive_build_infos loop below.
536-
dynamic_env["OUT_DIR"] = "$EXEC_ROOT/{}".format(build_info.out_dir.path)
536+
dynamic_env["OUT_DIR"] = "${{EXEC_ROOT}}/{}".format(build_info.out_dir.path)
537537
dynamic_build_flags.append("$(cat '%s')" % build_info.flags.path)
538538
elif tar_file_attr:
539539
out_dir = ".out-dir"
540540
prep_commands.append("mkdir -p $OUT_DIR")
541541
prep_commands.append("tar -xzf {tar} -C $OUT_DIR".format(tar=tar_file_attr.path))
542542
input_files.append(tar_file_attr)
543-
dynamic_env["OUT_DIR"] = "$EXEC_ROOT/{}".format(out_dir)
543+
dynamic_env["OUT_DIR"] = "${{EXEC_ROOT}}/{}".format(out_dir)
544544

545545
# This should probably only actually be exposed to actions which link.
546546
for dep_build_info in dep_info.transitive_build_infos.to_list():
547547
input_files.append(dep_build_info.out_dir)
548-
dynamic_build_flags.append("$(cat '{}' | sed -e \"s#\$EXEC_ROOT#$EXEC_ROOT#g\")".format(dep_build_info.link_flags.path))
548+
dynamic_build_flags.append("$(cat '{}' | sed -e \"s#\${{EXEC_ROOT}}#${{EXEC_ROOT}}#g\")".format(dep_build_info.link_flags.path))
549549
input_files.append(dep_build_info.link_flags)
550550

551551
return input_files, prep_commands, dynamic_env, dynamic_build_flags

0 commit comments

Comments
 (0)