Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ register_toolchains("@nodejs_toolchains//:all")
register_toolchains("@jco_toolchain//:jco_toolchain")

# File Operations Component toolchain for universal file handling
register_toolchains("//toolchains:file_ops_toolchain_local")
register_toolchains("//toolchains:file_ops_toolchain_target")

# External File Operations Component from bazel-file-ops-component
# Phase 2: External component with LOCAL AOT compilation
Expand Down
18 changes: 9 additions & 9 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions checksums/registry.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,14 @@ def _get_fallback_checksums(tool_name):
"sha256": "052ad773397dc9e5aa99fb4cfef694175e6b1e81bb2ad1d3c8e7b3fc81441b7c",
"url_suffix": "linux.tar.gz",
},
"windows_amd64": {
"sha256": "6c19b820577486f00332ad8d04ac506da67b0892316b8d485371a58cbf216dee",
"url_suffix": "x86_64-windows.tar.gz",
},
"windows_arm64": {
"sha256": "7b6eb58c88e5bd0913a90e5a8f63cb898b82372088b4c7537390a990ed03f9cd",
"url_suffix": "arm64-windows.tar.gz",
},
},
},
"27": {
Expand Down
30 changes: 20 additions & 10 deletions checksums/tools/wac.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@
"platforms": {
"linux_amd64": {
"sha256": "ce30f33c5bc40095cfb4e74ae5fb4ba515d4f4bef2d597831bc7afaaf0d55b6c",
"url_suffix": "x86_64-unknown-linux-musl"
"url_suffix": "x86_64-unknown-linux-musl",
"platform_name": "x86_64-unknown-linux-musl"
},
"linux_arm64": {
"sha256": "3b78ae7c732c1376d1c21b570d07152a07342e9c4f75bff1511cde5f6af01f12",
"url_suffix": "aarch64-unknown-linux-musl"
"url_suffix": "aarch64-unknown-linux-musl",
"platform_name": "aarch64-unknown-linux-musl"
},
"darwin_amd64": {
"sha256": "d5fa365a4920d19a61837a42c9273b0b8ec696fd3047af864a860f46005773a5",
"url_suffix": "x86_64-apple-darwin"
"url_suffix": "x86_64-apple-darwin",
"platform_name": "x86_64-apple-darwin"
},
"darwin_arm64": {
"sha256": "f08496f49312abd68d9709c735a987d6a17d2295a1240020d217a9de8dcaaacd",
"url_suffix": "aarch64-apple-darwin"
"url_suffix": "aarch64-apple-darwin",
"platform_name": "aarch64-apple-darwin"
},
"windows_amd64": {
"sha256": "b3509dfc3bb9d1e598e7b2790ef6efe5b6c8b696f2ad0e997e9ae6dd20bb6f13",
"url_suffix": "x86_64-pc-windows-gnu"
"url_suffix": "x86_64-pc-windows-gnu",
"platform_name": "x86_64-pc-windows-gnu"
}
}
},
Expand All @@ -34,23 +39,28 @@
"platforms": {
"linux_amd64": {
"sha256": "9fee2d8603dc50403ebed580b47b8661b582ffde8a9174bf193b89ca00decf0f",
"url_suffix": "x86_64-unknown-linux-musl"
"url_suffix": "x86_64-unknown-linux-musl",
"platform_name": "x86_64-unknown-linux-musl"
},
"linux_arm64": {
"sha256": "af966d4efbd411900073270bd4261ac42d9550af8ba26ed49288bb942476c5a9",
"url_suffix": "aarch64-unknown-linux-musl"
"url_suffix": "aarch64-unknown-linux-musl",
"platform_name": "aarch64-unknown-linux-musl"
},
"darwin_amd64": {
"sha256": "cc58f94c611b3b7f27b16dd0a9a9fc63c91c662582ac7eaa9a14f2dac87b07f8",
"url_suffix": "x86_64-apple-darwin"
"url_suffix": "x86_64-apple-darwin",
"platform_name": "x86_64-apple-darwin"
},
"darwin_arm64": {
"sha256": "6ca7f69f3e2bbab41f375a35e486d53e5b4968ea94271ea9d9bd59b0d2b65c13",
"url_suffix": "aarch64-apple-darwin"
"url_suffix": "aarch64-apple-darwin",
"platform_name": "aarch64-apple-darwin"
},
"windows_amd64": {
"sha256": "7ee34ea41cd567b2578929acce3c609e28818d03f0414914a3939f066737d872",
"url_suffix": "x86_64-pc-windows-gnu"
"url_suffix": "x86_64-pc-windows-gnu",
"platform_name": "x86_64-pc-windows-gnu"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions go/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ def _compile_tinygo_module(ctx, tinygo, go_binary, wasm_opt_binary, wasm_tools,
"CGO_ENABLED": "0",
"GO111MODULE": "on",
"GOPROXY": "direct",
"GOFLAGS": "-mod=mod", # Explicitly enable module mode, don't search for .git
"HOME": temp_cache_dir.path,
"TMPDIR": temp_cache_dir.path,
"PATH": path_env,
Expand Down Expand Up @@ -712,6 +713,18 @@ def _compile_tinygo_module(ctx, tinygo, go_binary, wasm_opt_binary, wasm_tools,
"# Change to Go module directory and execute TinyGo",
"cd \"$EXECROOT/{}\"".format(go_module_files.path),
"",
"# Make entire directory tree writable (Bazel output directories are read-only)",
"chmod -R +w . 2>/dev/null || true",
"",
"# Create or update go.mod to prevent Go from searching parent directories",
"# TinyGo/Go module resolution can find .git/config in parent and fail if go.mod is missing",
"if [ ! -f go.mod ]; then",
" cat > go.mod <<'GOMOD'",
"module example.com/calculator",
"go 1.21",
"GOMOD",
"fi",
"",
])

# Add the TinyGo command with arguments, adjusting paths to be absolute
Expand Down Expand Up @@ -831,6 +844,7 @@ go_wasm_component = rule(
"@rules_wasm_component//toolchains:tinygo_toolchain_type",
"@rules_wasm_component//toolchains:wasm_tools_toolchain_type",
"@rules_wasm_component//toolchains:file_ops_toolchain_type",
"@rules_wasm_component//toolchains:wasmtime_toolchain_type",
],
doc = """Builds a WebAssembly component from Go source using TinyGo + WASI Preview 2.

Expand Down
4 changes: 2 additions & 2 deletions rust/rust_wasm_component_bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ with open(sys.argv[3], 'w') as f:
"workspace_dir": ".",
"operations": [{
"type": "concatenate_files",
"input_files": [temp_wrapper.path, ctx.file.bindgen.path],
"output_file": out_file.path,
"src_paths": [temp_wrapper.path, ctx.file.bindgen.path],
"dest_path": out_file.path,
}],
}),
)
Expand Down
56 changes: 6 additions & 50 deletions toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -204,35 +204,23 @@ bzl_library(
# Note: C++ toolchain configuration has been moved to @wasi_sdk repository
# The cc_toolchain is now registered via @wasi_sdk//:cc_toolchain in MODULE.bazel

# Phase 4 Complete: External File Operations Component
# The external pre-built WASM component is now the standard
# See https://github.com/pulseengine/bazel-file-ops-component for component source

file_ops_toolchain(
name = "file_ops_toolchain_impl",
file_ops_component = "//tools/file_ops:file_ops",
wasm_component = "@file_ops_component_external//file",
wit_files = ["//tools/file_ops:wit_files"],
)

toolchain(
name = "file_ops_toolchain_local",
# Universal toolchain - works on all platforms
name = "file_ops_toolchain_target",
toolchain = ":file_ops_toolchain_impl",
toolchain_type = ":file_ops_toolchain_type",
)

# Phase 1 Integration: External File Operations Component from bazel-file-ops-component
# This uses the pre-built WASM component from https://github.com/pulseengine/bazel-file-ops-component

file_ops_toolchain(
name = "file_ops_toolchain_external_impl",
file_ops_component = "//tools/file_ops_external:file_ops_external",
wit_files = ["//tools/file_ops:wit_files"],
)

toolchain(
name = "file_ops_toolchain_external",
# External component toolchain (opt-in for Phase 1)
toolchain = ":file_ops_toolchain_external_impl",
toolchain_type = ":file_ops_toolchain_type",
)

wasm_tools_component_toolchain(
name = "wasm_tools_component_toolchain_impl",
wasm_tools_component = "//tools/wasm_tools_component:wasm_tools_component",
Expand All @@ -258,23 +246,6 @@ string_flag(
],
)

# File Operations Source Selection
# Phase 3: DEPRECATION - Embedded component will be removed in v2.0.0
#
# The embedded component (tools/file_ops/) is DEPRECATED and will be removed in v2.0.0.
# See docs/MIGRATION.md for migration guide.
#
# Default is "external" with AOT support (100x faster startup)
# Only use "embedded" if you encounter critical issues - this option will be removed soon.
string_flag(
name = "file_ops_source",
build_setting_default = "external", # Phase 2+: External with AOT is default
values = [
"embedded", # DEPRECATED - Will be removed in v2.0.0 (Phase 4)
"external", # RECOMMENDED - External component with AOT (default)
],
)

# Configuration settings for implementation selection
config_setting(
name = "file_ops_use_tinygo",
Expand All @@ -297,20 +268,5 @@ config_setting(
},
)

# Configuration settings for source selection (Phase 2: External with AOT is default)
config_setting(
name = "file_ops_use_embedded",
flag_values = {
":file_ops_source": "embedded",
},
)

config_setting(
name = "file_ops_use_external",
flag_values = {
":file_ops_source": "external",
},
)

# WASI Preview 1 Component Adapter
exports_files(["wasi_snapshot_preview1.command.wasm"])
10 changes: 9 additions & 1 deletion toolchains/file_ops_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ def _file_ops_toolchain_impl(ctx):

return [platform_common.ToolchainInfo(
file_ops_component = ctx.executable.file_ops_component,
file_ops_wasm_component = ctx.file.wasm_component,
file_ops_info = struct(
component = ctx.executable.file_ops_component,
wit_files = ctx.files.wit_files,
wasm_component = ctx.file.wasm_component,
),
)]

Expand All @@ -24,6 +26,12 @@ file_ops_toolchain = rule(
cfg = "exec",
doc = "File Operations Component executable",
),
"wasm_component": attr.label(
mandatory = True,
allow_single_file = [".wasm"],
cfg = "exec",
doc = "WASM component file for file operations",
),
"wit_files": attr.label_list(
allow_files = [".wit"],
doc = "WIT interface files for the component",
Expand All @@ -39,7 +47,7 @@ def _file_ops_toolchain_repository_impl(repository_ctx):
repository_ctx.file("BUILD.bazel", """
load("@rules_wasm_component//toolchains:file_ops_toolchain.bzl", "file_ops_toolchain")

# File Operations Toolchain using built component
# File Operations Toolchain using external WASM component
file_ops_toolchain(
name = "file_ops_toolchain_impl",
file_ops_component = "@rules_wasm_component//tools/file_ops:file_ops",
Expand Down
Loading
Loading