@@ -140,21 +140,14 @@ def _wasm_toolchain_repository_impl(repository_ctx):
140140 for warning in compatibility_warnings :
141141 print ("Warning: {}" .format (warning ))
142142
143- # All strategies now use modernized approach with git_repository rules
144- # This eliminates ctx.execute() calls for git clone and cargo build operations
143+ # Use download strategy for fast, hermetic builds with prebuilt binaries
145144 if strategy == "download" :
146- _setup_downloaded_tools (repository_ctx ) # Use simple method for stability
147- elif strategy == "build" :
148- _setup_built_tools_enhanced (repository_ctx ) # Modernized: uses git_repository
149- elif strategy == "bazel" :
150- _setup_bazel_native_tools (repository_ctx )
151- elif strategy == "hybrid" :
152- _setup_hybrid_tools_enhanced (repository_ctx ) # Modernized: most robust approach
145+ _setup_downloaded_tools (repository_ctx )
153146 else :
154147 fail (format_diagnostic_error (
155148 "E001" ,
156149 "Unknown strategy: {}" .format (strategy ),
157- "Must be 'download', 'build', 'bazel', or 'hybrid' " ,
150+ "Must be 'download' (other strategies removed in dependency management cleanup) " ,
158151 ))
159152
160153 # Create BUILD files for all strategies
@@ -563,79 +556,20 @@ exit 1
563556""" , executable = True )
564557
565558def _download_wasmsign2 (repository_ctx ):
566- """Setup wasmsign2 placeholder - use bazel strategy for full functionality """
559+ """Setup wasmsign2 placeholder - not available in prebuilt downloads """
567560
568561 print ("Setting up wasmsign2 placeholder for download strategy" )
569562
570- # Create a stub that explains the limitation and recommends the bazel strategy
563+ # Create a stub explaining wasmsign2 is not included in prebuilt downloads
571564 repository_ctx .file ("wasmsign2" , """#!/bin/bash
572- # wasmsign2 stub for download strategy
573- # The download strategy cannot build Rust binaries from source
565+ # wasmsign2 is not included in prebuilt binary downloads
574566echo "wasmsign2: Not available in download strategy" >&2
575- echo "For signing functionality, use strategy = 'bazel' in your MODULE.bazel:" >&2
576- echo " wasm_toolchain.register(strategy = 'bazel')" >&2
577- echo "This enables Bazel-native rust_binary builds with full signing support." >&2
567+ echo "WebAssembly component signing requires building wasmsign2 from source" >&2
568+ echo "For signing functionality, use @wasmsign2_src from git_repository" >&2
578569exit 1
579570""" , executable = True )
580571
581- print ("Created wasmsign2 stub - use bazel strategy for full signing functionality" )
582-
583- def _setup_bazel_native_tools (repository_ctx ):
584- """Setup tools using Bazel-native rust_binary builds instead of cargo"""
585-
586- print ("Setting up Bazel-native toolchain using rust_binary rules" )
587-
588- # For Bazel-native strategy, we don't create any local binaries at all.
589- # Instead, we copy the BUILD files that use rust_binary rules and git_repository sources.
590- # This completely bypasses cargo and uses only Bazel + rules_rust.
591-
592- # Copy the wasm-tools BUILD file that uses rust_binary
593- repository_ctx .template (
594- "BUILD.wasm_tools" ,
595- Label ("//toolchains:BUILD.wasm_tools_bazel" ),
596- )
597-
598- # Copy the wizer BUILD file that uses rust_binary
599- repository_ctx .template (
600- "BUILD.wizer" ,
601- Label ("//toolchains:BUILD.wizer_bazel" ),
602- )
603-
604- # Create placeholder binaries for tools not yet implemented with rust_binary
605- # These will be updated as we add more Bazel-native builds
606-
607- # Create placeholder wac (will be updated to rust_binary later)
608- repository_ctx .file ("wac" , """#!/bin/bash
609- echo "wac: Bazel-native rust_binary not yet implemented"
610- echo "Using placeholder - switch to 'download' strategy in MODULE.bazel for full functionality"
611- echo "To use wac, switch to 'download' strategy in MODULE.bazel"
612- exit 1
613- """ , executable = True )
614-
615- # Create placeholder wit-bindgen (will be updated to rust_binary later)
616- repository_ctx .file ("wit-bindgen" , """#!/bin/bash
617- echo "wit-bindgen: Bazel-native rust_binary not yet implemented"
618- echo "Using download strategy fallback"
619- # For now, fail gracefully and suggest alternative
620- echo "To use wit-bindgen, switch to 'download' strategy in MODULE.bazel"
621- exit 1
622- """ , executable = True )
623-
624- # Create placeholder wrpc (complex build, keep as placeholder)
625- repository_ctx .file ("wrpc" , """#!/bin/bash
626- echo "wrpc: placeholder - complex dependencies"
627- echo "Use system wrpc or download strategy"
628- exit 1
629- """ , executable = True )
630-
631- # Create placeholder wasmsign2 (not critical for core functionality)
632- repository_ctx .file ("wasmsign2" , """#!/bin/bash
633- echo "wasmsign2: not critical for WebAssembly component compilation"
634- echo "Basic functionality available without signing"
635- exit 0
636- """ , executable = True )
637-
638- print ("✅ Bazel-native strategy configured - using rust_binary rules for core tools" )
572+ print ("Created wasmsign2 stub - not included in prebuilt downloads" )
639573
640574def _get_platform_suffix (platform ):
641575 """Get platform suffix for download URLs"""
@@ -702,70 +636,6 @@ wasm_tools_toolchain(
702636 wasmsign2 = ":wasmsign2_binary",
703637)
704638
705- # Toolchain registration
706- toolchain(
707- name = "wasm_tools_toolchain",
708- toolchain = ":wasm_tools_impl",
709- toolchain_type = "@rules_wasm_component//toolchains:wasm_tools_toolchain_type",
710- exec_compatible_with = [],
711- target_compatible_with = [],
712- )
713- """
714- elif strategy == "bazel" :
715- # For Bazel-native strategy, reference rust_binary builds from git repositories
716- build_content = """
717- load("@rules_wasm_component//toolchains:wasm_toolchain.bzl", "wasm_tools_toolchain")
718-
719- package(default_visibility = ["//visibility:public"])
720-
721- # File targets for executables - use Bazel-native rust_binary builds
722- alias(
723- name = "wasm_tools_binary",
724- actual = "@wasm_tools_src//:wasm_tools_bazel",
725- visibility = ["//visibility:public"],
726- )
727-
728- alias(
729- name = "wizer_binary",
730- actual = "@wizer_src//:wizer_bazel",
731- visibility = ["//visibility:public"],
732- )
733-
734- # Remaining tools use local fallback files until rust_binary implementations added
735- filegroup(
736- name = "wac_binary",
737- srcs = ["wac"],
738- visibility = ["//visibility:public"],
739- )
740-
741- filegroup(
742- name = "wit_bindgen_binary",
743- srcs = ["wit-bindgen"],
744- visibility = ["//visibility:public"],
745- )
746-
747- filegroup(
748- name = "wrpc_binary",
749- srcs = ["wrpc"],
750- visibility = ["//visibility:public"],
751- )
752-
753- alias(
754- name = "wasmsign2_binary",
755- actual = "@wasmsign2_src//:wasmsign2_bazel",
756- visibility = ["//visibility:public"],
757- )
758-
759- # Toolchain implementation
760- wasm_tools_toolchain(
761- name = "wasm_tools_impl",
762- wasm_tools = ":wasm_tools_binary",
763- wac = ":wac_binary",
764- wit_bindgen = ":wit_bindgen_binary",
765- wrpc = ":wrpc_binary",
766- wasmsign2 = ":wasmsign2_binary",
767- )
768-
769639# Toolchain registration
770640toolchain(
771641 name = "wasm_tools_toolchain",
@@ -776,7 +646,7 @@ toolchain(
776646)
777647"""
778648 else :
779- # For other strategies ( download, system, hybrid), use local files
649+ # For download strategy, use local downloaded files
780650 build_content = """
781651load("@rules_wasm_component//toolchains:wasm_toolchain.bzl", "wasm_tools_toolchain")
782652
@@ -845,9 +715,9 @@ wasm_toolchain_repository = repository_rule(
845715 implementation = _wasm_toolchain_repository_impl ,
846716 attrs = {
847717 "strategy" : attr .string (
848- doc = "Tool acquisition strategy: 'download', 'build', 'bazel', or 'hybrid'. All strategies now modernized to eliminate ctx.execute() calls. " ,
849- default = "hybrid" , # Hybrid is most robust with git_repository approach
850- values = ["download" , "build" , "bazel" , "hybrid" ],
718+ doc = "Tool acquisition strategy: 'download' only (other strategies removed in dependency management cleanup) " ,
719+ default = "download" ,
720+ values = ["download" ],
851721 ),
852722 "version" : attr .string (
853723 doc = "Version to use (for download/build strategies)" ,
0 commit comments