1# Patches 2 3Details related to patches required for the rules_rust protobuf rules. 4 5## protobuf-2.8.2 6 7The protobuf crate from the rust-protobuf repository introduced a build.rs 8script in the 2.x.x series. This generates a small version.rs file that would be 9[included into lib.rs](https://github.com/stepancheg/rust-protobuf/blob/v2.8/protobuf/src/lib.rs#L122). 10However, the build.rs file requires a number of environment variables, normally 11provided by cargo to the build file. Crate Universe does not provide these 12variables. The resulting code includes a version string and version identifier. 13The version string is then used by protobuf-codegen to generate code refering to 14the identifier in the protobuf library. The use can be seen 15[here](https://github.com/stepancheg/rust-protobuf/blob/v2.8/protobuf-codegen/src/lib.rs#L160). 16This is to enforce at compile time that the version of protobuf-codegen matches 17the version of the protobuf crate. 18 19For this crate, the patch that is applied is replacing the include! macro with 20what would be generated by the build.rs file. This lets us avoid running the 21build file altogether, at the expense of having to update the patch for every 22version. 23 24 25## com_google_protobuf-v3.10.0-bzl_visibility 26 27The patches here provide the required visibility to `*.bzl` files used by the rules defined in `com_google_protobuf`. 28