fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
a7aba2d0
main
1""" # rules_rust_wasm_bindgen 2 3Bazel rules for generating wasm modules for Javascript using [wasm-bindgen][wb]. 4 5## Rules 6 7- [rust_wasm_bindgen](#rust_wasm_bindgen) 8- [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) 9 10## Setup 11 12To begin using the `wasm-bindgen` rules, users can load the necessary dependencies 13in their workspace by adding the following to their `WORKSPACE.bazel` file. 14 15```python 16load("@rules_rust_wasm_bindgen//:repositories.bzl", "rust_wasm_bindgen_dependencies", "rust_wasm_bindgen_register_toolchains") 17 18rust_wasm_bindgen_dependencies() 19 20rust_wasm_bindgen_register_toolchains() 21``` 22 23This should enable users to start using the [rust_wasm_bindgen](#rust_wasm_bindgen) 24rule. However, it's common to want to control the version of `wasm-bindgen` in the 25workspace instead of relying on the one provided by `rules_rust`. In this case, users 26should avoid calling `rust_wasm_bindgen_register_toolchains` and instead use the 27[rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) rule to define their own 28toolchains to register in the workspace. 29 30## Interfacing with Javascript rules 31 32While it's recommended for users to mantain their own , in the 33`@rules_rust_wasm_bindgen` package there exists interface sub-packages for various 34Javascript Bazel rules. E.g. `aspect_rules_js`. The rules defined there are a more 35convenient way to use `rust_wasm_bindgen` with the associated javascript rules due 36to the inclusion of additional providers. Each directory contains a `defs.bzl` file 37that defines the different variants of `rust_wasm_bindgen`. (e.g. `js_rust_wasm_bindgen` 38for the `rules_js` submodule). 39 40 41[wb]: https://github.com/rustwasm/wasm-bindgen 42""" 43 44load ( 45"//:providers.bzl" , 46_RustWasmBindgenInfo = "RustWasmBindgenInfo" , 47) 48load ( 49"//private:wasm_bindgen.bzl" , 50_rust_wasm_bindgen = "rust_wasm_bindgen" , 51_rust_wasm_bindgen_toolchain = "rust_wasm_bindgen_toolchain" , 52) 53 54rust_wasm_bindgen = _rust_wasm_bindgen 55rust_wasm_bindgen_toolchain = _rust_wasm_bindgen_toolchain 56RustWasmBindgenInfo = _RustWasmBindgenInfo