From 2917098aa7339aa1ecdfe5a51e0cc11444c55a80 Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Fri, 29 Nov 2024 18:18:31 -0500 Subject: [PATCH] Move `rules_scala_dependencies` to scala/deps.bzl Moves `rules_scala_dependencies` to `scala/deps.bzl` and bumps several dependencies as high as they can go and still be compatible with Bazel 6.5.0 and 7.4.1. - `bazel_skylib`: 1.4.1 => 1.7.1 - `go`: 1.19.5 => 1.23.4 - `rules_cc`: 0.0.6 => 0.0.9 - `rules_go`: 0.39.1 => 0.50.1 - `rules_java`: 7.9.0 => 7.12.3 - `rules_python`: 0.36.0 => 0.38.0 The `rules_java` 7.12.13 bump precipitated the following changes: - Adds the `WORKSPACE` stanza for `rules_java` in every `WORKSPACE` file per https://github.com/bazelbuild/rules_java/releases/tag/7.12.3. This replaces previous calls to instantiate `rules_java` repos and to register `rules_java` toolchains. - Rearranges the other `WORKSPACE` setup macros for dependencies to come before the `rules_scala` setup macros. - Updates almost all dependencies on `@bazel_tools//tools/jdk:` toolchain targets and `.bzl` files to corresponding targets and files in `@rules_java//toolchains:`. - Removes several deprecated flags from the `scrooge_compile_with_jdk_11` test case from `test/shell/test_twitter_scrooge.sh`, and one obsolete flag that caused it to break. --- Moving `rules_scala_dependencies` to `scala/deps.bzl` ensures we get all the versions of dependencies we want in `WORKSPACE`, while providing a new API to consumers. It also prevents `WORKSPACE` from transitively loading any `.bzl` files that load `@rules_java`, ensuring Bazel 8 compatibility per #1652. Reasons for the other `rules_java` related changes include: - The `WORKSPACE` stanza for `rules_java` should've already been present while using the existing version 7.9.0. However, doing so would've broken Bazel 6 builds, as described in detail below. - Having the other `WORKSPACE` setup macros for dependencies come before the `rules_scala` setup macros helps ensure consistent, correct initialization before `rules_scala` initialization. - Updating the toolchain specifiers to use `@rules_java//toolchains` fixed `WORKSPACE` build breakages when updating to `rules_java` 7.10.0 and later. This is a potentially breaking change for consumers, but in the good kind of way, in that it requires an easy, futureproof update. (`@bazel_tools//tools/jdk:toolchain_type` dependencies remain, as there's not yet a corresponding `@rules_java//toolchains` target.) What follows are detailed notes on why some dependency versions are capped where they are, and on some breakages fixed by these changes. --- `abseil-cpp` and `protobuf` have to stay at 20220623.1 and v21.7, respectively, for Bazel 6 compatibility per #1647. `protobuf` up to v25.5 is compatible with Bazel 6 provided users set the compiler flags mentioned in that issue: ```txt build:linux --cxxopt=-std=c++17 build:linux --host_cxxopt=-std=c++17 build:macos --cxxopt=-std=c++17 build:macos --host_cxxopt=-std=c++17 build:windows --cxxopt=/std=c++17 build:windows --host_cxxopt=/std=c++17 ``` --- `rules_python` 0.38.0 => 0.39.0 requires at least `rules_cc` 0.0.10, which introduced `cc/common/cc_info.bzl`: ```txt $ bazel build //{src,test,third_party,scala_proto}/... [ ...snip... ] ERROR: error loading package under directory 'test': error loading package 'test': at .../external/rules_python/python/defs.bzl:17:6: at .../external/rules_python/python/py_binary.bzl:18:6: at .../external/rules_python/python/private/py_binary_macro.bzl:16:6: at .../external/rules_python/python/private/common_bazel.bzl:19:6: Label '@rules_cc//cc/common:cc_info.bzl' is invalid because 'cc/common' is not a package; perhaps you meant to put the colon here: '@rules_cc//cc:common/cc_info.bzl'? ``` However, `rules_cc` 0.0.9 => 0.0.10 requires Bazel 7, which defines `CcSharedLibraryHintInfo`: ```txt $ bazel build //{src,test,third_party,scala_proto}/... ERROR: .../external/rules_cc/cc/private/rules_impl/native.bzl:40:33: name 'CcSharedLibraryHintInfo' is not defined (did you mean 'CcSharedLibraryInfo'?) [ ...snip... ] ERROR: error loading package under directory 'test': error loading package 'test': at .../external/rules_python/python/defs.bzl:17:6: at .../external/rules_python/python/py_binary.bzl:18:6: at .../external/rules_python/python/private/py_binary_macro.bzl:16:6: at .../external/rules_python/python/private/common_bazel.bzl:18:6: at .../external/rules_cc/cc/common/cc_common.bzl:17:6: compilation of module 'cc/private/rules_impl/native.bzl' failed ``` --- This section provides a methodical description of the errors encountered and resolved during each step of the `rules_java` update. The proper `WORKSPACE` setup stanza for `rules_java`, which we didn't originally have in place, is: ```py load( "@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains", ) rules_java_dependencies() rules_java_toolchains() ``` Adding this stanza to `WORKSPACE` while still using `rules_java` 7.9.0 didn't break the Bazel 7.4.1 build, but it broke the Bazel 6.5.0 build. Note the `CompiledWithJava{8,11}_java.jar` references: ```txt $ bazel build //{src,test,third_party,scala_proto}/... [ ...snip... ] ERROR: .../test/src/main/resources/java_sources/BUILD:5:14: Building test/src/main/resources/java_sources/CompiledWithJava8_java.jar (1 source file) failed: Worker process did not return a WorkResponse: ---8<---8<--- Start of log, file at .../bazel-workers/multiplex-worker-18-Javac.log ---8<---8<--- Error thrown by worker thread, shutting down worker. java.lang.NoSuchMethodError: 'java.lang.Iterable com.google.devtools.build.buildjar.javac.BlazeJavacMain$ClassloaderMaskingFileManager.getJavaFileObjectsFromPaths(java.util.Collection)' at com.google.devtools.build.buildjar.javac.BlazeJavacMain.compile(BlazeJavacMain.java:142) [ ...snip... ] ---8<---8<--- End of log ---8<---8<--- ERROR: .../test/src/main/resources/java_sources/BUILD:11:14: Building test/src/main/resources/java_sources/CompiledWithJava11_java.jar (1 source file) failed: Worker process did not return a WorkResponse: ---8<---8<--- Start of log, file at .../bazel-workers/multiplex-worker-18-Javac.log ---8<---8<--- Error thrown by worker thread, shutting down worker. java.lang.NoSuchMethodError: 'java.lang.Iterable com.google.devtools.build.buildjar.javac.BlazeJavacMain$ClassloaderMaskingFileManager.getJavaFileObjectsFromPaths(java.util.Collection)' at com.google.devtools.build.buildjar.javac.BlazeJavacMain.compile(BlazeJavacMain.java:142) [ ...snip... ] ---8<---8<--- End of log ---8<---8<--- ``` Another variation of this I also saw was: ```txt $ bazel build //{src,jmh,test,third_party,scala_proto}/... [ ...snip... ] ERROR: test/src/main/resources/java_sources/BUILD:11:14: Building test/src/main/resources/java_sources/CompiledWithJava11_java.jar (1 source file) failed: Worker process did not return a WorkResponse: ---8<---8<--- Start of log, file at .../bazel-workers/multiplex-worker-33-Javac.log ---8<---8<--- Error thrown by worker thread, shutting down worker. java.lang.UnsupportedClassVersionError: com/google/errorprone/ErrorProneError has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 at java.base/java.lang.ClassLoader.defineClass1(Native Method) [ ...snip... ] ERROR: test/src/main/resources/java_sources/BUILD:5:14: Building test/src/main/resources/java_sources/CompiledWithJava8_java.jar (1 source file) failed: Worker process did not return a WorkResponse: ---8<---8<--- Start of log, file at .../bazel-workers/multiplex-worker-33-Javac.log ---8<---8<--- Error thrown by worker thread, shutting down worker. java.lang.UnsupportedClassVersionError: com/google/errorprone/ErrorProneError has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 at java.base/java.lang.ClassLoader.defineClass1(Native Method) [ ...snip... ] ``` Updating the toolchains from `@bazel_tools//tools/jdk:` to `@rules_java//toolchains:` for targets in `test/BUILD` and `test/src/main/resources/java_sources/BUILD` fixed this particular issue. (More on updating other `@bazel_tools//tools/jdk` toolchain targets below.) Bazel 6.5.0 then failed with the following expected issue, fixed by `rules_java` 7.10.0 via: - https://github.com/bazelbuild/rules_java/pull/210 - https://github.com/bazelbuild/rules_java/commit/30ecf3ff6ee8f30b4df505d9d3bde5bb1c25690b ```txt $ bazel build //{src,test,third_party,scala_proto}/... ERROR: .../external/rules_java/toolchains/java_toolchain_alias.bzl:83:34: Use of Starlark transition without allowlist attribute '_allowlist_function_transition'. See Starlark transitions documentation for details and usage: @rules_java//toolchains:java_toolchain_alias.bzl NORMAL ERROR: .../src/java/io/bazel/rulesscala/coverage/instrumenter/BUILD:3:12: While resolving toolchains for target //src/java/io/bazel/rulesscala/coverage/instrumenter:instrumenter: invalid registered toolchain '//toolchains:all': while parsing '//toolchains:all': error loading package '@rules_java//toolchains': initialization of module 'toolchains/java_toolchain_alias.bzl' failed ERROR: Analysis of target '//src/java/io/bazel/rulesscala/coverage/instrumenter:instrumenter' failed; build aborted: ``` Updating to `rules_java` 7.10.0 fixed the Bazel 6.5.0 build, but caused Bazel 7.4.1 to fail with the error I originally described in #1619. For details, see "Bump to rules_java 7.9.0 for Bazel 7 compatibility" in the message for commit cd22d8896f209c37be8622f1dcc9770c2dc18f48. ```txt $ bazel build //{src,test,third_party,scala_proto}/... ERROR: .../external/rules_java_builtin/toolchains/BUILD:254:14: While resolving toolchains for target @@rules_java_builtin//toolchains:platformclasspath (096dcc8): No matching toolchains found for types @@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type. To debug, rerun with --toolchain_resolution_debug='@@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type' If platforms or toolchains are a new concept for you, we'd encourage reading https://bazel.build/concepts/platforms-intro. ERROR: Analysis of target '//test/toolchains:java21_toolchain' failed; build aborted: Analysis failed ``` My analysis from #1619 _was_ on the right track. The `rules_java` 7.9.0 built into Bazel's `WORKSPACE` preamble registered `@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type` toolchains that later versions of `rules_java` couldn't resolve. This was due to the very same change that fixed 6.5.0, bazelbuild/rules_java#210. However, I mistakenly thought we needed to keep `@bazel_tools//tools/jdk:` as the canonical Java toolchains package instead switching to `@rules_java//toolchains:`. That's why I originally thought we were stuck on `rules_java` 7.9.0. I eventually rediscovered the following issue, which surfaced this problem a month before #1619. The conversation helped me realize that switching to `@rules_java//toolchains:` actually is the preferred, futureproof approach (short of migrating to Bzlmod): - bazelbuild/rules_java: Regression with `@@rules_java//toolchains:bootstrap_runtime_toolchain_type` in 7.10.0 https://github.com/bazelbuild/rules_java/issues/214 Switching all `@bazel_tools//tools/jdk:` toolchains to `@rules_java//toolchains:` resolved this issue, enabling Bazel 6.5.0 and 7.4.1 to successfully build using `rules_java` 7.12.2. I then updated `rules_java` to 7.12.3, which returns to registering some toolchains as `@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type`: - https://github.com/bazelbuild/rules_java/pull/246 - https://github.com/bazelbuild/rules_java/commit/b64eb7dee72877e7221a0b14abff0332a4aadfe7 @hvadehra requested that I try 7.12.3 to see if it resolved the issue. I was able to build successfully using this version in a branch without the toolchain updates from this commit. - https://github.com/bazelbuild/rules_scala/issues/1652#issuecomment-2519041342 However, the changes from this commit should remain futureproof when `@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type` moves to `@rules_java//toolchains:bootstrap_runtime_toolchain_type` again one day. --- Several of the flags removed from the `scrooge_compile_with_jdk_11` test case have been no-ops for years, so removing them eliminated their corresponding deprecation warnings. `--javacopt='--release 11'`, however, caused this breakage after originally bumping to `rules_java` 7.12.2: ```txt $ RULES_SCALA_TEST_ONLY="scrooge_compile_with_jdk_11" bash ./test/shell/test_twitter_scrooge.sh running test scrooge_compile_with_jdk_11 WARNING: Option 'javabase' is deprecated WARNING: Option 'host_javabase' is deprecated WARNING: Option 'host_java_toolchain' is deprecated WARNING: Option 'java_toolchain' is deprecated WARNING: Option 'javabase' is deprecated WARNING: Option 'host_javabase' is deprecated WARNING: Option 'host_java_toolchain' is deprecated WARNING: Option 'java_toolchain' is deprecated INFO: Analyzed 64 targets (0 packages loaded, 0 targets configured). INFO: Found 64 targets... ERROR: .../src/java/io/bazel/rulesscala/scalac/compileoptions/BUILD:3:13: Compiling Java headers src/java/io/bazel/rulesscala/scalac/compileoptions/libcompileoptions-hjar.jar (1 source file) failed: (Exit 1): turbine_direct_graal failed: error executing command (from target //src/java/io/bazel/rulesscala/scalac/compileoptions:compileoptions) external/remote_java_tools_darwin_arm64/java_tools/turbine_direct_graal --output bazel-out/darwin_arm64-fastbuild/bin/src/java/io/bazel/rulesscala/scalac/compileoptions/libcompileoptions-hjar.jar ... (remaining 32 arguments skipped) Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging java.lang.NullPointerException: attempted to use --release, but JAVA_HOME is not set at java.base@21.0.2/java.util.Objects.requireNonNull(Objects.java:259) at com.google.turbine.binder.CtSymClassBinder.bind(CtSymClassBinder.java:55) at com.google.turbine.main.Main.release(Main.java:318) at com.google.turbine.main.Main.bootclasspath(Main.java:304) at com.google.turbine.main.Main.compile(Main.java:142) at com.google.turbine.main.Main.compile(Main.java:133) at com.google.turbine.main.Main.main(Main.java:89) at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) INFO: Elapsed time: 0.325s, Critical Path: 0.12s INFO: 11 processes: 10 internal, 1 worker. FAILED: Build did NOT complete successfully Test "scrooge_compile_with_jdk_11" failed (0 sec) ``` See also: - Bazel Blog: Bazel 5.0: https://blog.bazel.build/2022/01/19/bazel-5.0.html#java - bazelbuild/bazel: `incompatible_use_toolchain_resolution_for_java_rules`: use toolchain resolution for Java rules #7849 https://github.com/bazelbuild/bazel/issues/7849 --- Bazel 8 requires `rules_java` 8, per #1652. Updating to `rules_java` 8 will likely happen in a new major release _after_ a release containing the Bzlmod changes. This is because: - The Bzlmod changes alone will work with Bazel 6 without requiring that users update `protobuf` beyond version 21.7. - Bazel 8 requires `protobuf` >= 29.0. Bazel 6 users would have to add the afforementioned C++ compiler flags to support the newer `abseil-cpp` versions required by newer `protobuf` versions. - `rules_scala` itself needs to update ScalaPB to 1.0.0-alpha.1 or higher to support `protobuf` >= v28.0, but this ScalaPB version will _not_ support `protobuf` < v28.0. The idea is that the next major release of `rules_scala` will help users migrate to Bazel 7 and Bzlmod, in either order. Then the next major release after that will enable them to migrate to Bazel 8, with all the requisite dependency upgrades. (Technically it will still support `WORKSPACE`, but hopefully they'll make the jump to Bzlmod first.) See: - https://github.com/bazelbuild/rules_scala/issues/1482#issuecomment-2503183071 --- Here are the details explaining how `rules_java` 8 currently breaks `rules_scala`, up until the point that upgrading to `protobuf` >= v29.0 would fix it. `rules_java` 8.0.0 requires Bazel >= 7.3.2, which provides the `subrule` API. Compatibility with Bazel >= 6.3.0 isn't restored until `rules_java` 8.3.2. ```txt $ bazel build //{src,test,third_party,scala_proto}/... ERROR: .../external/rules_java/java/common/rules/android_lint.bzl:142:24: name 'subrule' is not defined (did you mean 'rule'?) ERROR: Error computing the main repository mapping: at .../scala/private/extensions/dev_deps.bzl:8:6: at .../external/rules_java/java/repositories.bzl:20:6: at .../external/rules_java/toolchains/local_java_repository.bzl:17:6: at .../external/rules_java/java/defs.bzl:18:6: at .../external/rules_java/java/java_library.bzl:16:6: at .../external/rules_java/java/bazel/rules/bazel_java_library.bzl:21:6: compilation of module 'java/common/rules/android_lint.bzl' failed ``` `rules_java` 8.3.0 is broken, as it can't find its own `@compatibility_proxy` repo: ```txt $ bazel build //{src,test,third_party,scala_proto}/... ERROR: error loading package under directory 'src': error loading package 'src/protobuf/io/bazel/rules_scala': at .../external/rules_java/java/defs.bzl:22:6: at .../external/rules_java/java/java_test.bzl:16:6: Unable to find package for @compatibility_proxy//:proxy.bzl: The repository '@compatibility_proxy' could not be resolved: Repository '@compatibility_proxy' is not defined. ``` `rules_java` 8.3.1 seems to fix this, presumably by importing the `protobuf` repo as `com_google_protobuf`. However, it now requires at least `protobuf` v27.0, which adds `bazel/java/lite_proto_library.bzl`. Per #1647, we'd have to update to ScalaPB 1.0.0-alpha.1 to support `protobuf` v28, abandoning users of previous `protobuf` versions or forcing them to upgrade. ```txt $ bazel build //{src,test,third_party,scala_proto}/... [...snip...] ERROR: error loading package under directory 'src': error loading package 'src/java/io/bazel/rulesscala/worker': at .../external/rules_java/java/defs.bzl:16:6: Label '@com_google_protobuf//bazel:java_lite_proto_library.bzl' is invalid because 'bazel' is not a package; perhaps you meant to put the colon here: '@com_google_protobuf//:bazel/java_lite_proto_library.bzl'? ``` --- WORKSPACE | 72 ++++++++----------- dt_patches/test_dt_patches/WORKSPACE | 65 +++++++++-------- .../test_dt_patches_user_srcjar/WORKSPACE | 65 +++++++++-------- examples/crossbuild/WORKSPACE | 65 +++++++++-------- examples/scala3/WORKSPACE | 55 +++++++------- examples/semanticdb/WORKSPACE | 66 ++++++++--------- .../multi_frameworks_toolchain/WORKSPACE | 61 ++++++++-------- .../testing/scalatest_repositories/WORKSPACE | 55 +++++++------- .../specs2_junit_repositories/WORKSPACE | 55 +++++++------- jmh/jmh.bzl | 7 +- scala/deps.bzl | 58 +++++++++++++++ scala/private/common_attributes.bzl | 6 +- scala/private/extensions/dev_deps.bzl | 8 --- scala/private/macros/scala_repositories.bzl | 58 +-------------- scala/private/rule_impls.bzl | 2 +- scala/private/rules/scala_binary.bzl | 2 +- scala/private/rules/scala_junit_test.bzl | 2 +- scala/scala_import.bzl | 2 +- scala/scalafmt/phase_scalafmt_ext.bzl | 4 +- scala_proto/private/scala_proto_aspect.bzl | 6 +- test/BUILD | 6 +- test/jmh/BUILD | 2 +- test/shell/test_twitter_scrooge.sh | 8 +-- test/src/main/resources/java_sources/BUILD | 4 +- test/toolchains/BUILD.bazel | 2 +- test/toolchains/jdk.bzl | 5 +- test_cross_build/WORKSPACE | 53 ++++++-------- test_version/WORKSPACE.template | 59 +++++++-------- .../test/example_external_workspace/WORKSPACE | 49 +++++++------ third_party/test/proto/WORKSPACE | 55 +++++++------- twitter_scrooge/twitter_scrooge.bzl | 8 ++- 31 files changed, 495 insertions(+), 470 deletions(-) create mode 100644 scala/deps.bzl diff --git a/WORKSPACE b/WORKSPACE index b111cf67e..3cd6a3426 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,15 +1,15 @@ workspace(name = "io_bazel_rules_scala") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("//scala:deps.bzl", "rules_scala_dependencies") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], -) +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") @@ -17,29 +17,18 @@ bazel_skylib_workspace() http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config(enable_compiler_dependency_tracking = True) - -load("//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains( - "//testing:testing_toolchain", - "//scala:unused_dependency_checker_error_toolchain", - "//test/proto:scalapb_toolchain", - "@io_bazel_rules_scala_toolchains//...:all", -) +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -53,9 +42,20 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config(enable_compiler_dependency_tracking = True) + +load("//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains( + "//testing:testing_toolchain", + "//scala:unused_dependency_checker_error_toolchain", + "//test/proto:scalapb_toolchain", + "@io_bazel_rules_scala_toolchains//...:all", +) load("//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge") @@ -101,10 +101,10 @@ local_repository( http_archive( name = "io_bazel_rules_go", - sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996", + sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip", ], ) @@ -116,7 +116,7 @@ load( go_rules_dependencies() -go_register_toolchains(version = "1.19.5") +go_register_toolchains(version = "1.23.4") http_archive( name = "bazelci_rules", @@ -136,16 +136,4 @@ load("//scala/private/extensions:dev_deps.bzl", "dev_deps_repositories") dev_deps_repositories() -# Copied from bazel_tools/tools/jdk/remote_java_repository.bzl. -[ - register_toolchains( - "@remotejdk21_" + platform + "_toolchain_config_repo//:all", - ) - for platform in [ - "linux", - "macos", - "win", - ] -] - register_toolchains("//test/toolchains:java21_toolchain_definition") diff --git a/dt_patches/test_dt_patches/WORKSPACE b/dt_patches/test_dt_patches/WORKSPACE index 7921dc838..903295e57 100644 --- a/dt_patches/test_dt_patches/WORKSPACE +++ b/dt_patches/test_dt_patches/WORKSPACE @@ -2,30 +2,51 @@ workspace(name = "test_dt_patches") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../..", -) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") + +rules_proto_dependencies() + +load("@rules_proto//proto:setup.bzl", "rules_proto_setup") + +rules_proto_setup() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") + +rules_proto_toolchains() load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") @@ -51,19 +72,3 @@ register_toolchains( ":dt_scala_toolchain", "@io_bazel_rules_scala_toolchains//...:all", ) - -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") - -rules_proto_dependencies() - -load("@rules_proto//proto:setup.bzl", "rules_proto_setup") - -rules_proto_setup() - -load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") - -rules_proto_toolchains() - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() diff --git a/dt_patches/test_dt_patches_user_srcjar/WORKSPACE b/dt_patches/test_dt_patches_user_srcjar/WORKSPACE index 2a535e1e3..a94c238bd 100644 --- a/dt_patches/test_dt_patches_user_srcjar/WORKSPACE +++ b/dt_patches/test_dt_patches_user_srcjar/WORKSPACE @@ -2,30 +2,51 @@ workspace(name = "test_dt_patches") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../..", -) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") + +rules_proto_dependencies() + +load("@rules_proto//proto:setup.bzl", "rules_proto_setup") + +rules_proto_setup() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") + +rules_proto_toolchains() load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") @@ -122,19 +143,3 @@ register_toolchains( ":dt_scala_toolchain", "@io_bazel_rules_scala_toolchains//...:all", ) - -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") - -rules_proto_dependencies() - -load("@rules_proto//proto:setup.bzl", "rules_proto_setup") - -rules_proto_setup() - -load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") - -rules_proto_toolchains() - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() diff --git a/examples/crossbuild/WORKSPACE b/examples/crossbuild/WORKSPACE index 8cd4ef857..8928c87a5 100644 --- a/examples/crossbuild/WORKSPACE +++ b/examples/crossbuild/WORKSPACE @@ -2,30 +2,51 @@ workspace(name = "cross_build") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "d00f1389ee20b60018e92644e0948e16e350a7707219e7a390fb0a99b6ec9262", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.0/bazel-skylib-1.7.0.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.0/bazel-skylib-1.7.0.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../..", -) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") + +rules_proto_dependencies() + +load("@rules_proto//proto:setup.bzl", "rules_proto_setup") + +rules_proto_setup() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") + +rules_proto_toolchains() load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") @@ -44,22 +65,6 @@ scala_toolchains() register_toolchains("@io_bazel_rules_scala_toolchains//...:all") -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") - -rules_proto_dependencies() - -load("@rules_proto//proto:setup.bzl", "rules_proto_setup") - -rules_proto_setup() - -load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") - -rules_proto_toolchains() - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() - load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", "scalatest_toolchain") scalatest_repositories() diff --git a/examples/scala3/WORKSPACE b/examples/scala3/WORKSPACE index a98255c50..ed65edc8c 100644 --- a/examples/scala3/WORKSPACE +++ b/examples/scala3/WORKSPACE @@ -2,40 +2,39 @@ workspace(name = "specs2_junit_repositories") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../..", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config(scala_version = "3.5.2") - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains("@io_bazel_rules_scala_toolchains//...:all") +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -49,6 +48,12 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config(scala_version = "3.5.2") + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains("@io_bazel_rules_scala_toolchains//...:all") diff --git a/examples/semanticdb/WORKSPACE b/examples/semanticdb/WORKSPACE index 72ae37bd5..e7a82b326 100644 --- a/examples/semanticdb/WORKSPACE +++ b/examples/semanticdb/WORKSPACE @@ -2,47 +2,39 @@ workspace(name = "specs2_junit_repositories") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -skylib_version = "1.4.1" - -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - type = "tar.gz", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version), - "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version), - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../..", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config(scala_version = "2.13.15") - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains( - #Register and use the custom toolchain that has semanticdb enabled - "//:semanticdb_toolchain", - "@io_bazel_rules_scala_toolchains//...:all", -) +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -56,6 +48,16 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config(scala_version = "2.13.15") + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains( + #Register and use the custom toolchain that has semanticdb enabled + "//:semanticdb_toolchain", + "@io_bazel_rules_scala_toolchains//...:all", +) diff --git a/examples/testing/multi_frameworks_toolchain/WORKSPACE b/examples/testing/multi_frameworks_toolchain/WORKSPACE index 2712dfaea..e810737ee 100644 --- a/examples/testing/multi_frameworks_toolchain/WORKSPACE +++ b/examples/testing/multi_frameworks_toolchain/WORKSPACE @@ -2,43 +2,39 @@ workspace(name = "multi_frameworks_toolchain") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../../..", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config() - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains( - ":testing_toolchain", - "@io_bazel_rules_scala_toolchains//...:all", -) +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -52,9 +48,18 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config() + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains( + ":testing_toolchain", + "@io_bazel_rules_scala_toolchains//...:all", +) load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories") load("@io_bazel_rules_scala//testing:junit.bzl", "junit_repositories") diff --git a/examples/testing/scalatest_repositories/WORKSPACE b/examples/testing/scalatest_repositories/WORKSPACE index d74bf5eae..0ecd33386 100644 --- a/examples/testing/scalatest_repositories/WORKSPACE +++ b/examples/testing/scalatest_repositories/WORKSPACE @@ -2,40 +2,39 @@ workspace(name = "scalatest_repositories") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../../..", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config() - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains("@io_bazel_rules_scala_toolchains//...:all") +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -49,9 +48,15 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config() + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains("@io_bazel_rules_scala_toolchains//...:all") load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", "scalatest_toolchain") diff --git a/examples/testing/specs2_junit_repositories/WORKSPACE b/examples/testing/specs2_junit_repositories/WORKSPACE index 6d5fb0649..921db231d 100644 --- a/examples/testing/specs2_junit_repositories/WORKSPACE +++ b/examples/testing/specs2_junit_repositories/WORKSPACE @@ -2,40 +2,39 @@ workspace(name = "specs2_junit_repositories") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../../..", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config() - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains("@io_bazel_rules_scala_toolchains//...:all") +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -49,9 +48,15 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config() + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains("@io_bazel_rules_scala_toolchains//...:all") load("@io_bazel_rules_scala//testing:specs2_junit.bzl", "specs2_junit_repositories", "specs2_junit_toolchain") diff --git a/jmh/jmh.bzl b/jmh/jmh.bzl index 458e14674..5e5844216 100644 --- a/jmh/jmh.bzl +++ b/jmh/jmh.bzl @@ -69,7 +69,7 @@ scala_generate_benchmark = rule( ), ), "runtime_jdk": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_runtime"), + default = Label("@rules_java//toolchains:current_java_runtime"), providers = [java_common.JavaRuntimeInfo], ), }, @@ -90,7 +90,10 @@ def scala_benchmark_jmh(**kw): testonly = kw.get("testonly", False) scalacopts = kw.get("scalacopts", []) main_class = kw.get("main_class", "org.openjdk.jmh.Main") - runtime_jdk = kw.get("runtime_jdk", "@bazel_tools//tools/jdk:current_java_runtime") + runtime_jdk = kw.get( + "runtime_jdk", + "@rules_java//toolchains:current_java_runtime", + ) scala_library( name = lib, diff --git a/scala/deps.bzl b/scala/deps.bzl new file mode 100644 index 000000000..0069ded6d --- /dev/null +++ b/scala/deps.bzl @@ -0,0 +1,58 @@ +"""Macro for instantiating repos required for core functionality.""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +def rules_scala_dependencies(): + """Instantiates repos needed by rules provided by `rules_scala`.""" + maybe( + http_archive, + name = "bazel_skylib", + sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", + ], + ) + + maybe( + http_archive, + name = "rules_cc", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], + sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", + strip_prefix = "rules_cc-0.0.9", + ) + + # Needed by protobuf-21.7 and Bazel 6.5.0, as later versions require C++14. + maybe( + http_archive, + name = "com_google_absl", + sha256 = "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8", + strip_prefix = "abseil-cpp-20220623.1", + url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz", + ) + + maybe( + http_archive, + name = "rules_java", + urls = [ + "https://github.com/bazelbuild/rules_java/releases/download/7.12.3/rules_java-7.12.3.tar.gz", + ], + sha256 = "c0ee60f8757f140c157fc2c7af703d819514de6e025ebf70386d38bdd85fce83", + ) + + maybe( + http_archive, + name = "com_google_protobuf", + sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", + strip_prefix = "protobuf-21.7", + url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.7.tar.gz", + ) + + maybe( + http_archive, + name = "rules_proto", + sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", + strip_prefix = "rules_proto-6.0.2", + url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz", + ) diff --git a/scala/private/common_attributes.bzl b/scala/private/common_attributes.bzl index 83165bf42..a71080296 100644 --- a/scala/private/common_attributes.bzl +++ b/scala/private/common_attributes.bzl @@ -29,7 +29,7 @@ common_attrs_for_plugin_bootstrapping = { "resource_strip_prefix": attr.string(), "resource_jars": attr.label_list(allow_files = True), "java_compile_toolchain": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_toolchain"), + default = Label("@rules_java//toolchains:current_java_toolchain"), providers = [java_common.JavaToolchainInfo], ), "scalacopts": attr.string_list(), @@ -82,10 +82,10 @@ common_attrs.update({ implicit_deps = { "_java_runtime": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_runtime"), + default = Label("@rules_java//toolchains:current_java_runtime"), ), "_java_host_runtime": attr.label( - default = Label("@bazel_tools//tools/jdk:current_host_java_runtime"), + default = Label("@rules_java//toolchains:current_host_java_runtime"), ), "_scalac": attr.label( executable = True, diff --git a/scala/private/extensions/dev_deps.bzl b/scala/private/extensions/dev_deps.bzl index 798d4afdc..29c4fd52c 100644 --- a/scala/private/extensions/dev_deps.bzl +++ b/scala/private/extensions/dev_deps.bzl @@ -2,10 +2,8 @@ load("//scala:scala_cross_version.bzl", "default_maven_server_urls") load("//scala:scala_maven_import_external.bzl", "java_import_external") -load("//test/toolchains:jdk.bzl", "remote_jdk21_repositories") load("//third_party/repositories:repositories.bzl", "repositories") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@rules_java//java:repositories.bzl", "remote_jdk8_repos") _BUILD_TOOLS_RELEASE = "5.1.0" @@ -45,10 +43,6 @@ def dev_deps_repositories( testonly_ = True, ) - # We need to select based on platform when we use these - # https://github.com/bazelbuild/bazel/issues/11655 - remote_jdk8_repos() - repositories( fetch_sources = fetch_sources, for_artifact_ids = [ @@ -73,5 +67,3 @@ def dev_deps_repositories( ], maven_servers = maven_servers, ) - - remote_jdk21_repositories() diff --git a/scala/private/macros/scala_repositories.bzl b/scala/private/macros/scala_repositories.bzl index 8e02640ef..81b6c9cbf 100644 --- a/scala/private/macros/scala_repositories.bzl +++ b/scala/private/macros/scala_repositories.bzl @@ -1,3 +1,4 @@ +load("//scala:deps.bzl", "rules_scala_dependencies") load( "//scala:scala_cross_version.bzl", "extract_major_version", @@ -117,59 +118,6 @@ def dt_patched_compiler_setup(scala_version, scala_compiler_srcjar = None): integrity = srcjar.get("integrity"), ) -def load_rules_dependencies(): - if not native.existing_rule("bazel_skylib"): - http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], - ) - - # Needed by protobuf-21.7 and Bazel 6.5.0, as later versions require C++14. - if not native.existing_rule("com_google_absl"): - http_archive( - name = "com_google_absl", - sha256 = "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8", - strip_prefix = "abseil-cpp-20220623.1", - url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz", - ) - - if not native.existing_rule("com_google_protobuf"): - http_archive( - name = "com_google_protobuf", - sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", - strip_prefix = "protobuf-21.7", - url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.7.tar.gz", - ) - - if not native.existing_rule("rules_cc"): - http_archive( - name = "rules_cc", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.6/rules_cc-0.0.6.tar.gz"], - sha256 = "3d9e271e2876ba42e114c9b9bc51454e379cbf0ec9ef9d40e2ae4cec61a31b40", - strip_prefix = "rules_cc-0.0.6", - ) - - if not native.existing_rule("rules_java"): - http_archive( - name = "rules_java", - urls = [ - "https://github.com/bazelbuild/rules_java/releases/download/7.9.0/rules_java-7.9.0.tar.gz", - ], - sha256 = "41131de4417de70b9597e6ebd515168ed0ba843a325dc54a81b92d7af9a7b3ea", - ) - - if not native.existing_rule("rules_proto"): - http_archive( - name = "rules_proto", - sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", - strip_prefix = "rules_proto-6.0.2", - url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz", - ) - def setup_scala_compiler_sources(srcjars = {}): """Generates Scala compiler source repos used internally by rules_scala. @@ -188,7 +136,7 @@ def setup_scala_compiler_sources(srcjars = {}): ) def rules_scala_setup(scala_compiler_srcjar = None): - load_rules_dependencies() + rules_scala_dependencies() setup_scala_compiler_sources({ version: scala_compiler_srcjar for version in SCALA_VERSIONS @@ -260,7 +208,7 @@ def scala_repositories( scala_compiler_srcjars = {}): if load_dep_rules: # When `WORKSPACE` goes away, so can this case. - load_rules_dependencies() + rules_scala_dependencies() setup_scala_compiler_sources(scala_compiler_srcjars) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 19a8a3ae8..c4ba81c5c 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -14,7 +14,7 @@ """Rules for supporting the Scala language.""" load("@bazel_skylib//lib:paths.bzl", "paths") -load("@bazel_tools//tools/jdk:toolchain_utils.bzl", "find_java_toolchain") +load("@rules_java//toolchains:toolchain_utils.bzl", "find_java_toolchain") load(":common.bzl", "rlocationpath_from_rootpath", _collect_plugin_paths = "collect_plugin_paths") load(":resources.bzl", _resource_paths = "paths") diff --git a/scala/private/rules/scala_binary.bzl b/scala/private/rules/scala_binary.bzl index 33652858c..1b6b89b2c 100644 --- a/scala/private/rules/scala_binary.bzl +++ b/scala/private/rules/scala_binary.bzl @@ -58,7 +58,7 @@ _scala_binary_attrs = { "classpath_resources": attr.label_list(allow_files = True), "jvm_flags": attr.string_list(), "runtime_jdk": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_runtime"), + default = Label("@rules_java//toolchains:current_java_runtime"), providers = [java_common.JavaRuntimeInfo], ), } diff --git a/scala/private/rules/scala_junit_test.bzl b/scala/private/rules/scala_junit_test.bzl index 9e01df5c8..45daa490d 100644 --- a/scala/private/rules/scala_junit_test.bzl +++ b/scala/private/rules/scala_junit_test.bzl @@ -79,7 +79,7 @@ _scala_junit_test_attrs = { ), "jvm_flags": attr.string_list(), "runtime_jdk": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_runtime"), + default = Label("@rules_java//toolchains:current_java_runtime"), providers = [java_common.JavaRuntimeInfo], ), "env": attr.string_dict(default = {}), diff --git a/scala/scala_import.bzl b/scala/scala_import.bzl index 1fb01df8f..a92cc48d5 100644 --- a/scala/scala_import.bzl +++ b/scala/scala_import.bzl @@ -146,7 +146,7 @@ scala_import = rule( default = Label("@io_bazel_rules_scala//scala/settings:stamp_scala_import"), ), "java_compile_toolchain": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_toolchain"), + default = Label("@rules_java//toolchains:current_java_toolchain"), ), }, toolchains = ["@bazel_tools//tools/jdk:toolchain_type"], diff --git a/scala/scalafmt/phase_scalafmt_ext.bzl b/scala/scalafmt/phase_scalafmt_ext.bzl index 3ce44e151..0f32f87a8 100644 --- a/scala/scalafmt/phase_scalafmt_ext.bzl +++ b/scala/scalafmt/phase_scalafmt_ext.bzl @@ -24,7 +24,9 @@ ext_scalafmt = { executable = True, ), "_java_host_runtime": attr.label( - default = Label("@bazel_tools//tools/jdk:current_host_java_runtime"), + default = Label( + "@rules_java//toolchains:current_host_java_runtime", + ), ), "_runner": attr.label( allow_single_file = True, diff --git a/scala_proto/private/scala_proto_aspect.bzl b/scala_proto/private/scala_proto_aspect.bzl index 8784c08bd..fc4b95e6c 100644 --- a/scala_proto/private/scala_proto_aspect.bzl +++ b/scala_proto/private/scala_proto_aspect.bzl @@ -209,10 +209,12 @@ def _scala_proto_aspect_impl(target, ctx): def make_scala_proto_aspect(*extras): attrs = { "_java_toolchain": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_toolchain"), + default = Label("@rules_java//toolchains:current_java_toolchain"), ), "_java_host_runtime": attr.label( - default = Label("@bazel_tools//tools/jdk:current_host_java_runtime"), + default = Label( + "@rules_java//toolchains:current_host_java_runtime", + ), ), } return aspect( diff --git a/test/BUILD b/test/BUILD index 4c2d7a263..a055235d5 100644 --- a/test/BUILD +++ b/test/BUILD @@ -479,7 +479,7 @@ scala_binary( name = "scala_binary_jdk_11", srcs = ["ScalaBinaryJdk11.scala"], main_class = "scalarules.test.ScalaBinaryJdk11", - runtime_jdk = "@bazel_tools//tools/jdk:remote_jdk11", + runtime_jdk = "@rules_java//toolchains:remote_jdk11", ) # Make sure scala_library respects java_compile_toolchain during builds @@ -782,14 +782,14 @@ scala_library( "src/main/scala/scalarules/test/junit/runtime_platform/JunitRuntimePlatformTest.java", ], # make sure java compilation toolchain matches runtime toolchain ie --target - java_compile_toolchain = "@bazel_tools//tools/jdk:toolchain_java11", + java_compile_toolchain = "@rules_java//toolchains:toolchain_java11", deps = ["@io_bazel_rules_scala_junit_junit"], ) scala_junit_test( name = "JunitRuntimePlatform_test_runner", size = "small", - runtime_jdk = "@bazel_tools//tools/jdk:remote_jdk11", + runtime_jdk = "@rules_java//toolchains:remote_jdk11", suffixes = ["Test"], tests_from = [":JunitRuntimePlatform"], runtime_deps = [":JunitRuntimePlatform"], diff --git a/test/jmh/BUILD b/test/jmh/BUILD index 1942fbbe8..a36ca831b 100644 --- a/test/jmh/BUILD +++ b/test/jmh/BUILD @@ -63,7 +63,7 @@ scala_benchmark_jmh( scala_benchmark_jmh( name = "test_jmh_jdk11", srcs = ["TestJmhRuntimeJdk11.scala"], - runtime_jdk = "@bazel_tools//tools/jdk:remote_jdk11", + runtime_jdk = "@rules_java//toolchains:remote_jdk11", ) [sh_test( diff --git a/test/shell/test_twitter_scrooge.sh b/test/shell/test_twitter_scrooge.sh index 56345ad3b..6bf4aceb8 100644 --- a/test/shell/test_twitter_scrooge.sh +++ b/test/shell/test_twitter_scrooge.sh @@ -5,13 +5,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) runner=$(get_test_runner "${1:-local}") scrooge_compile_with_jdk_11() { - # javabase and java_toolchain parameters are deprecated and may be - # removed in Bazel >= 5.0.0 - bazel build --javabase=@bazel_tools//tools/jdk:remote_jdk11 \ - --host_javabase=@bazel_tools//tools/jdk:remote_jdk11 \ - --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 \ - --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 \ - --javacopt='--release 11' \ + bazel build \ --java_language_version=11 \ --tool_java_language_version=11 \ --java_runtime_version=remotejdk_11 \ diff --git a/test/src/main/resources/java_sources/BUILD b/test/src/main/resources/java_sources/BUILD index 5cc8c9d7c..da7762317 100644 --- a/test/src/main/resources/java_sources/BUILD +++ b/test/src/main/resources/java_sources/BUILD @@ -5,11 +5,11 @@ package(default_visibility = ["//visibility:public"]) scala_library( name = "CompiledWithJava8", srcs = ["SimpleJavaSourceFileA.java"], - java_compile_toolchain = "@bazel_tools//tools/jdk:toolchain_java8", + java_compile_toolchain = "@rules_java//toolchains:toolchain_java8", ) scala_library( name = "CompiledWithJava11", srcs = ["SimpleJavaSourceFileB.java"], - java_compile_toolchain = "@bazel_tools//tools/jdk:toolchain_java11", + java_compile_toolchain = "@rules_java//toolchains:toolchain_java11", ) diff --git a/test/toolchains/BUILD.bazel b/test/toolchains/BUILD.bazel index e0a20ac38..1dbfcee8b 100644 --- a/test/toolchains/BUILD.bazel +++ b/test/toolchains/BUILD.bazel @@ -1,6 +1,6 @@ load("//scala:scala_toolchain.bzl", "scala_toolchain") load( - "@bazel_tools//tools/jdk:default_java_toolchain.bzl", + "@rules_java//toolchains:default_java_toolchain.bzl", "BASE_JDK9_JVM_OPTS", "DEFAULT_JAVACOPTS", "DEFAULT_TOOLCHAIN_CONFIGURATION", diff --git a/test/toolchains/jdk.bzl b/test/toolchains/jdk.bzl index b16c4ea4e..be4729297 100644 --- a/test/toolchains/jdk.bzl +++ b/test/toolchains/jdk.bzl @@ -1,5 +1,8 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -load("@bazel_tools//tools/jdk:remote_java_repository.bzl", "remote_java_repository") +load( + "@rules_java//toolchains:remote_java_repository.bzl", + "remote_java_repository", +) def remote_jdk21_repositories(): maybe( diff --git a/test_cross_build/WORKSPACE b/test_cross_build/WORKSPACE index 5e33f222c..8dc10d07f 100644 --- a/test_cross_build/WORKSPACE +++ b/test_cross_build/WORKSPACE @@ -2,39 +2,39 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "d00f1389ee20b60018e92644e0948e16e350a7707219e7a390fb0a99b6ec9262", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.0/bazel-skylib-1.7.0.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.0/bazel-skylib-1.7.0.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -http_archive( - name = "rules_proto", - sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", - strip_prefix = "rules_proto-6.0.2", - url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz", -) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -http_archive( - name = "com_google_protobuf", - sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", - strip_prefix = "protobuf-21.7", - url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.7.tar.gz", -) +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -48,15 +48,6 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() - -local_repository( - name = "io_bazel_rules_scala", - path = "..", -) - load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") scala_config( diff --git a/test_version/WORKSPACE.template b/test_version/WORKSPACE.template index 280ce826c..8af5a3d35 100644 --- a/test_version/WORKSPACE.template +++ b/test_version/WORKSPACE.template @@ -2,62 +2,55 @@ workspace(name = "io_bazel_rules_scala_test") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../../" ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-0.36.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz", + sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34", + strip_prefix = "rules_python-0.38.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz", ) load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -http_archive( - name = "rules_proto", - sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", - strip_prefix = "rules_proto-6.0.2", - url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz", -) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -http_archive( - name = "com_google_protobuf", - sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", - strip_prefix = "protobuf-21.7", - url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.7.tar.gz", -) +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") + rules_proto_dependencies() load("@rules_proto//proto:setup.bzl", "rules_proto_setup") + rules_proto_setup() load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") -rules_proto_toolchains() - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() -local_repository( - name = "io_bazel_rules_scala", - path = "../../" -) +rules_proto_toolchains() load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -scala_config(enable_compiler_dependency_tracking = True) -load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "extract_major_version") +scala_config(enable_compiler_dependency_tracking = True) load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") diff --git a/third_party/test/example_external_workspace/WORKSPACE b/third_party/test/example_external_workspace/WORKSPACE index 0e69d76b2..4fd1e9a28 100644 --- a/third_party/test/example_external_workspace/WORKSPACE +++ b/third_party/test/example_external_workspace/WORKSPACE @@ -2,15 +2,25 @@ workspace(name = "example_external_workspace") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", @@ -22,20 +32,9 @@ load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../../..", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config() - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains(fetch_sources = True) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains("@io_bazel_rules_scala_toolchains//...:all") +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -49,9 +48,15 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config() + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains(fetch_sources = True) + +register_toolchains("@io_bazel_rules_scala_toolchains//...:all") load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", "scalatest_toolchain") diff --git a/third_party/test/proto/WORKSPACE b/third_party/test/proto/WORKSPACE index 12cb91cb3..39db57412 100644 --- a/third_party/test/proto/WORKSPACE +++ b/third_party/test/proto/WORKSPACE @@ -2,15 +2,25 @@ workspace(name = "proto") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], +local_repository( + name = "io_bazel_rules_scala", + path = "../../..", ) +load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies") + +rules_scala_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + http_archive( name = "rules_python", sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", @@ -22,23 +32,9 @@ load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -local_repository( - name = "io_bazel_rules_scala", - path = "../../../", -) - -load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") - -scala_config() - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") - -scala_toolchains() +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -register_toolchains( - "@io_bazel_rules_scala//scala:unused_dependency_checker_error_toolchain", - "@io_bazel_rules_scala_toolchains//...:all", -) +protobuf_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") @@ -52,9 +48,18 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") rules_proto_toolchains() -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") -protobuf_deps() +scala_config() + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_toolchains") + +scala_toolchains() + +register_toolchains( + "@io_bazel_rules_scala//scala:unused_dependency_checker_error_toolchain", + "@io_bazel_rules_scala_toolchains//...:all", +) load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_repositories") diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 1bdef6ecd..16b1e4180 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -435,7 +435,9 @@ common_attrs = { ), ], ), - "_java_host_runtime": attr.label(default = Label("@bazel_tools//tools/jdk:current_host_java_runtime")), + "_java_host_runtime": attr.label( + default = Label("@rules_java//toolchains:current_host_java_runtime"), + ), } common_aspect_providers = [ @@ -475,7 +477,9 @@ scrooge_java_aspect = aspect( attrs = dicts.add( common_attrs, { - "_java_toolchain": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_toolchain")), + "_java_toolchain": attr.label(default = Label( + "@rules_java//toolchains:current_java_toolchain", + )), }, ), provides = [ScroogeAspectInfo],