bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
360 stars 273 forks source link

@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl can't find java.exe on windows #1497

Closed crazyjat closed 1 year ago

crazyjat commented 1 year ago

I have a simple BUILD.bazel file that I want to create a scrooge library from a thrift file.

BUILD.bazel

load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library")
load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "scrooge_scala_library")

thrift_library(
    name = "thrift",
    srcs = ["src/main/thrift/test.thrift"],
)

scrooge_scala_library(
    name = "scrooge",
    visibility = ["//visibility:public"],
    deps = [":thrift"],
)

test.thrift

namespace java foo.bar.generated.thrift

struct Test {
    1: string label
    2: string name
    3: binary data
}

This generates the following error:

D:\dev\test>bazel build //my-project/my-project-thrift:scrooge
INFO: Analyzed target //my-project/my-project-thrift:scrooge (1 packages loaded, 3 targets configured).
INFO: Found 1 target...
ERROR: D:/dev/test/my-project/my-project-thrift/BUILD.bazel:4:15: creating scrooge files //my-project/my-project-thrift:thrift failed: Worker process did not return a WorkResponse:

---8<---8<--- Start of log, file at C:/users/foo/_bazel_foo/e3seslld/bazel-workers/worker-18-ScroogeRule.log ---8<---8<---
LAUNCHER ERROR: Rlocation failed on external\remotejdk11_win\bin\java.exe, path doesn't exist in MANIFEST file
---8<---8<--- End of log ---8<---8<---
Target //my-project/my-project-thrift:scrooge failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.087s, Critical Path: 0.65s
INFO: 4 processes: 3 internal, 1 local.
FAILED: Build did NOT complete successfully
crt-31 commented 1 year ago

I believe the is caused by the java_bin_path variable being set incorrrectly on Windows. I have a fix I'll submit as PR soon. This fix makes your example work correctly on my machine.