Windows,examples: //examples/shell now works 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 https://github.com/bazelbuild/bazel/issues/3839 Closes #5480. Change-Id: I44f9bf9b11f7fac0e1c0995a44c2336846dc2bc8 PiperOrigin-RevId: 202313105
diff --git a/examples/shell/BUILD b/examples/shell/BUILD index 4b51df1..095cea4 100644 --- a/examples/shell/BUILD +++ b/examples/shell/BUILD
@@ -3,7 +3,10 @@ sh_binary( name = "bin", srcs = ["bin.sh"], - deps = [":lib"], + deps = [ + ":lib", + "@bazel_tools//tools/bash/runfiles", + ], ) sh_library( @@ -12,6 +15,7 @@ "data/file.txt", "lib.sh", ], + deps = ["@bazel_tools//tools/bash/runfiles"], ) sh_test( @@ -19,7 +23,10 @@ size = "small", srcs = ["test.sh"], data = ["data/test_file.txt"], - deps = [":lib"], + deps = [ + ":lib", + "@bazel_tools//tools/bash/runfiles", + ], ) filegroup(