Skip to content

Commit 5ecfe95

Browse files
authored
Replace bazel_worker_java with bazel_worker_api (#1762)
Duplicates `@bazel_worker_java//:worker_protocol_java_proto` to avoid `bazel_worker_java` using `rules_jvm_external` to update `@maven` dependencies: - bazelbuild/bazel-worker-api#7 (comment). Also updates `exclude_patterns` in `//tools` to ignore all dotfile directories. --- `rules_scala` doesn't need anything else from `@bazel_worker_java`, so this sidesteps the issue. The `.bazelbsp` directory generated by VS Code started producing errors from `./test_lint.sh`, precipitating the `exclude_patterns` changes.
1 parent 3011958 commit 5ecfe95

File tree

7 files changed

+20
-14
lines changed

7 files changed

+20
-14
lines changed

MODULE.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ single_version_override(
6666
version = "32.0",
6767
)
6868

69-
bazel_dep(name = "bazel_worker_java", version = "0.0.6")
69+
# See //src/java/io/bazel/rulesscala/worker:worker_protocol_java_proto.
70+
bazel_dep(name = "bazel_worker_api", version = "0.0.6")
7071

7172
scala_protoc = use_extension(
7273
"//scala/extensions:protoc.bzl",

scala/private/macros/workspace_compat.bzl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1010
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
1111

1212
def _bazel_worker_api_repo(name, strip_prefix):
13+
"""See //src/java/io/bazel/rulesscala/worker:worker_protocol_java_proto."""
1314
maybe(
1415
http_archive,
1516
name = name,
@@ -25,8 +26,3 @@ def workspace_compat():
2526
name = "bazel_worker_api",
2627
strip_prefix = "proto",
2728
)
28-
29-
_bazel_worker_api_repo(
30-
name = "bazel_worker_java",
31-
strip_prefix = "java",
32-
)

src/java/io/bazel/rulesscala/coverage/instrumenter/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ java_binary(
1616
"//src/java/io/bazel/rulesscala/jar",
1717
"//src/java/io/bazel/rulesscala/worker",
1818
"@bazel_tools//tools/jdk:JacocoCoverage",
19-
"@bazel_worker_java//:worker_protocol_java_proto",
2019
],
2120
)
2221

src/java/io/bazel/rulesscala/scalac/definitions.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ DEFAULT_SCALAC_DEPS = [
1111
"//src/protobuf/io/bazel/rules_scala:diagnostics_java_proto",
1212
"//src/java/io/bazel/rulesscala/scalac/compileoptions",
1313
"//src/java/io/bazel/rulesscala/scalac/reporter",
14-
"@bazel_worker_java//:worker_protocol_java_proto",
1514
]
1615
]
1716

src/java/io/bazel/rulesscala/worker/BUILD

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
12
load("@rules_java//java:defs.bzl", "java_library", "java_test")
23

34
java_library(
45
name = "worker",
56
srcs = ["Worker.java"],
67
visibility = ["//visibility:public"],
78
deps = [
8-
"@bazel_worker_java//:worker_protocol_java_proto",
9+
":worker_protocol_java_proto",
910
],
1011
)
1112

@@ -20,6 +21,16 @@ java_test(
2021
test_class = "io.bazel.rulesscala.worker.WorkerTest",
2122
deps = [
2223
":worker",
23-
"@bazel_worker_java//:worker_protocol_java_proto",
24+
":worker_protocol_java_proto",
2425
],
2526
)
27+
28+
# Duplicated from @bazel_worker_java//:worker_protocol_java_proto to resolve:
29+
# https://github.com/bazelbuild/bazel-worker-api/issues/7#issuecomment-3209882184
30+
#
31+
# rules_scala doesn't need anything else from @bazel_worker_java, so this
32+
# sidesteps the issue.
33+
java_proto_library(
34+
name = "worker_protocol_java_proto",
35+
deps = ["@bazel_worker_api//:worker_protocol_proto"],
36+
)

test/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ scala_specs2_junit_test(
476476
name = "data_location_expansion",
477477
size = "small",
478478
srcs = ["src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala"],
479-
data = ["@bazel_worker_java//:worker_protocol_java_proto"],
480-
jvm_flags = ["-Dlocation.expanded='$(rootpaths @bazel_worker_java//:worker_protocol_java_proto)'"],
479+
data = ["//src/java/io/bazel/rulesscala/worker"],
480+
jvm_flags = ["-Dlocation.expanded='$(rootpaths //src/java/io/bazel/rulesscala/worker)'"],
481481
suffixes = ["Test"],
482482
)
483483

tools/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WARNINGS_CONFIG = [
2323
buildifier_test(
2424
name = "lint_check",
2525
exclude_patterns = [
26-
"./.ijwb/*",
26+
".*",
2727
],
2828
lint_mode = "warn",
2929
lint_warnings = WARNINGS_CONFIG,
@@ -35,7 +35,7 @@ buildifier_test(
3535
buildifier(
3636
name = "lint_fix",
3737
exclude_patterns = [
38-
"./.ijwb/*",
38+
".*",
3939
],
4040
lint_mode = "fix",
4141
lint_warnings = WARNINGS_CONFIG,

0 commit comments

Comments
 (0)