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

Support CARGO_BIN_EXE env vars #322

Merged
merged 2 commits into from
Jun 2, 2020

Conversation

illicitonion
Copy link
Collaborator

Since 1.43 cargo will set CARGO_BIN_EXE-prefixed env vars for each binary your crate depends on, so you can access them in integration tests.

Also, output binary names with the same name as the target, rather than replacing -s with _s, to better emulate how Cargo works.

dst = crate_info.output.path
if src != dst:
maybe_rename = " && /bin/mv {src} {dst}".format(src=src, dst=dst)
command = '{manifest_dir_env}{out_dir_env}{rustc} "$@" --remap-path-prefix="$(pwd)"=__bazel_redacted_pwd{maybe_rename}'.format(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is long, maybe use a triple quoted string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted away from the the fstring-like templates

rust/private/rustc.bzl Show resolved Hide resolved
This emulate's Cargo's behavior.

Unfortunately just setting -o instead of --out-dir warns with the following
(even if only one output is being built):
```
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type
```
@damienmg damienmg merged commit cd73f34 into bazelbuild:master Jun 2, 2020
@damienmg
Copy link
Collaborator

damienmg commented Jun 2, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants