diff --git a/examples/WORKSPACE.bazel b/examples/WORKSPACE.bazel index 610b2047d4..d1db73fe8e 100644 --- a/examples/WORKSPACE.bazel +++ b/examples/WORKSPACE.bazel @@ -69,6 +69,14 @@ load("@rules_rust//wasm_bindgen/rules_js:repositories.bzl", "js_rust_wasm_bindge js_rust_wasm_bindgen_dependencies() +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains") + +rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION) + ############################################################################### # Workspace examples ############################################################################### @@ -106,17 +114,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") node_repositories() -load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") - -rules_js_dependencies() - -load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") - -nodejs_register_toolchains( - name = "nodejs", - node_version = DEFAULT_NODE_VERSION, -) - load("@bazel_features//:deps.bzl", "bazel_features_deps") bazel_features_deps() diff --git a/wasm_bindgen/private/wasm_bindgen.bzl b/wasm_bindgen/private/wasm_bindgen.bzl index 95a7c0b438..cd382e4777 100644 --- a/wasm_bindgen/private/wasm_bindgen.bzl +++ b/wasm_bindgen/private/wasm_bindgen.bzl @@ -78,6 +78,7 @@ def rust_wasm_bindgen_action(ctx, toolchain, wasm_file, target_output, bindgen_f mnemonic = "RustWasmBindgen", progress_message = "Generating WebAssembly bindings for {}...".format(progress_message_label), arguments = [args], + toolchain = str(Label("//wasm_bindgen:toolchain_type")), ) return RustWasmBindgenInfo( diff --git a/wasm_bindgen/rules_js/defs.bzl b/wasm_bindgen/rules_js/defs.bzl index 37777f2758..9abe5b140b 100644 --- a/wasm_bindgen/rules_js/defs.bzl +++ b/wasm_bindgen/rules_js/defs.bzl @@ -14,20 +14,18 @@ def _js_rust_wasm_bindgen_impl(ctx): bindgen_flags = ctx.attr.bindgen_flags, ) - # Return a structure that is compatible with the deps[] of a ts_library. - declarations = info.ts - es5_sources = info.js - return [ DefaultInfo( files = depset([info.wasm], transitive = [info.js, info.ts]), ), info, + # Return a structure that is compatible with the deps[] of a ts_library. js_info( - declarations = declarations, - sources = es5_sources, - transitive_declarations = declarations, - transitive_sources = es5_sources, + target = ctx.label, + sources = info.js, + transitive_sources = info.js, + types = info.ts, + transitive_types = info.ts, ), ] diff --git a/wasm_bindgen/rules_js/repositories.bzl b/wasm_bindgen/rules_js/repositories.bzl index 5372b5bbc1..5b7cbb3ed1 100644 --- a/wasm_bindgen/rules_js/repositories.bzl +++ b/wasm_bindgen/rules_js/repositories.bzl @@ -14,9 +14,9 @@ def js_rust_wasm_bindgen_dependencies(): maybe( http_archive, name = "aspect_rules_js", - sha256 = "7b2a4d1d264e105eae49a27e2e78065b23e2e45724df2251eacdd317e95bfdfd", - strip_prefix = "rules_js-1.31.0", - url = "https://github.com/aspect-build/rules_js/releases/download/v1.31.0/rules_js-v1.31.0.tar.gz", + sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52", + strip_prefix = "rules_js-2.1.0", + url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz", ) def js_rust_wasm_bindgen_register_toolchains(**kwargs):