tree: 70dc6a13d3027d715fe4aa7e1d8acb08f3ad2e08 [path history] [tgz]
  1. BUILD.bazel
  2. protobuf-2.8.2.patch
  3. README.md
proto/raze/patch/README.md

Patches

Cargo raze, in its remote mode allows for patches to be applied to a repository before building it with rustc. It is advisable to use this functionality sparingly, if at all. Also note that the patch is applied after all of the dependency resolution has been completed by cargo raze, and that patching the version of a dependency will not cause cargo raze to update that dependency in the BUILD file.

The patch itself can be generated using git or another tool. The output of git diff requires the -p1 option to remove the leading / from the git diff patch format.

protobuf-2.8.2

The protobuf crate from the rust-protobuf repository introduced a build.rs script in the 2.x.x series. This generates a small version.rs file that would be included into lib.rs. However, the build.rs file requires a number of environment variables, normally provided by cargo to the build file. Cargo raze does not provide these variables. The resulting code includes a version string and version identifier. The version string is then used by protobuf-codegen to generate code refering to the identifier in the protobuf library. The use can be seen here. This is to enforce at compile time that the version of protobuf-codegen matches the version of the protobuf crate.

For this crate, the patch that is applied is replacing the include! macro with what would be generated by the build.rs file. This lets us avoid running the build file altogether, at the expense of having to update the patch for every version.