Add CI for testing rules_java with WORKSPACE only (no bzlmod) PiperOrigin-RevId: 696033105 Change-Id: I01aeb15fe709244c9f2ea1200a23f1884f044fd5
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 78e1d50..be62c01 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml
@@ -44,6 +44,24 @@ - "@rules_java//java/..." test_targets: - "//:MyTest" + ubuntu2004_integration_workspace: + name: "Bazel 7.x Integration (WORKSPACE)" + bazel: "7.4.0" + platform: ubuntu2004 + working_directory: "test/repo" + shell_commands: + - sh setup.sh + build_targets: + - "//..." + - "//:bin_deploy.jar" + build_flags: + - "--noenable_bzlmod" + - "--enable_workspace" + test_targets: + - "//:MyTest" + test_flags: + - "--noenable_bzlmod" + - "--enable_workspace" macos: name: "Bazel 7.x" bazel: "7.4.0" @@ -71,6 +89,24 @@ - "@rules_java//java/..." test_targets: - "//:MyTest" + ubuntu2004_integration_head_workspace: + name: "Bazel@HEAD Integration (WORKSPACE)" + bazel: "last_green" + platform: ubuntu2004 + working_directory: "test/repo" + shell_commands: + - sh setup.sh + build_targets: + - "//..." + - "//:bin_deploy.jar" + build_flags: + - "--noenable_bzlmod" + - "--enable_workspace" + test_targets: + - "//:MyTest" + test_flags: + - "--noenable_bzlmod" + - "--enable_workspace" macos_head: name: "Bazel@HEAD" bazel: last_green @@ -98,7 +134,8 @@ build_targets: - "//..." - "//:bin_deploy.jar" - - "-//:MyTest" + test_targets: + - "//:MyTest" macos_bazel6: name: "Bazel 6.x" bazel: 6.3.0
diff --git a/WORKSPACE b/WORKSPACE index cbe4e80..49422df 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -41,6 +41,10 @@ rules_java_dependencies() +load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility + +proto_bazel_features(name = "proto_bazel_features") + rules_java_toolchains() load("@stardoc//:setup.bzl", "stardoc_repositories")
diff --git a/java/repositories.bzl b/java/repositories.bzl index 3186211..60f94ef 100644 --- a/java/repositories.bzl +++ b/java/repositories.bzl
@@ -366,9 +366,9 @@ maybe( http_archive, name = "com_google_protobuf", - sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", - strip_prefix = "protobuf-27.0", - url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", + sha256 = "ce5d00b78450a0ca400bf360ac00c0d599cc225f049d986a27e9a4e396c5a84a", + strip_prefix = "protobuf-29.0-rc2", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc2/protobuf-29.0-rc2.tar.gz", ) def rules_cc_repo(): @@ -439,23 +439,29 @@ load("@rules_java//java/bazel/rules:bazel_java_library.bzl", _java_library = "java_library") # copybara-use-repo-external-label load("@rules_java//java/bazel/rules:bazel_java_plugin.bzl", _java_plugin = "java_plugin") # copybara-use-repo-external-label load("@rules_java//java/bazel/rules:bazel_java_test.bzl", _java_test = "java_test") # copybara-use-repo-external-label +load("@rules_java//java:http_jar.bzl", _http_jar = "http_jar") # copybara-use-repo-external-label java_binary = _java_binary java_import = _java_import java_library = _java_library java_plugin = _java_plugin java_test = _java_test + +http_jar = _http_jar """, ) else: rctx.file( "proxy.bzl", """ +load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_jar = "http_jar") java_binary = native.java_binary java_import = native.java_import java_library = native.java_library java_plugin = native.java_plugin java_test = native.java_test + +http_jar = _http_jar """, )
diff --git a/test/repo/WORKSPACE b/test/repo/WORKSPACE index c961444..c4f22a6 100644 --- a/test/repo/WORKSPACE +++ b/test/repo/WORKSPACE
@@ -1,3 +1,5 @@ +workspace(name = "integration_test_repo") + local_repository( name = "rules_java", path = "../../", @@ -7,4 +9,15 @@ rules_java_dependencies() +load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility + +proto_bazel_features(name = "proto_bazel_features") + rules_java_toolchains() + +load("@compatibility_proxy//:proxy.bzl", "http_jar") + +http_jar( + name = "my_jar", + urls = ["file:///tmp/my_jar.jar"], +)