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

Windows, native launcher: sh_binary missing data dependencies #3839

Closed
laszlocsomor opened this issue Sep 29, 2017 · 3 comments
Closed

Windows, native launcher: sh_binary missing data dependencies #3839

laszlocsomor opened this issue Sep 29, 2017 · 3 comments
Assignees
Labels
category: misc > misc P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: windows type: feature request

Comments

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Sep 29, 2017

Description of the problem / feature request / question:

When using the native launcher, sh_binary rules miss their data dependencies.

If possible, provide a minimal example to reproduce the problem:

C:\work\bazel> bazel build //examples/shell:bin
(...)

C:\work\bazel> bazel-bin\examples\shell\bin.exe
C:/work/bazel/examples/shell/bin.sh: line 23: C:/work/bazel/examples/shell/bin.sh.runfiles/io_bazel/examples/shell/lib.sh: No such file or directory

Environment info

  • Operating System:
    Windows 10

  • Bazel version (output of bazel info release):
    0.6.0

@laszlocsomor laszlocsomor added platform: windows P1 I'll work on this now. (Assignee required) type: bug labels Sep 29, 2017
@laszlocsomor
Copy link
Contributor Author

Never mind, this is not a bug in the launcher, but in the example. I'll send a fix.

@laszlocsomor laszlocsomor self-assigned this Oct 5, 2017
@laszlocsomor
Copy link
Contributor Author

One possible fix is to define and use rlocation in the shell script. Another is for the launcher to source a script that defines rlocation, then run the main script. I have a pending change for the latter.

@laszlocsomor
Copy link
Contributor Author

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.

@laszlocsomor laszlocsomor added P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request windows-q1-2018-maybe and removed P1 I'll work on this now. (Assignee required) type: bug labels Dec 13, 2017
bazel-io pushed a commit that referenced this issue Jan 12, 2018
This is a prerequisite to port all tests to run on
Windows. It is also part of the effort to provide
platform-independent, language-specific
runfiles-handling libraries.

See:
- #4292
- #3839

Change-Id: Ic64aadcf3f97885de3151da9f921d6351687dce9
PiperOrigin-RevId: 181727511
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Jun 27, 2018
The targets in //examples/shell:* now use the Bash
runfiles library in
@bazel_tools//tools/bash/runfiles and work on
Windows.

Fixes bazelbuild#3839
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Jun 27, 2018
The targets in //examples/shell:* now use the Bash
runfiles library in
@bazel_tools//tools/bash/runfiles and work on
Windows.

Also undef the RUNFILES_* envvars in
bazel_example_test::test_shell (which builds the
shell example project) so that the runfiles
library discovers its own runfiles instead of
trying (and failing) to use the enclosing test's
runfiles (which it shouldn't use, because the test
executes "bazel run //examples/shell:bin" so that
target's runfiles are independent of the enclosing
test's runfiles).

Fixes bazelbuild#3839

Fix bazel_example_test: undef RUNFILES_* envvars

Change-Id: I44f9bf9b11f7fac0e1c0995a44c2336846dc2bc8
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Jun 27, 2018
The targets in //examples/shell:* now use the Bash
runfiles library in
@bazel_tools//tools/bash/runfiles and work on
Windows.

Also undef the RUNFILES_* envvars in
bazel_example_test::test_shell (which builds the
shell example project) so that the runfiles
library discovers its own runfiles instead of
trying (and failing) to use the enclosing test's
runfiles (which it shouldn't use, because the test
executes "bazel run //examples/shell:bin" so that
target's runfiles are independent of the enclosing
test's runfiles).

Fixes bazelbuild#3839

Change-Id: I44f9bf9b11f7fac0e1c0995a44c2336846dc2bc8
werkt pushed a commit to werkt/bazel that referenced this issue Aug 2, 2018
The targets in //examples/shell:* now use the Bash
runfiles library in
@bazel_tools//tools/bash/runfiles and work on
Windows.

Also undef the RUNFILES_* envvars in
bazel_example_test::test_shell (which builds the
shell example project) so that the runfiles
library discovers its own runfiles instead of
trying (and failing) to use the enclosing test's
runfiles (which it shouldn't use, because the test
executes "bazel run //examples/shell:bin" so that
target's runfiles are independent of the enclosing
test's runfiles).

Fixes bazelbuild#3839

Closes bazelbuild#5480.

Change-Id: I44f9bf9b11f7fac0e1c0995a44c2336846dc2bc8
PiperOrigin-RevId: 202313105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: misc > misc P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: windows type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants