You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-11Lines changed: 6 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,23 @@ _#NeverCompileProtocAgain_
4
4
5
5
Using Protocol Buffers with Bazel has always been difficult.
6
6
7
+
- Compiling protoc from source requires a functional C++ toolchain, which is a burden for projects that have no C++ code.
8
+
Also, Bazel does not ship with a hermetic toolchain, so you may have a handful of developers whose Bazel build is broken.
7
9
- Nearly every Bazel user has waited for `protoc` to compile from sources many, MANY times.
8
10
This universally slows down builds, especially due to issues like https://github.com/bazelbuild/bazel/issues/7095 where it is observed to be easily cache-busted.
9
11
- The versioning of the protobuf module on Bazel Central Registry has fallen behind and contains many patches.
10
12
As of mid-March 2024 there are [7 patches](https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/protobuf/23.1/patches)
11
13
which essentially constitute a fork of the protobuf repo specifically for publishing to BCR.
12
14
- Relying on the protobuf runtime for each language from the `@com_google_protobuf` repo forces you to use
13
15
the same version of the runtime for all languages in a monorepo, and matching protoc.
16
+
This makes it difficult to migrate to a monorepo, allowing some applications to move from their separate repo without changing their
17
+
dependency versions.
14
18
15
19
The key observations:
16
20
17
21
-`protoc` has always been distributed as pre-built binaries on https://github.com/protocolbuffers/protobuf/releases
18
22
- That distribution includes the "well known types" such as `timestamp.proto`
19
-
- The protobuf runtimes for each language are distributed to the appropriate package manager.
23
+
- The protobuf runtimes for each language are distributed to the appropriate package manager such as npm or PyPI.
20
24
21
25
Bazel 7 introduced `--incompatible_enable_proto_toolchain_resolution` to allow us fetch `protoc` rather than re-build it!
22
26
That flag ALSO decouples how each language rule locates the runtime.
@@ -47,15 +51,6 @@ As with many other tools such as Swagger and GraphQL, the Bazel community is sel
47
51
This toolchain shows that there's no need to treat Bazel as a “special” build system vs. all the others that protobuf users rely on.
48
52
https://protobuf.dev/reference/ is sufficient documentation for everyone.
0 commit comments