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: *_test rule $(location) expansion bad for data-deps [duplicate of #3881] #4171

Closed
laszlocsomor opened this Issue Nov 27, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@laszlocsomor
Copy link
Contributor

laszlocsomor commented Nov 27, 2017

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?

Related to #4165.

@laszlocsomor laszlocsomor self-assigned this Nov 27, 2017

bazel-io pushed a commit that referenced this issue Nov 28, 2017

refactor: add LocationExpander factories
Stop using LocationExpander.Options in
LocationExpander constructors, because the Options
semantics are confusing.

I also need the refactoring in order to extend the
expansion semantics: to support expanding to
absolute paths on Windows, where $(location)
should not expand to the (non-existent) runfiles
path, but to the absolute path the runfiles
symlink would point to.

See #4171

Change-Id: Ie4d47ec3807bc3c6e39156efa1746b666f69f99c
PiperOrigin-RevId: 177147372
@laszlocsomor

This comment has been minimized.

Copy link
Contributor

laszlocsomor commented Nov 30, 2017

duplicate of #3881

@laszlocsomor

This comment has been minimized.

Copy link
Contributor

laszlocsomor commented Dec 13, 2017

Dropping to P2 because this is a prerequisite to #4292 which is currently also P2.

duggelz pushed a commit to duggelz/bazel that referenced this issue Dec 15, 2017

refactor: add LocationExpander factories
Stop using LocationExpander.Options in
LocationExpander constructors, because the Options
semantics are confusing.

I also need the refactoring in order to extend the
expansion semantics: to support expanding to
absolute paths on Windows, where $(location)
should not expand to the (non-existent) runfiles
path, but to the absolute path the runfiles
symlink would point to.

See bazelbuild#4171

Change-Id: Ie4d47ec3807bc3c6e39156efa1746b666f69f99c
PiperOrigin-RevId: 177147372

@meteorcloudy meteorcloudy added P1 and removed P2 labels Dec 18, 2017

@laszlocsomor laszlocsomor changed the title Windows: *_test rule $(location) expansion bad for data-deps Windows: *_test rule $(location) expansion bad for data-deps [duplicate of #3881] Mar 28, 2018

@laszlocsomor

This comment has been minimized.

Copy link
Contributor

laszlocsomor commented Mar 28, 2018

Duplicate of #4171

@laszlocsomor laszlocsomor marked this as a duplicate of #4171 Mar 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment