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