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

Allow rustc env vars to be set in files #556

Merged
merged 2 commits into from
Feb 18, 2021

Conversation

illicitonion
Copy link
Collaborator

Build scripts are executed in the exec configuration, not the target
configuration, which means it's currently impossible to use values which
were generated as a result of the --stamp flag when creating a
rust_binary. This means that embedding things like build timestamps,
git shas, and dynamic version numbers, is impossible.

This change allows you to depend, in the target configuration (because
no transition occurs on the attribute) on the output of a genrule which
consumes data from the stable and volatile workspace status commands.

@google-cla google-cla bot added the cla: yes label Jan 21, 2021
@illicitonion illicitonion force-pushed the rustc_env_file branch 2 times, most recently from 2b436fa to a31ef26 Compare January 22, 2021 13:26
Base automatically changed from master to main January 28, 2021 20:47
examples/hello_env/BUILD Outdated Show resolved Hide resolved
examples/hello_env/BUILD Outdated Show resolved Hide resolved
examples/hello_env/output_test.sh Outdated Show resolved Hide resolved
rust/private/rustc.bzl Show resolved Hide resolved
@hlopko
Copy link
Member

hlopko commented Feb 3, 2021

Oh we actually already have a test directory..

@illicitonion illicitonion force-pushed the rustc_env_file branch 2 times, most recently from b9b7c3a to ff47cf3 Compare February 3, 2021 15:04
Copy link
Member

@hlopko hlopko left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Build scripts are executed in the exec configuration, not the target
configuration, which means it's currently impossible to use values which
were generated as a result of the `--stamp` flag when creating a
`rust_binary`. This means that embedding things like build timestamps,
git shas, and dynamic version numbers, is impossible.

This change allows you to depend, in the target configuration (because
no transition occurs on the attribute) on the output of a genrule which
consumes data from the stable and volatile workspace status commands.
@illicitonion illicitonion merged commit fee3b3c into bazelbuild:main Feb 18, 2021
@illicitonion illicitonion deleted the rustc_env_file branch February 18, 2021 16:13
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

2 participants