Skip to content

Windows: *_test rule $(location) expansion bad for data-deps [duplicate of #3881] #4171

Closed

Description

@laszlocsomor

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.

Activity

  1. self-assigned this
    on Nov 27, 2017
  2. added
    P1
    on Nov 27, 2017
  3. laszlocsomor commented on Nov 30, 2017

    @laszlocsomor
    ContributorAuthor

    duplicate of #3881

  4. laszlocsomor commented on Dec 13, 2017

    @laszlocsomor
    ContributorAuthor

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

  5. added
    P2
    and removed
    P1
    on Dec 13, 2017
  6. added
    P1
    and removed
    P2
    on Dec 18, 2017
  7. 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
  8. laszlocsomor commented on Mar 28, 2018

    @laszlocsomor
    ContributorAuthor

    Duplicate of #4171

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

Metadata

Metadata

Assignees

Labels

P1category: misc > miscplatform: windowstype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions