-
-
Notifications
You must be signed in to change notification settings - Fork 112
WIP: prototype of wasm host as run_binary wrapper #1210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ctx.actions.run( | ||
| outputs = outputs, | ||
| inputs = inputs, | ||
| executable = ctx.executable.tool, | ||
| executable = ctx.executable.tool_launcher, | ||
| arguments = [args], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep running the user-specified tool
The run_binary action now executes only ctx.executable.tool_launcher and never references ctx.executable.tool. Because the tool attribute is no longer added to the action’s inputs or invoked, every run_binary target will invoke the launcher binary regardless of what tool the rule declares, and the declared tool will not even be built when the action runs. This completely regresses the behavior of run_binary and breaks all existing usages of the rule.
Useful? React with 👍 / 👎.
tools/run_binary/main.go
Outdated
| // Load wasm code by reading /Users/alexeagle/Projects/bazel-lib/bazel-bin/path/to/package/tool_/tool.wasm | ||
| wasmCode, err := os.ReadFile("/Users/alexeagle/Projects/bazel-lib/bazel-bin/path/to/package/tool_/tool.wasm") | ||
| if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t hard-code developer path to the WASM binary
The new launcher reads a WASM module from the absolute path /Users/alexeagle/Projects/bazel-lib/bazel-bin/path/to/package/tool_/tool.wasm. That path only exists on the author’s workstation, so the launcher will fail immediately on any other machine, workspace location, or remote executor. There is currently no way for Bazel to tell the launcher which tool to run, making the wrapper unusable for any run_binary target.
Useful? React with 👍 / 👎.
tools/run_binary/main.go
Outdated
| _, err = spawnFunc.Call(store, "bazel-out/darwin_arm64-fastbuild/bin/path/to/package/output.txt") | ||
| if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output path is hard-coded to one platform
The launcher calls the WASM export with the literal path "bazel-out/darwin_arm64-fastbuild/bin/path/to/package/output.txt". This ignores the outs and args declared on the run_binary rule and forces every action to write to a darwin/arm64 fastbuild path, even when the build is running on Linux, on a different configuration, or produces a different file. As written the wrapper cannot produce the outputs requested by the Bazel action, so every run_binary target will either fail or write to the wrong location.
Useful? React with 👍 / 👎.
|


See comments in tools/run_binary/main.go