Skip to content

Commit de74385

Browse files
avrabeclaude
andcommitted
fix: match http_file directory structure for backward compatibility
The wasm_component_download repository rule now creates files in a 'file/' subdirectory matching the http_file structure, allowing existing references like @repo//file to work unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ec4e133 commit de74385

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

toolchains/wasm_component_download.bzl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,23 @@ def _wasm_component_download_impl(ctx):
5353
url_suffix,
5454
)
5555

56-
# Download the WASM file
56+
# Download the WASM file into 'file/' subdirectory (matches http_file structure)
5757
filename = ctx.attr.filename or "{}.wasm".format(tool_name)
5858
ctx.download(
5959
url = url,
6060
sha256 = sha256,
61-
output = filename,
61+
output = "file/" + filename,
6262
)
6363

64-
# Create BUILD file exposing the WASM component
65-
ctx.file("BUILD.bazel", """
64+
# Create root BUILD file (empty, just marks as package)
65+
ctx.file("BUILD.bazel", "# Generated by wasm_component_download\n")
66+
67+
# Create BUILD file in 'file/' subdirectory (matches http_file structure)
68+
# This allows referencing as @repo//file or @repo//file:file
69+
ctx.file("file/BUILD.bazel", """
6670
# Generated by wasm_component_download
71+
# Matches http_file structure for backward compatibility
72+
6773
exports_files(["{filename}"])
6874
6975
filegroup(
@@ -104,6 +110,6 @@ Example:
104110
filename = "loom.wasm",
105111
)
106112
107-
Then reference as @loom_wasm//:file in build rules.
113+
Then reference as @loom_wasm//file in build rules (matches http_file structure).
108114
""",
109115
)

wasm/private/wasm_optimize.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ wasm_optimize = rule(
7777
),
7878
"_loom_wasm": attr.label(
7979
doc = "LOOM WebAssembly component",
80-
default = "@loom_wasm//file",
80+
default = "@loom_wasm//file:file",
8181
allow_single_file = True,
8282
),
8383
},

0 commit comments

Comments
 (0)