Toolchainize //scala_proto:{,deps_}toolchain_type #1687
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds scala_proto toolchains to
scala_toolchains()
. Part of #1482.The most significant part of the change is moving all the toolchain rules from
scala_proto/BUILD
tosetup_scala_toolchains()
inscala_proto/toolchains.bzl
.Adds the
scala_proto_deps_providers()
macro to replace//scala_proto:scalapb_{compile,grpc,worker}_deps_provider
targets in thedep_providers
parameter ofscala_proto_deps_toolchain()
. Examples of this are intest/proto/custom_generator/BUILD
.Excludes
@scala_proto_rules_scalapb_protoc_gen
fromDEFAULT_SCALAPB_WORKER_DEPS
inscala_proto/default/default_deps.bzl
for Scala 2.11. For other Scala versions, this repo name will have the Scala version appended.A lot of the other changes are more opportunistic removals of
@io_bazel_rules_scala
label prefixes and application ofLabel()
where appropriate.Motivation
This is the next step in the toolchainization of the frameworks used to implement various rules, as required to implement Bzlmod support.
Excluding
@scala_proto_rules_scalapb_protoc_gen
fromDEFAULT_SCALAPB_WORKER_DEPS
avoids build failures under Bzlmod, since:This repo is required by ScalaPB 0.11.17, but Scala 2.11 is capped at ScalaPB 0.9.8.
Importing the nonexistent
scala_proto_rules_scalapb_protoc_gen
under Scala 2.11 results in an error under Bzlmod, as does importing it multiple times when configuring multiple Scala versions.MODULE.bazel
can iterate over a list of Scala versions, filtering out Scala 2.11, and calluse_repo()
on each version specific repo.As in other pull requests, removing
@io_bazel_rules_scala
label prefixes will allow Bzlmod users to userules_scala
without settingrepo_name = "@io_bazel_rules_scala"
inbazel_dep()
.