-
Notifications
You must be signed in to change notification settings - Fork 10
Make runfiles.bash available via PATH in all sh_*() rules #24
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
Conversation
|
|
||
| run_environment_info = RunEnvironmentInfo( | ||
| environment = { | ||
| "RUNFILES_BIN": "../bin", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about appending this to $PATH here directly to avoid another line in the copyable snippet but I couldn't think of a good way to get the toolchain default $PATH to append to.
| # { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e | ||
| # # --- end runfiles.bash initialization v3 --- | ||
| # | ||
| # PATH=$PATH:$RUNFILES_BIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this work if the script is executed within an action, say a genrule? RunEnvironmentInfo only applies to bazel run, so this variable wouldn't be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to set action env somehow in the rule as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test to cover this use case?
Would it be enough to provide a reasonable default for this case like ${RUNFILES_BIN:-bin/runfiles.bash}?
This significantly simplifies the snippet which needs to be copied into every main script.
c585f02 to
4518418
Compare
This avoid the need to copy&paste the verbose initialization snippet into every script. This should resolve the issues raised in #24. --------- Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
|
Closing this in favor of #38. |
This significantly simplifies the snippet which needs to be copied into every main script.