@@ -62,6 +62,13 @@ load("@rules_scala//scala:deps.bzl", "rules_scala_dependencies")
6262
6363rules_scala_dependencies()
6464
65+ # The next two calls instantiate the `@host_platform` repo to work around:
66+ # - https://github.com/bazelbuild/bazel/issues/22558
67+ # Only required if using `--incompatible_enable_proto_toolchain_resolution`.
68+ load(" @platforms//host:extension.bzl" , " host_platform_repo" )
69+
70+ host_platform_repo(name = " host_platform" )
71+
6572load(" @rules_java//java:rules_java_deps.bzl" , " rules_java_dependencies" )
6673
6774rules_java_dependencies()
@@ -168,6 +175,40 @@ load(
168175)
169176```
170177
178+ ### <a id =" protoc " ></a >Using a precompiled protocol compiler
179+
180+ ` rules_scala ` now supports
181+ [ ` --incompatible_enable_proto_toolchain_resolution ` ] [ ] . When using this flag,
182+ ` rules_scala ` will use a precompiled protocol compiler binary by default. To set
183+ it in your ` .bazelrc ` file:
184+
185+ [ `--incompatible_enable_proto_toolchain_resolution` ] : https://bazel.build/reference/command-line-reference#flag--incompatible_enable_proto_toolchain_resolution
186+
187+ ``` txt
188+ common --incompatible_enable_proto_toolchain_resolution
189+ ```
190+
191+ Set the ` protoc_platforms ` attribute of ` scala_toolchains() ` if you need to
192+ configure protocol compilers for platforms other than the host platform.
193+
194+ Windows builds now require the precompiled protocol compiler toolchain. See the
195+ [ Windows MSVC builds of protobuf broken by default] ( #protoc-msvc ) section
196+ below for details.
197+
198+ More background on proto toolchainization:
199+
200+ - [ Proto Toolchainisation Design Doc] (
201+ https://docs.google.com/document/d/1CE6wJHNfKbUPBr7-mmk_0Yo3a4TaqcTPE0OWNuQkhPs/edit )
202+
203+ - [ bazelbuild/bazel #7095 : Protobuf repo recompilation sensitivity] (
204+ https://github.com/bazelbuild/bazel/issues/7095 )
205+
206+ - [ bazelbuild/rules_proto #179 : Implement proto toolchainisation] (
207+ https://github.com/bazelbuild/rules_proto/issues/179 )
208+
209+ - [ rules_proto 6.0.0 release notes mentioning Protobuf Toolchainization] (
210+ https://github.com/bazelbuild/rules_proto/releases/tag/6.0.0 )
211+
171212### Persistent workers
172213
173214To run with a persistent worker (much faster), add the following to
@@ -567,6 +608,25 @@ http_archive(
567608)
568609```
569610
611+ ### <a id =" protoc-msvc " ></a >Windows MSVC builds of ` protobuf ` broken by default
612+
613+ MSVC builds of recent ` protobuf ` versions started failing, as first noted in
614+ bazelbuild/rules_scala #1710 . On top of that, ` protobuf ` is planning to stop
615+ supporting Bazel + MSVC builds per:
616+
617+ - [ protocolbuffers/protobuf #12947 : src build on windows not working] (
618+ https://github.com/protocolbuffers/protobuf/issues/12947 )
619+
620+ - [ protobuf.dev News Announcements for Version 30.x: Poison MSVC + Bazel] (
621+ https://protobuf.dev/news/v30/#poison-msvc--bazel )
622+
623+ - [ protocolbuffers/protobuf #20085 : Breaking Change: Dropping support for
624+ Bazel+MSVC] ( https://github.com/protocolbuffers/protobuf/issues/20085 )
625+
626+ Enable [ protocol compiler toolchainization] ( #protoc ) to avoid recompiling
627+ ` @com_google_protobuf//:protoc ` on Windows platforms and fix broken Windows
628+ builds.
629+
570630### Bzlmod configuration (coming soon!)
571631
572632The upcoming Bzlmod implementation will funnel through the ` scala_toolchains() `
0 commit comments