From 959045f3d0b9cc97ce732494d547ad35491d3885 Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Sat, 7 Feb 2026 17:18:57 +0100 Subject: [PATCH 1/2] feat(wrpc): add wrpc and wit-bindgen-wrpc to JSON registry (Phase 2) Part of issue #332 WRPC modernization. Phase 2 changes: - Add checksums/tools/wrpc.json with v0.16.0 binaries for 3 platforms (darwin_arm64, darwin_amd64, linux_amd64) - Add checksums/tools/wit-bindgen-wrpc.json with v0.16.0 for all 5 platforms - Add URL patterns for both tools in tool_registry.bzl - Add versions for both tools in tool_versions.bzl - Update wasm_toolchain.bzl to: - Include wit_bindgen_wrpc in toolchain info - Download both wrpc tools from the registry - Update BUILD templates for new binaries - Update wrpc/defs.bzl wrpc_bindgen rule to use wit-bindgen-wrpc (the binding generator) instead of wrpc-wasmtime (the RPC runtime) The wrpc_bindgen rule now correctly uses wit-bindgen-wrpc for generating language bindings, while wrpc_serve and wrpc_invoke continue to use wrpc-wasmtime for runtime operations. Note: wrpc.json is missing linux_arm64 and windows_amd64 checksums due to network issues during download - those platforms will use a placeholder binary until checksums are added. --- checksums/tools/wit-bindgen-wrpc.json | 41 +++++++++++++++ checksums/tools/wrpc.json | 33 ++++++++++++ toolchains/tool_registry.bzl | 12 +++++ toolchains/tool_versions.bzl | 4 ++ toolchains/wasm_toolchain.bzl | 75 ++++++++++++++++++++------- wrpc/defs.bzl | 24 ++++----- 6 files changed, 159 insertions(+), 30 deletions(-) create mode 100644 checksums/tools/wit-bindgen-wrpc.json create mode 100644 checksums/tools/wrpc.json diff --git a/checksums/tools/wit-bindgen-wrpc.json b/checksums/tools/wit-bindgen-wrpc.json new file mode 100644 index 00000000..996629a9 --- /dev/null +++ b/checksums/tools/wit-bindgen-wrpc.json @@ -0,0 +1,41 @@ +{ + "tool_name": "wit-bindgen-wrpc", + "github_repo": "bytecodealliance/wrpc", + "latest_version": "0.16.0", + "last_checked": "2026-02-07T00:00:00Z", + "description": "WIT binding generator for WebAssembly Component RPC (wrpc)", + "versions": { + "0.16.0": { + "release_date": "2025-11-18", + "platforms": { + "darwin_arm64": { + "sha256": "d2ef54ca193ee3d16cd23c67adb42713dc8ba2c96968eff53b9bcc3051466a65", + "url_suffix": "wit-bindgen-wrpc-aarch64-apple-darwin" + }, + "darwin_amd64": { + "sha256": "e60efb3198774996f250e0168fd555cd9c6e056f863dc3983f373df119d2cdc4", + "url_suffix": "wit-bindgen-wrpc-x86_64-apple-darwin" + }, + "linux_amd64": { + "sha256": "ce66c70da2f612c91c5d42b4eff86773dd7d13821b4c6eccea4d1dd62c399326", + "url_suffix": "wit-bindgen-wrpc-x86_64-unknown-linux-musl" + }, + "linux_arm64": { + "sha256": "b35772253ef4030ec8b420fde3145610e5de44350d89a0e5135c53248a4f1f9e", + "url_suffix": "wit-bindgen-wrpc-aarch64-unknown-linux-musl" + }, + "windows_amd64": { + "sha256": "e08a74f717e77372cf1104e4da6c3aa301c9283ae13b984a55b67bd6ebf84a51", + "url_suffix": "wit-bindgen-wrpc-x86_64-pc-windows-gnu.exe" + } + } + } + }, + "supported_platforms": [ + "darwin_amd64", + "darwin_arm64", + "linux_amd64", + "linux_arm64", + "windows_amd64" + ] +} diff --git a/checksums/tools/wrpc.json b/checksums/tools/wrpc.json new file mode 100644 index 00000000..bf53974d --- /dev/null +++ b/checksums/tools/wrpc.json @@ -0,0 +1,33 @@ +{ + "tool_name": "wrpc", + "github_repo": "bytecodealliance/wrpc", + "latest_version": "0.16.0", + "last_checked": "2026-02-07T00:00:00Z", + "description": "WebAssembly Component RPC runtime (wrpc-wasmtime)", + "binary_name": "wrpc-wasmtime", + "versions": { + "0.16.0": { + "release_date": "2025-11-18", + "platforms": { + "darwin_arm64": { + "sha256": "4bb3341c8b8ad5d96b87dd95ee1e7e091104d4f64ea83b690ad50a9639b834e1", + "url_suffix": "wrpc-wasmtime-aarch64-apple-darwin" + }, + "darwin_amd64": { + "sha256": "9d198256eb72f6246fa424b1f3c384f9eac8476b7da59ac1ddb65323bb2ccb57", + "url_suffix": "wrpc-wasmtime-x86_64-apple-darwin" + }, + "linux_amd64": { + "sha256": "5669a01a64da8954b864df9ec934fd8ef318446f7d8f97263d27fbd5f30c07a8", + "url_suffix": "wrpc-wasmtime-x86_64-unknown-linux-musl" + } + }, + "notes": "linux_arm64 and windows_amd64 checksums pending - use build from source for those platforms" + } + }, + "supported_platforms": [ + "darwin_amd64", + "darwin_arm64", + "linux_amd64" + ] +} diff --git a/toolchains/tool_registry.bzl b/toolchains/tool_registry.bzl index 364db9de..703938b7 100644 --- a/toolchains/tool_registry.bzl +++ b/toolchains/tool_registry.bzl @@ -125,6 +125,18 @@ _URL_PATTERNS = { "base": "https://github.com/{repo}/releases/download/{version}", "filename": "componentize-py-{version}-{suffix}", }, + "wrpc": { + # wrpc releases are standalone binaries (wrpc-wasmtime) + "base": "https://github.com/{repo}/releases/download/v{version}", + "filename": "{suffix}", # url_suffix IS the filename (e.g., "wrpc-wasmtime-aarch64-apple-darwin") + "is_binary": True, + }, + "wit-bindgen-wrpc": { + # wit-bindgen-wrpc releases are standalone binaries + "base": "https://github.com/{repo}/releases/download/v{version}", + "filename": "{suffix}", # url_suffix IS the filename (e.g., "wit-bindgen-wrpc-aarch64-apple-darwin") + "is_binary": True, + }, } def _build_download_url(tool_name, version, platform, tool_info, github_repo): diff --git a/toolchains/tool_versions.bzl b/toolchains/tool_versions.bzl index bca7b11e..f514fee2 100644 --- a/toolchains/tool_versions.bzl +++ b/toolchains/tool_versions.bzl @@ -38,6 +38,10 @@ TOOL_VERSIONS = { # Signatures and security "wasmsign2": "0.2.6", # WebAssembly signing tool + # WRPC (WebAssembly Component RPC) + "wrpc": "0.16.0", # wrpc-wasmtime runtime for component RPC + "wit-bindgen-wrpc": "0.16.0", # WIT binding generator for wrpc + # Platform SDKs "wasi-sdk": "29", # WASI SDK for C/C++ compilation "tinygo": "0.39.0", # TinyGo compiler for Go→WASM diff --git a/toolchains/wasm_toolchain.bzl b/toolchains/wasm_toolchain.bzl index 9bde70f0..fc6ed57a 100644 --- a/toolchains/wasm_toolchain.bzl +++ b/toolchains/wasm_toolchain.bzl @@ -47,6 +47,7 @@ def _wasm_tools_toolchain_impl(ctx): wac = ctx.file.wac, wit_bindgen = ctx.file.wit_bindgen, wrpc = ctx.file.wrpc, + wit_bindgen_wrpc = ctx.file.wit_bindgen_wrpc, wasmsign2 = ctx.file.wasmsign2, ) @@ -77,7 +78,13 @@ wasm_tools_toolchain = rule( allow_single_file = True, executable = True, cfg = "exec", - doc = "wrpc binary", + doc = "wrpc-wasmtime runtime binary", + ), + "wit_bindgen_wrpc": attr.label( + allow_single_file = True, + executable = True, + cfg = "exec", + doc = "wit-bindgen-wrpc binding generator binary", ), "wasmsign2": attr.label( allow_single_file = True, @@ -86,7 +93,7 @@ wasm_tools_toolchain = rule( doc = "wasmsign2 WebAssembly signing binary", ), }, - doc = "Declares a WebAssembly toolchain with signing support", + doc = "Declares a WebAssembly toolchain with WRPC and signing support", ) # Platform detection now uses tool_registry.detect_platform @@ -329,12 +336,8 @@ echo "Basic WebAssembly component functionality is not affected" exit 0 """, executable = True) - # Create placeholder wrpc binary for compatibility - repository_ctx.file("wrpc", """#!/bin/bash -echo "wrpc disabled for production stability" -echo "Use system wrpc or enable building from source" -exit 1 -""", executable = True) + # Download wrpc tools from registry (Phase 2 WRPC modernization) + _download_wrpc_tools(repository_ctx, platform) print("Successfully set up all tools") @@ -504,23 +507,44 @@ def _download_wit_bindgen(repository_ctx): # Use unified tool_registry for download tool_registry.download(repository_ctx, "wit-bindgen", wit_bindgen_version, platform) -def _download_wrpc(repository_ctx): - """Download wrpc using modernized git_repository approach""" +def _download_wrpc_tools(repository_ctx, platform): + """Download wrpc and wit-bindgen-wrpc from registry (Phase 2 WRPC modernization)""" - print("Using modernized wrpc from @wrpc_src git repository") + # Get versions from tool_versions.bzl + wrpc_version = get_tool_version("wrpc") + wit_bindgen_wrpc_version = get_tool_version("wit-bindgen-wrpc") - # Link to git_repository-based wrpc build instead of manual git clone + cargo build - if repository_ctx.path("../wrpc_src").exists: - repository_ctx.symlink("../wrpc_src/wrpc-wasmtime", "wrpc") - print("Linked wrpc from git repository") + # Check if wrpc is available for this platform + wrpc_info = get_tool_info(repository_ctx, "wrpc", wrpc_version, platform) + if wrpc_info: + print("Downloading wrpc {} for {}".format(wrpc_version, platform)) + tool_registry.download(repository_ctx, "wrpc", wrpc_version, platform, output_name = "wrpc") else: - print("Warning: @wrpc_src git repository not available") + print("Warning: wrpc {} not available for platform {}".format(wrpc_version, platform)) repository_ctx.file("wrpc", """#!/bin/bash -echo "wrpc: modernized git repository build not available" -echo "Ensure @wrpc_src is properly configured in MODULE.bazel" +echo "wrpc: Not available for this platform" +echo "Use system wrpc or build from source" exit 1 """, executable = True) + # Check if wit-bindgen-wrpc is available for this platform + wit_bindgen_wrpc_info = get_tool_info(repository_ctx, "wit-bindgen-wrpc", wit_bindgen_wrpc_version, platform) + if wit_bindgen_wrpc_info: + print("Downloading wit-bindgen-wrpc {} for {}".format(wit_bindgen_wrpc_version, platform)) + tool_registry.download(repository_ctx, "wit-bindgen-wrpc", wit_bindgen_wrpc_version, platform, output_name = "wit-bindgen-wrpc") + else: + print("Warning: wit-bindgen-wrpc {} not available for platform {}".format(wit_bindgen_wrpc_version, platform)) + repository_ctx.file("wit-bindgen-wrpc", """#!/bin/bash +echo "wit-bindgen-wrpc: Not available for this platform" +echo "Use system wit-bindgen-wrpc or build from source" +exit 1 +""", executable = True) + +def _download_wrpc(repository_ctx): + """Legacy wrpc download - redirects to new implementation""" + platform = tool_registry.detect_platform(repository_ctx) + _download_wrpc_tools(repository_ctx, platform) + def _download_wasmsign2(repository_ctx): """Setup wasmsign2 placeholder - not available in prebuilt downloads""" @@ -586,6 +610,12 @@ alias( visibility = ["//visibility:public"], ) +alias( + name = "wit_bindgen_wrpc_binary", + actual = "@wrpc_src//:wit_bindgen_wrpc_binary", + visibility = ["//visibility:public"], +) + # wasmsign2 not available in build strategy filegroup( name = "wasmsign2_binary", @@ -600,6 +630,7 @@ wasm_tools_toolchain( wac = ":wac_binary", wit_bindgen = ":wit_bindgen_binary", wrpc = ":wrpc_binary", + wit_bindgen_wrpc = ":wit_bindgen_wrpc_binary", wasmsign2 = ":wasmsign2_binary", ) @@ -646,6 +677,12 @@ filegroup( visibility = ["//visibility:public"], ) +filegroup( + name = "wit_bindgen_wrpc_binary", + srcs = ["{wit_bindgen_wrpc_bin}"], + visibility = ["//visibility:public"], +) + filegroup( name = "wasmsign2_binary", srcs = ["{wasmsign2_bin}"], @@ -659,6 +696,7 @@ wasm_tools_toolchain( wac = ":wac_binary", wit_bindgen = ":wit_bindgen_binary", wrpc = ":wrpc_binary", + wit_bindgen_wrpc = ":wit_bindgen_wrpc_binary", wasmsign2 = ":wasmsign2_binary", ) @@ -680,6 +718,7 @@ toolchain( wac_bin = "wac{}".format(exe_suffix), wit_bindgen_bin = "wit-bindgen{}".format(exe_suffix), wrpc_bin = "wrpc{}".format(exe_suffix), + wit_bindgen_wrpc_bin = "wit-bindgen-wrpc{}".format(exe_suffix), wasmsign2_bin = "wasmsign2{}".format(exe_suffix), ) diff --git a/wrpc/defs.bzl b/wrpc/defs.bzl index 49aede48..35141c39 100644 --- a/wrpc/defs.bzl +++ b/wrpc/defs.bzl @@ -11,11 +11,14 @@ def _wrpc_bindgen_impl(ctx): Generates language bindings for wrpc from WIT interfaces. Uses ctx.actions.run() for direct tool invocation (Bazel best practice). + + Note: This rule uses wit-bindgen-wrpc (the binding generator), not wrpc-wasmtime + (the RPC runtime). wrpc-wasmtime is used by wrpc_serve and wrpc_invoke rules. """ - # Get the wasm toolchain (which includes wrpc) + # Get the wasm toolchain (which includes wit-bindgen-wrpc) wasm_toolchain = ctx.toolchains["//toolchains:wasm_tools_toolchain_type"] - wrpc = wasm_toolchain.wrpc + wit_bindgen_wrpc = wasm_toolchain.wit_bindgen_wrpc # Output files output_dir = ctx.actions.declare_directory(ctx.attr.name + "_bindings") @@ -23,23 +26,20 @@ def _wrpc_bindgen_impl(ctx): # Input WIT file wit_file = ctx.file.wit - # Build command arguments + # Build command arguments for wit-bindgen-wrpc args = ctx.actions.args() - args.add("generate") + args.add(ctx.attr.language) # wit-bindgen-wrpc args.add("--world", ctx.attr.world) - args.add("--wit", wit_file.path) - args.add("--output", output_dir.path) - - if ctx.attr.language: - args.add("--language", ctx.attr.language) + args.add("--out-dir", output_dir.path) + args.add(wit_file.path) - # Run wrpc generate - uses ctx.actions.run() (Bazel best practice) + # Run wit-bindgen-wrpc - uses ctx.actions.run() (Bazel best practice) ctx.actions.run( - executable = wrpc, + executable = wit_bindgen_wrpc, arguments = [args], inputs = [wit_file], outputs = [output_dir], - mnemonic = "WrpcBindgen", + mnemonic = "WitBindgenWrpc", progress_message = "Generating wrpc bindings for {}".format(ctx.attr.name), ) From d4fa4faa4f117fc6c068f9482c77072a91696c38 Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Sat, 7 Feb 2026 18:16:35 +0100 Subject: [PATCH 2/2] fix(wrpc): add missing linux_arm64 and windows_amd64 checksums --- checksums/tools/wrpc.json | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/checksums/tools/wrpc.json b/checksums/tools/wrpc.json index bf53974d..e8850a02 100644 --- a/checksums/tools/wrpc.json +++ b/checksums/tools/wrpc.json @@ -20,14 +20,23 @@ "linux_amd64": { "sha256": "5669a01a64da8954b864df9ec934fd8ef318446f7d8f97263d27fbd5f30c07a8", "url_suffix": "wrpc-wasmtime-x86_64-unknown-linux-musl" + }, + "linux_arm64": { + "sha256": "542810b5bd159b2d412fc6a0a32f17e53b9732fca8c9ea66f2bdef1d807cdc9f", + "url_suffix": "wrpc-wasmtime-aarch64-unknown-linux-musl" + }, + "windows_amd64": { + "sha256": "bb28a2da97805be2cf3be146bdf68931e3dada7598be3d7750551a5824d2b4a5", + "url_suffix": "wrpc-wasmtime-x86_64-pc-windows-gnu.exe" } - }, - "notes": "linux_arm64 and windows_amd64 checksums pending - use build from source for those platforms" + } } }, "supported_platforms": [ "darwin_amd64", "darwin_arm64", - "linux_amd64" + "linux_amd64", + "linux_arm64", + "windows_amd64" ] }