Skip to content

Renamed wasm_bindgen package to wasm #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_deps")

rust_analyzer_deps()

load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("@rules_rust//wasm:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()

Expand Down
6 changes: 3 additions & 3 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bzl_library(
"@rules_rust//crate_universe:rules",
"@rules_rust//proto:rules",
"@rules_rust//rust:rules",
"@rules_rust//wasm_bindgen:rules",
"@rules_rust//wasm:rules",
],
)

Expand Down Expand Up @@ -132,8 +132,8 @@ PAGES = dict([
],
),
page(
name = "rust_wasm_bindgen",
header_template = ":rust_wasm_bindgen.vm",
name = "rust_wasm",
header_template = ":rust_wasm.vm",
symbols = [
"rust_wasm_bindgen_repositories",
"rust_wasm_bindgen_toolchain",
Expand Down
2 changes: 1 addition & 1 deletion docs/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ load("@rules_rust//proto:transitive_repositories.bzl", "rust_proto_transitive_re

rust_proto_transitive_repositories()

load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("@rules_rust//wasm:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()

Expand Down
6 changes: 3 additions & 3 deletions docs/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ To use the Rust WebAssembly bindgen rules, add the following to your `WORKSPACE`
external repositories for the Rust bindgen toolchain (in addition to the Rust rules setup):

```python
load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("@rules_rust//wasm:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()
```
Expand Down Expand Up @@ -1350,7 +1350,7 @@ rust_bindgen_toolchain(
toolchain(
name = "wasm_bindgen_toolchain",
toolchain = "wasm_bindgen_toolchain_impl",
toolchain_type = "@rules_rust//wasm_bindgen:wasm_bindgen_toolchain",
toolchain_type = "@rules_rust//wasm:wasm_bindgen_toolchain",
)
```

Expand Down Expand Up @@ -1891,7 +1891,7 @@ Declare dependencies needed for [rust_wasm_bindgen](#rust_wasm_bindgen).

| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="rust_wasm_bindgen_repositories-register_default_toolchain"></a>register_default_toolchain | If True, the default [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) (<code>@rules_rust//wasm_bindgen:default_wasm_bindgen_toolchain</code>) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | <code>True</code> |
| <a id="rust_wasm_bindgen_repositories-register_default_toolchain"></a>register_default_toolchain | If True, the default [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) (<code>@rules_rust//wasm:default_wasm_bindgen_toolchain</code>) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | <code>True</code> |


<a id="#rust_analyzer_aspect"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ functional in certain environments.
- [rust_proto](rust_proto.md): rules for generating [protobuf](https://developers.google.com/protocol-buffers).
and [gRPC](https://grpc.io) stubs.
- [rust_bindgen](rust_bindgen.md): rules for generating C++ bindings.
- [rust_wasm_bindgen](rust_wasm_bindgen.md): rules for generating [WebAssembly](https://www.rust-lang.org/what/wasm) bindings.
- [rust_wasm](rust_wasm.md): rules for generating and interracting with [WebAssembly](https://www.rust-lang.org/what/wasm).
- [cargo](cargo.md): Rules dedicated to Cargo compatibility. ie: [`build.rs` scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html).

You can also browse the [full API in one page](flatten.md).
Expand Down
8 changes: 4 additions & 4 deletions docs/rust_wasm_bindgen.md → docs/rust_wasm.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
# Rust Wasm Bindgen
# Rust Wasm

* [rust_wasm_bindgen_repositories](#rust_wasm_bindgen_repositories)
* [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain)
Expand Down Expand Up @@ -40,7 +40,7 @@ To use the Rust WebAssembly bindgen rules, add the following to your `WORKSPACE`
external repositories for the Rust bindgen toolchain (in addition to the Rust rules setup):

```python
load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("@rules_rust//wasm:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()
```
Expand Down Expand Up @@ -84,7 +84,7 @@ rust_bindgen_toolchain(
toolchain(
name = "wasm_bindgen_toolchain",
toolchain = "wasm_bindgen_toolchain_impl",
toolchain_type = "@rules_rust//wasm_bindgen:wasm_bindgen_toolchain",
toolchain_type = "@rules_rust//wasm:wasm_bindgen_toolchain",
)
```

Expand Down Expand Up @@ -124,6 +124,6 @@ Declare dependencies needed for [rust_wasm_bindgen](#rust_wasm_bindgen).

| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="rust_wasm_bindgen_repositories-register_default_toolchain"></a>register_default_toolchain | If True, the default [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) (<code>@rules_rust//wasm_bindgen:default_wasm_bindgen_toolchain</code>) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | <code>True</code> |
| <a id="rust_wasm_bindgen_repositories-register_default_toolchain"></a>register_default_toolchain | If True, the default [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) (<code>@rules_rust//wasm:default_wasm_bindgen_toolchain</code>) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | <code>True</code> |


File renamed without changes.
4 changes: 2 additions & 2 deletions docs/symbols.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ load(
_incompatible_flag = "incompatible_flag",
)
load(
"@rules_rust//wasm_bindgen:repositories.bzl",
"@rules_rust//wasm:repositories.bzl",
_rust_wasm_bindgen_repositories = "rust_wasm_bindgen_repositories",
)
load(
"@rules_rust//wasm_bindgen:wasm_bindgen.bzl",
"@rules_rust//wasm:wasm_bindgen.bzl",
_rust_wasm_bindgen = "rust_wasm_bindgen",
_rust_wasm_bindgen_toolchain = "rust_wasm_bindgen_toolchain",
)
Expand Down
2 changes: 1 addition & 1 deletion examples/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ load("@rules_rust//proto:transitive_repositories.bzl", "rust_proto_transitive_re

rust_proto_transitive_repositories()

load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("@rules_rust//wasm:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()

Expand Down
6 changes: 3 additions & 3 deletions examples/wasm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# buildifier: disable=module-docstring
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_shared_library")
load("@rules_rust//wasm_bindgen:wasm_bindgen.bzl", "rust_wasm_bindgen")
load("@rules_rust//wasm:wasm_bindgen.bzl", "rust_wasm_bindgen")

package(default_visibility = ["//visibility:public"])

Expand All @@ -24,7 +24,7 @@ rust_binary(
srcs = ["main.rs"],
edition = "2018",
deps = [
"@rules_rust//wasm_bindgen/raze:wasm_bindgen",
"@rules_rust//wasm/raze:wasm_bindgen",
],
)

Expand All @@ -33,7 +33,7 @@ rust_shared_library(
srcs = ["main.rs"],
edition = "2018",
deps = [
"@rules_rust//wasm_bindgen/raze:wasm_bindgen",
"@rules_rust//wasm/raze:wasm_bindgen",
],
)

Expand Down
26 changes: 26 additions & 0 deletions wasm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//wasm:wasm_bindgen.bzl", "rust_wasm_bindgen_toolchain")

package(default_visibility = ["//visibility:public"])

toolchain_type(name = "wasm_bindgen_toolchain")

bzl_library(
name = "rules",
srcs = glob(["**/*.bzl"]) + ["//wasm/raze:crates.bzl"],
deps = [
"//rust:rules",
"//wasm/private:bzl_lib",
],
)

rust_wasm_bindgen_toolchain(
name = "default_wasm_bindgen_toolchain_impl",
bindgen = "//wasm/raze:cargo_bin_wasm_bindgen",
)

toolchain(
name = "default_wasm_bindgen_toolchain",
toolchain = "default_wasm_bindgen_toolchain_impl",
toolchain_type = "@rules_rust//wasm:wasm_bindgen_toolchain",
)
8 changes: 8 additions & 0 deletions wasm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Rust WebAssembly Rules

These rules are for interractions between [Rust][rust] and [WebAssembly][wasm].

[rust]: http://www.rust-lang.org/
[wasm]: https://www.rust-lang.org/what/wasm

More information can be found in the [rules_rust documentation](https://bazelbuild.github.io/rules_rust/rust_wasm.html).
8 changes: 8 additions & 0 deletions wasm/private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_visibility = ["//visibility:public"])

bzl_library(
name = "bzl_lib",
srcs = glob(["**/*.bzl"]),
)
8 changes: 4 additions & 4 deletions rust/private/transitions.bzl → wasm/private/transitions.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# buildifier: disable=module-docstring
def _wasm_bindgen_transition(settings, attr):
"""The implementation of the `wasm_bindgen_transition` transition
def _wasm_transition(settings, attr):
"""The implementation of the `wasm_transition` transition

Args:
settings (dict): A dict {String:Object} of all settings declared
Expand All @@ -13,8 +13,8 @@ def _wasm_bindgen_transition(settings, attr):
"""
return {"//command_line_option:platforms": str(Label("//rust/platform:wasm"))}

wasm_bindgen_transition = transition(
implementation = _wasm_bindgen_transition,
wasm_transition = transition(
implementation = _wasm_transition,
inputs = [],
outputs = ["//command_line_option:platforms"],
)
17 changes: 17 additions & 0 deletions wasm/providers.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""A module for re-exporting the providers used by the rust_wasm_bindgen rule"""

load(
"@build_bazel_rules_nodejs//internal/providers:declaration_info.bzl",
_DeclarationInfo = "DeclarationInfo",
)
load(
"@build_bazel_rules_nodejs//internal/providers:js_providers.bzl",
_JSEcmaScriptModuleInfo = "JSEcmaScriptModuleInfo",
_JSModuleInfo = "JSModuleInfo",
_JSNamedModuleInfo = "JSNamedModuleInfo",
)

DeclarationInfo = _DeclarationInfo
JSEcmaScriptModuleInfo = _JSEcmaScriptModuleInfo
JSModuleInfo = _JSModuleInfo
JSNamedModuleInfo = _JSNamedModuleInfo
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion wasm_bindgen/raze/Cargo.toml → wasm/raze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ wasm-bindgen = "0.2.76"

[package.metadata.raze]
genmode = "Remote"
workspace_path = "//wasm_bindgen/raze"
workspace_path = "//wasm/raze"
gen_workspace_prefix = "rules_rust_wasm_bindgen"
rust_rules_workspace_name = "rules_rust"
package_aliases_dir = "."
Expand Down
Loading