Skip to content

Commit 80de6ea

Browse files
hvadehrarules_java Copybara
authored andcommitted
Add CI for testing rules_java with WORKSPACE only (no bzlmod)
PiperOrigin-RevId: 696033105 Change-Id: I01aeb15fe709244c9f2ea1200a23f1884f044fd5
1 parent db85b7f commit 80de6ea

4 files changed

Lines changed: 64 additions & 4 deletions

File tree

.bazelci/presubmit.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ tasks:
4444
- "@rules_java//java/..."
4545
test_targets:
4646
- "//:MyTest"
47+
ubuntu2004_integration_workspace:
48+
name: "Bazel 7.x Integration (WORKSPACE)"
49+
bazel: "7.4.0"
50+
platform: ubuntu2004
51+
working_directory: "test/repo"
52+
shell_commands:
53+
- sh setup.sh
54+
build_targets:
55+
- "//..."
56+
- "//:bin_deploy.jar"
57+
build_flags:
58+
- "--noenable_bzlmod"
59+
- "--enable_workspace"
60+
test_targets:
61+
- "//:MyTest"
62+
test_flags:
63+
- "--noenable_bzlmod"
64+
- "--enable_workspace"
4765
macos:
4866
name: "Bazel 7.x"
4967
bazel: "7.4.0"
@@ -71,6 +89,24 @@ tasks:
7189
- "@rules_java//java/..."
7290
test_targets:
7391
- "//:MyTest"
92+
ubuntu2004_integration_head_workspace:
93+
name: "Bazel@HEAD Integration (WORKSPACE)"
94+
bazel: "last_green"
95+
platform: ubuntu2004
96+
working_directory: "test/repo"
97+
shell_commands:
98+
- sh setup.sh
99+
build_targets:
100+
- "//..."
101+
- "//:bin_deploy.jar"
102+
build_flags:
103+
- "--noenable_bzlmod"
104+
- "--enable_workspace"
105+
test_targets:
106+
- "//:MyTest"
107+
test_flags:
108+
- "--noenable_bzlmod"
109+
- "--enable_workspace"
74110
macos_head:
75111
name: "Bazel@HEAD"
76112
bazel: last_green
@@ -98,7 +134,8 @@ tasks:
98134
build_targets:
99135
- "//..."
100136
- "//:bin_deploy.jar"
101-
- "-//:MyTest"
137+
test_targets:
138+
- "//:MyTest"
102139
macos_bazel6:
103140
name: "Bazel 6.x"
104141
bazel: 6.3.0

WORKSPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ load("//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchain
4141

4242
rules_java_dependencies()
4343

44+
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility
45+
46+
proto_bazel_features(name = "proto_bazel_features")
47+
4448
rules_java_toolchains()
4549

4650
load("@stardoc//:setup.bzl", "stardoc_repositories")

java/repositories.bzl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ def protobuf_repo():
366366
maybe(
367367
http_archive,
368368
name = "com_google_protobuf",
369-
sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa",
370-
strip_prefix = "protobuf-27.0",
371-
url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz",
369+
sha256 = "ce5d00b78450a0ca400bf360ac00c0d599cc225f049d986a27e9a4e396c5a84a",
370+
strip_prefix = "protobuf-29.0-rc2",
371+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc2/protobuf-29.0-rc2.tar.gz",
372372
)
373373

374374
def rules_cc_repo():
@@ -439,23 +439,29 @@ load("@rules_java//java/bazel/rules:bazel_java_import.bzl", _java_import = "java
439439
load("@rules_java//java/bazel/rules:bazel_java_library.bzl", _java_library = "java_library") # copybara-use-repo-external-label
440440
load("@rules_java//java/bazel/rules:bazel_java_plugin.bzl", _java_plugin = "java_plugin") # copybara-use-repo-external-label
441441
load("@rules_java//java/bazel/rules:bazel_java_test.bzl", _java_test = "java_test") # copybara-use-repo-external-label
442+
load("@rules_java//java:http_jar.bzl", _http_jar = "http_jar") # copybara-use-repo-external-label
442443
443444
java_binary = _java_binary
444445
java_import = _java_import
445446
java_library = _java_library
446447
java_plugin = _java_plugin
447448
java_test = _java_test
449+
450+
http_jar = _http_jar
448451
""",
449452
)
450453
else:
451454
rctx.file(
452455
"proxy.bzl",
453456
"""
457+
load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_jar = "http_jar")
454458
java_binary = native.java_binary
455459
java_import = native.java_import
456460
java_library = native.java_library
457461
java_plugin = native.java_plugin
458462
java_test = native.java_test
463+
464+
http_jar = _http_jar
459465
""",
460466
)
461467

test/repo/WORKSPACE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
workspace(name = "integration_test_repo")
2+
13
local_repository(
24
name = "rules_java",
35
path = "../../",
@@ -7,4 +9,15 @@ load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_jav
79

810
rules_java_dependencies()
911

12+
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility
13+
14+
proto_bazel_features(name = "proto_bazel_features")
15+
1016
rules_java_toolchains()
17+
18+
load("@compatibility_proxy//:proxy.bzl", "http_jar")
19+
20+
http_jar(
21+
name = "my_jar",
22+
urls = ["file:///tmp/my_jar.jar"],
23+
)

0 commit comments

Comments
 (0)