Adam Cozzette
a7b0421c78
This check enforces that each C++ build target has the correct dependencies for all headers that it includes. We have many targets that were not correct with respect to this check, so I fixed them up. I also cleaned up the C++ targets related to the well-known types. I created a cc_proto_library() target for each one and removed the :wkt_cc_protos target, since this was necessary to satisfy the layering check. I deleted the //src/google/protobuf:protobuf_nowkt target and deprecated :protobuf_nowkt, because the distinction between the :protobuf and :protobuf_nowkt targets was not really correct. Neither one exposed the headers for the well-known types in a way that was valid with respect to the layering check, and the idea of bundling all the well-known types together is not idiomatic in Bazel anyway. This is a breaking change, because the //:protobuf target no longer bundles the well-known types. From now on they should be accessed through the new //:*_cc_proto aliases in our top-level package. I renamed the :port_def target to :port, which simplifies things a bit by matching our internal name. The original motivation for this change was that to move utf8_range onto our CI infrastructure, we needed to make its dependency rules_fuzzing compatible with Bazel 6. The rules_fuzzing project builds with the layering check, and I found that the process of upgrading it to Bazel 6 made it take a dependency on protobuf, which caused it to break due to layering violations. I was able to work around this, but it would still be nice to comply with the layering check so that we don't have to worry about this kind of thing in the future. PiperOrigin-RevId: 595516736 |
11 months ago | |
---|---|---|
.. | ||
test | Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full. | 1 year ago |
BUILD.bazel | Breaking change: make protobuf comply with the C++ layering check | 11 months ago |
README.md | Add source distribution packaging rules (#9835) | 3 years ago |
build_systems.bzl | Check-in bootstrapped Java features for Bazel and CMake | 1 year ago |
cc_dist_library.bzl | Move utf8_range into the protobuf repo | 1 year ago |
README.md
Protobuf packaging
This directory contains Bazel rules for building packaging and distribution artifacts.
Everything in this directory should be considered internal and subject to change.
Protocol compiler binary packaging
The protocol compiler is used in binary form in various places. There are rules
which package it, along with commonly used .proto
files, for distribution.
Source distribution packaging
Protobuf releases include source distributions, sliced by target language (C++,
Java, etc.). There are rules in this package to define those source archives.
These depend upon pkg_files
rules elsewhere in the repo to get the contents.
The source distribution files should include the outputs from autogen.sh
, but
this isn't something we can reliably do from Bazel. To produce fully functioning
source distributions, run autogen.sh
before building the archives (this
populates the necessary files directly into the source tree).
C++ runtime binary distribution
The cc_dist_library
rule creates composite libraries from several other
cc_library
targets. Bazel uses a "fine-grained" library model, where each
cc_library
produces its own library artifacts, without transitive
dependencies. The cc_dist_library
rule combines several other libraries
together, creating a single library that may be suitable for distribution.