Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include rustc deps when running build scripts #333

Merged
merged 1 commit into from
Jun 12, 2020
Merged
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
16 changes: 14 additions & 2 deletions cargo/cargo_build_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ def _cargo_build_script_run(ctx, script):
for f in ctx.attr.crate_features:
env["CARGO_FEATURE_" + f.upper().replace("-", "_")] = "1"

tools = depset(
damienmg marked this conversation as resolved.
Show resolved Hide resolved
direct = [
script,
ctx.executable._cargo_build_script_runner,
toolchain.rustc,
],
transitive = [
# Needed for rustc to function.
toolchain.rustc_lib.files,
toolchain.rust_lib.files,
],
)

ctx.actions.run(
executable = ctx.executable._cargo_build_script_runner,
arguments = [script.path, env_out.path, flags_out.path],
outputs = [out_dir, env_out, flags_out],
tools = [script, ctx.executable._cargo_build_script_runner],
inputs = [script, toolchain.rustc],
tools = tools,
mnemonic = "CargoBuildScriptRun",
env = env,
)
Expand Down