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: *_test rule $(location) expansion bad for data-deps [duplicate of #3881] #4171
Description of the problem / feature request / question:
Some *_test rules support $(location) expansion for their prerequisites (srcs, data, maybe more).
For data dependencies, the expansion should yield the absolute path of the runfile, not the runfiles-root-relative path, because Bazel doesn't create a runfiles tree on Windows.
This breaks classpath flags in java_test.jvm_flags for example.
If possible, provide a minimal example to reproduce the problem:
C:\work\bazel>type foo\BUILD
java_binary(
name = "foo",
srcs = ["Foo.java"],
main_class = "Foo",
jvm_flags = ["-Dfoo.bar=$(location @bazel_tools//third_party/java/jdk/langtools:javac)"],
data = ["@bazel_tools//third_party/java/jdk/langtools:javac"],
)
C:\work\bazel>type foo\Foo.java
public class Foo {
public static void main(String[] args) {
System.out.println("hello");
System.out.println("foo.bar=" + System.getProperty("foo.bar"));
}
}
C:\work\bazel>bazel run //foo
INFO: Found 1 target...
Target //foo:foo up-to-date:
C:/users/laszlocsomor/appdata/local/temp/_bazel_laszlocsomor/o6hbs7n0/execroot/io_bazel/bazel-out/msvc_x64-fastbuild/bin/foo/foo.jar
C:/users/laszlocsomor/appdata/local/temp/_bazel_laszlocsomor/o6hbs7n0/execroot/io_bazel/bazel-out/msvc_x64-fastbuild/bin/foo/foo.exe
INFO: Elapsed time: 0.641s, Critical Path: 0.01s
INFO: Running command line: C:/users/laszlocsomor/appdata/local/temp/_bazel_laszlocsomor/o6hbs7n0/execroot/io_bazel/bazel-out/msvc_x64-fastbuild/bin/foo/foo.exe
hello
foo.bar=external/bazel_tools/third_party/java/jdk/langtools/javac-9-dev-r4023-3.jar
Environment info
Operating System:
Windows 10
Bazel version (output of bazel info release):
0.7.0
Have you found anything relevant by searching the web?
changed the title [-]Windows: *_test rule $(location) expansion bad for data-deps[/-][+]Windows: *_test rule $(location) expansion bad for data-deps [duplicate of #3881][/+]on Mar 28, 2018
Activity
refactor: add LocationExpander factories
laszlocsomor commentedon Nov 30, 2017
duplicate of #3881
laszlocsomor commentedon Dec 13, 2017
Dropping to P2 because this is a prerequisite to #4292 which is currently also P2.
[-]Windows: *_test rule $(location) expansion bad for data-deps[/-][+]Windows: *_test rule $(location) expansion bad for data-deps [duplicate of #3881][/+]laszlocsomor commentedon Mar 28, 2018
Duplicate of #4171
refactor: add LocationExpander factories