Skip to content

Commit

Permalink
Various cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Feb 8, 2023
1 parent 905731a commit a2703f3
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 32 deletions.
4 changes: 3 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ To build with a particular version of the Rust compiler, pass that version to [`
```python
rust_register_toolchains(
edition = "2021",
versions = ["1.66.1"],
versions = [
"1.66.1"
],
)
```

Expand Down
3 changes: 2 additions & 1 deletion proto/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# buildifier: disable=module-docstring
"""Dependencies for Rust proto rules"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//proto/3rdparty/crates:defs.bzl", "crate_repositories")
Expand Down
3 changes: 2 additions & 1 deletion rust/private/dummy_cc_toolchain/dummy_cc_toolchain.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# buildifier: disable=module-docstring
"""Cc toolchain definitions for use on wasm platforms"""

def _dummy_cc_toolchain_impl(_ctx):
# The `all_files` attribute is referenced by rustc_compile_action().
return [platform_common.ToolchainInfo(all_files = depset([]))]
Expand Down
3 changes: 2 additions & 1 deletion rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# buildifier: disable=module-docstring
"""Rust rule implementations"""

load("@bazel_skylib//lib:paths.bzl", "paths")
load("//rust/private:common.bzl", "rust_common")
load("//rust/private:rustc.bzl", "rustc_compile_action")
Expand Down
23 changes: 2 additions & 21 deletions rust/private/transitions.bzl
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
# buildifier: disable=module-docstring
load("//rust:defs.bzl", "rust_common")

def _wasm_bindgen_transition(_settings, _attr):
"""The implementation of the `wasm_bindgen_transition` transition
Args:
_settings (dict): A dict {String:Object} of all settings declared
in the inputs parameter to `transition()`
_attr (dict): A dict of attributes and values of the rule to which
the transition is attached
Returns:
dict: A dict of new build settings values to apply
"""
return {"//command_line_option:platforms": str(Label("//rust/platform:wasm"))}
"""Internal transition implementations for core Rust rules"""

wasm_bindgen_transition = transition(
implementation = _wasm_bindgen_transition,
inputs = [],
outputs = ["//command_line_option:platforms"],
)
load("//rust:defs.bzl", "rust_common")

def _import_macro_dep_bootstrap_transition(_settings, _attr):
"""The implementation of the `import_macro_dep_bootstrap_transition` transition.
Expand Down
2 changes: 1 addition & 1 deletion rust/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ rust_toolchain = rule(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_pipelined_compilation": attr.label(
default = "@rules_rust//rust/settings:pipelined_compilation",
default = Label("//rust/settings:pipelined_compilation"),
),
"_rename_first_party_crates": attr.label(
default = Label("//rust/settings:rename_first_party_crates"),
Expand Down
3 changes: 2 additions & 1 deletion test/load_arbitrary_tool/load_arbitrary_tool_test.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# buildifier: disable=module-docstring
"""Tests for `load_arbitrary_tool`"""

load("//rust:repositories.bzl", "load_arbitrary_tool")
load("//rust/platform:triple.bzl", "get_host_triple")
load("//rust/platform:triple_mappings.bzl", "system_to_binary_ext")
Expand Down
Empty file.
21 changes: 21 additions & 0 deletions wasm_bindgen/private/transitions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Transition implementations for wasm-bindgen rust Rules"""

def _wasm_bindgen_transition(_settings, _attr):
"""The implementation of the `wasm_bindgen_transition` transition
Args:
_settings (dict): A dict {String:Object} of all settings declared
in the inputs parameter to `transition()`
_attr (dict): A dict of attributes and values of the rule to which
the transition is attached
Returns:
dict: A dict of new build settings values to apply
"""
return {"//command_line_option:platforms": str(Label("//rust/platform:wasm"))}

wasm_bindgen_transition = transition(
implementation = _wasm_bindgen_transition,
inputs = [],
outputs = ["//command_line_option:platforms"],
)
3 changes: 2 additions & 1 deletion wasm_bindgen/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# buildifier: disable=module-docstring
"""Dependency definitions for wasm-bindgen rules"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//wasm_bindgen/3rdparty/crates:defs.bzl", "crate_repositories")
Expand Down
7 changes: 3 additions & 4 deletions wasm_bindgen/wasm_bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# buildifier: disable=module-docstring
load("//rust:defs.bzl", "rust_common")
"""Bazel rules for [wasm-bindgen](https://crates.io/crates/wasm-bindgen)"""

# buildifier: disable=bzl-visibility
load("//rust/private:transitions.bzl", "wasm_bindgen_transition")
load("//rust:defs.bzl", "rust_common")
load(
"//wasm_bindgen:providers.bzl",
"DeclarationInfo",
"JSModuleInfo",
)
load("//wasm_bindgen/private:transitions.bzl", "wasm_bindgen_transition")

_WASM_BINDGEN_DOC = """\
Generates javascript and typescript bindings for a webassembly module using [wasm-bindgen][ws].
Expand Down

0 comments on commit a2703f3

Please sign in to comment.