protobuf/pkg/README.md
David L. Jones d76f8c868c
Add source distribution packaging rules (#9835)
This change adds `rules_pkg`-based targets that will produce source distribution archives, similar to `make dist`.

These rules produce nearly the same outputs as `make dist`. However, there are some differences and caveats:

1. The outputs do not contain vendored googletest sources.
2. You have to run `autogen.sh` before `blaze build pkg:all`. This produces several autotools-related files directly into the source tree.
3. The output .zip files do not have a directory prefix like `protobuf-3.20.1-rc-1` (this will be addressed after [Substitute package variables in `pkg_zip#package_dir`. bazelbuild/rules_pkg#577](https://github.com/bazelbuild/rules_pkg/pull/577); the tar files do have this prefix, though.)
4. One file is missing from the archives, which is produced during the `make` build: benchmarks/gogo/cpp_no_group/cpp_benchmark.cc
5. In several places, I have explicitly excluded some files that are not in the autotools distribution outputs. I think most of those files should probably be included, but for now, I'm aiming for parity with `make dist`. These are marked with comments, so it should be easy to clean them up later.
2022-04-22 16:58:16 -07:00

1.3 KiB

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.