fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreMoved rust extension rules into a separate `rules_rust_ext` workspace. (#3007)2bad96d9

cleanup
1.8 KiB52 linesraw
1"""# rules_rust_bindgen
2
3These rules are for using [Bindgen][bindgen] to generate [Rust][rust] bindings to C (and some C++) libraries.
4
5[rust]: http://www.rust-lang.org/
6[bindgen]: https://github.com/rust-lang/rust-bindgen
7
8## Rules
9
10- [rust_bindgen](#rust_bindgen)
11- [rust_bindgen_library](#rust_bindgen_library)
12- [rust_bindgen_toolchain](#rust_bindgen_toolchain)
13
14## Setup
15
16To use the Rust bindgen rules, add the following to your `WORKSPACE` file to add the
17external repositories for the Rust bindgen toolchain (in addition to the [rust rules setup](https://bazelbuild.github.io/rules_rust/#setup)):
18
19```python
20load("@rules_rust_bindgen//:repositories.bzl", "rust_bindgen_dependencies", "rust_bindgen_register_toolchains")
21
22rust_bindgen_dependencies()
23
24rust_bindgen_register_toolchains()
25
26load("@rules_rust_bindgen//:transitive_repositories.bzl", "rust_bindgen_transitive_dependencies")
27
28rust_bindgen_transitive_dependencies()
29```
30
31Bindgen aims to be as hermetic as possible so will end up building `libclang` from [llvm-project][llvm_proj] from
32source. If this is found to be undesirable then no Bindgen related calls should be added to your WORKSPACE and instead
33users should define their own repositories using something akin to [crate_universe][cra_uni] and define their own
34toolchains following the instructions for [rust_bindgen_toolchain](#rust_bindgen_toolchain).
35
36[llvm_proj]: https://github.com/llvm/llvm-project
37[cra_uni]: https://bazelbuild.github.io/rules_rust/crate_universe.html
38
39---
40---
41"""
42
43load(
44    "//private:bindgen.bzl",
45    _rust_bindgen = "rust_bindgen",
46    _rust_bindgen_library = "rust_bindgen_library",
47    _rust_bindgen_toolchain = "rust_bindgen_toolchain",
48)
49
50rust_bindgen = _rust_bindgen
51rust_bindgen_library = _rust_bindgen_library
52rust_bindgen_toolchain = _rust_bindgen_toolchain