You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows, native launcher: sh_binary doesn't have rlocation #3865
Not actually, because when you run the binary alone, test-setup.sh won't be executed at all, right?
I am thinking about adding a library under @bazel_tools, which provides rlocation function for Java/Python/Bash/C++, so that users can just depend on it and don't have to write their own. WDYT?
I'm making this P3 with the same justification as I gave on #3839:
This bug directly influences the usability of sh_* rules on Windows.
I'd like Bazel to treat shell scripts as just another language like Python, and to require Bash only if the targets depend on sh_* rules.
I'm making this P3 for now, because I believe other languages are more important on Windows and the practical limitation with a sub-par support for sh_* rules is that we can't use them to implement build-aiding tools as easily as we can on Linux.
The sh_binary on non-Windows uses no launcher, so there's nothing to load whatever defines rlocation. If users want to write platform-independent sh_* rules, they'll need to source the rlocation-defining library manually (copy-pasting the code to do so from the runfiles library itself).
Automatically sourcing the file on Windows encourages writing non-portable Bash scripts, and is unnecessary if the scripts will have the copy-pasted initializer code anyway.
Activity
laszlocsomor commentedon Oct 5, 2017
/cc @meteorcloudy
laszlocsomor commentedon Oct 9, 2017
Fixing this bug makes fixing #3839 trivial.
meteorcloudy commentedon Oct 9, 2017
Not actually, because when you run the binary alone,
test-setup.shwon't be executed at all, right?I am thinking about adding a library under @bazel_tools, which provides rlocation function for Java/Python/Bash/C++, so that users can just depend on it and don't have to write their own. WDYT?
laszlocsomor commentedon Oct 9, 2017
That's similar to what I did in my pending change that fixes this issue. I'll send it to you for review soon.
meteorcloudy commentedon Oct 9, 2017
Great, thanks!
laszlocsomor commentedon Oct 9, 2017
Actually, I like your idea more than my own! Let me accommodate that in my CL.
laszlocsomor commentedon Oct 9, 2017
For the record, this was my approach: https://bazel-review.googlesource.com/c/bazel/+/18250 .
laszlocsomor commentedon Dec 13, 2017
I'm making this P3 with the same justification as I gave on #3839:
laszlocsomor commentedon May 2, 2018
I'm closing this bug as obsolete.
The sh_binary on non-Windows uses no launcher, so there's nothing to load whatever defines
rlocation. If users want to write platform-independent sh_* rules, they'll need to source the rlocation-defining library manually (copy-pasting the code to do so from the runfiles library itself).Automatically sourcing the file on Windows encourages writing non-portable Bash scripts, and is unnecessary if the scripts will have the copy-pasted initializer code anyway.