@@ -647,6 +647,8 @@ toolchain(
647647"""
648648 else :
649649 # For download strategy, use local downloaded files
650+ # Windows binaries need .exe extension
651+ exe_suffix = ".exe" if platform == "windows_amd64" else ""
650652 build_content = """
651653load("@rules_wasm_component//toolchains:wasm_toolchain.bzl", "wasm_tools_toolchain")
652654
@@ -655,31 +657,31 @@ package(default_visibility = ["//visibility:public"])
655657# File targets for executables
656658filegroup(
657659 name = "wasm_tools_binary",
658- srcs = ["wasm-tools "],
660+ srcs = ["{wasm_tools_bin} "],
659661 visibility = ["//visibility:public"],
660662)
661663
662664filegroup(
663665 name = "wac_binary",
664- srcs = ["wac "],
666+ srcs = ["{wac_bin} "],
665667 visibility = ["//visibility:public"],
666668)
667669
668670filegroup(
669671 name = "wit_bindgen_binary",
670- srcs = ["wit-bindgen "],
672+ srcs = ["{wit_bindgen_bin} "],
671673 visibility = ["//visibility:public"],
672674)
673675
674676filegroup(
675677 name = "wrpc_binary",
676- srcs = ["wrpc "],
678+ srcs = ["{wrpc_bin} "],
677679 visibility = ["//visibility:public"],
678680)
679681
680682filegroup(
681683 name = "wasmsign2_binary",
682- srcs = ["wasmsign2 "],
684+ srcs = ["{wasmsign2_bin} "],
683685 visibility = ["//visibility:public"],
684686)
685687
@@ -706,7 +708,13 @@ toolchain(
706708# Use the direct target name for explicit, clear toolchain registration
707709# Note: Other aliases removed to prevent dependency cycles
708710# Use the _binary targets directly: wasm_tools_binary, wac_binary, wit_bindgen_binary
709- """
711+ """ .format (
712+ wasm_tools_bin = "wasm-tools{}" .format (exe_suffix ),
713+ wac_bin = "wac{}" .format (exe_suffix ),
714+ wit_bindgen_bin = "wit-bindgen{}" .format (exe_suffix ),
715+ wrpc_bin = "wrpc{}" .format (exe_suffix ),
716+ wasmsign2_bin = "wasmsign2{}" .format (exe_suffix ),
717+ )
710718
711719 # Create main BUILD file with strategy-specific content
712720 repository_ctx .file ("BUILD.bazel" , build_content )
0 commit comments