commit | 23fcf67118a603bfee6d59990f6bbdc229326297 | [log] [tgz] |
---|---|---|
author | UebelAndre <github@uebelandre.com> | Thu Dec 28 08:29:33 2023 -0800 |
committer | GitHub <noreply@github.com> | Thu Dec 28 16:29:33 2023 +0000 |
tree | 1d1610c8b26385013b1e6e13c708cf31f6a65779 | |
parent | 0a9e3b1b1022b44a3ad89497e678366f26956dff [diff] |
Update `rust_bindgen_library` to only link into the direct consumer (#2361) Most uses of [bindgen](https://github.com/rust-lang/rust-bindgen) are via [build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) which typically use either `-Lnative=` to specify linker paths for the current target being built. The way the rules are currently defined, has the bindgen library linked directly into the final library which leads to some annoying ordering errors compared to the same project building with Cargo. This PR aims to support the Cargo style of linking via a `leak_symbols = False` flag, thus changing the dependency graph when linking from: ``` cc_lib -> bindgen -> lib_a -> lib_b -> bin \__________________________________^ ``` to: ``` cc_lib -> bindgen -> lib_a -> lib_b -> bin ``` Note that `leak_symbols` is intended to be used as an escape hatch to restore the original behavior and will be deleted in the future.
This repository provides rules for building Rust projects with Bazel.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust
.
Please refer to the full documentation.