Repository navigation
internal/wasmtools: vendor wasm-tools with WebAssembly - #272
Merged
Merged
Conversation
Collaborator
Author
|
Cool. Time for rebase and squash! |
ydnar
force-pushed
the
ydnar/wasm-tools
branch
from
December 17, 2024 21:08
3c2206d to
8a1a146
Compare
ydnar
marked this pull request as ready for review
December 19, 2024 03:19
ydnar
force-pushed
the
ydnar/wasm-tools
branch
from
December 20, 2024 19:18
ef5da56 to
98cee9b
Compare
all: replace submodule with Cargo-managed wasm-tools CLI * add wasm-tools as git submodule * update Makefile to compile wit/wasm-tools.wasm * use wazero to execute wasm-tools.wasm * Makefile: add a build command * Commit the wasm-tools.wasm file * Makefile: replace path with a variable for the name of the target * wit, Makefile: move wasmtools.go to internal/wasmtools * Remove wasmtools submodule Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com> internal/wasmtools: optimize for size Adding lto, opt-level=z and other options to the cargo.toml reduces the wasm-tools.wasm binary size from 7.8 MBi to 3.5 MBi Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com> wit/testdata_test: implement code review comment Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> internal/wasmtools, wit: change the type of fsMap in Executor.Run to map[fs.FS]string Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> Makefile: change dir to '.' Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> internal/wasmtools, wit: enhance API, disable TinyGo tests, and improve naming * Rename to WasmTools to Instance * Add build tags to disable wasmtools when run under TinyGo * wasmtools_tinygo: New returns a new error * Rename Executor to Runner Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> wit/testdata_test: change t.Skip to t.Log since Skip is not supported in TinyGo Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> internal/wasmtools: add comments to improve readability for the Instance API Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> CHANGELOG: Update with wasm-tools integration details Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> internal/wasmtools, Makefile: add gzip compression for wasm-tools.wasm and update Makefile This adds gzip compression for the wasm-tools.wasm to further reduce the size to 1.2M from 3.5M. Added the wasm file to the .gitignore and thus the remote repo will only have the gzip file. Updated Makefile to zip and unzip the Wasm module. Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com> .github: Add set-up wasm-tools.wasm to the test.yaml and release.yaml Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
ydnar
force-pushed
the
ydnar/wasm-tools
branch
from
December 20, 2024 19:35
98cee9b to
fc712fd
Compare
.github/workflows: remove some (now) unneeded steps
.gitignore: condense internal/wasmtools/.gitignore
internal/wasmtools: use single quotes, add Rust edition
Makefile: update order of wasm-tools.wasm.\* targets)
internal/wasmtools: use gzipped wasm-tools.wasm.gz with sync.Once
internal/wasmtools: rebuild wasm-tools.wasm.gz
CHANGELOG: wordsmith the wasm-tools and Wazero update
internal/wasmtools, wit: remove optional name arg
Removing this did not seem to affect tests.
internal/wasmtools: leave timeout to the caller
Makefile: reorder gzip targets
internal/wasmtools: oops
Makefile: next try
wit: remove check for wasm-tools in PATH
internal/wasmtools, wit: swap key and value types for fsMap
Not all fs.FS are hashable, but all strings are, so use map[string]fs.FS instead.
wit/bindgen: use internal/wasmtools to run wasm-tools in WebAssembly
internal/wasmtools: use wazero.CompilationCache
This speeds up wit/bindgen tests 10x
internal/wasmtools: fix TinyGo impl
internal/wasmtools: remove Runner interface
This wasn’t used anywhere, so removing.
internal/wasmtools: change Run() to accept optional stdout and stderr
internal/wasmtools: move args to varadic trailing arg in Run
wit: (*testing.common).Errorf does not support error-wrapping directive %w
internal/wasmtools, wit/bindgen: additional cleanups for TinyGo and WASI
.github/workflows/test: TinyGo needs wasm-tools for -target=wasip2
.github/dependabot: add internal/wasmtools for Cargo updates
cmd/wit-bindgen-go, internal/{module,witcli}: extract module helper into new package
internal/wasmtools: try to use disk-based compilation cache in TMPDIR
internal/cmd/wasm-tools: add Wazero-based wasm-tools executable
This removes the requirement for wasmtime in the Makefile
Makefile: use Wazero-based internal/cmd/wasm-tools executable instead of Wasmtime
.github/workflows/test: ignore all Markdown files
internal/wasmtools: rebuild wasm-tools.wasm.gz
internal/{cmd/wasm-tools,wasmtools}, wit: default mapping of ./ and / directories
.github/workflows: install wasm wrapped in Go version of wasm-tools
all: revert 26c1e72; Wazero directory handling tricky to manage
Wazero flattens ./ into '', which is treated as /, overriding the / mapping.
Makefile: just use wasm-tools
It’s faster, and works with arbitrary paths.
ydnar
force-pushed
the
ydnar/wasm-tools
branch
from
December 20, 2024 21:01
fc712fd to
a411917
Compare
Mossaka
approved these changes
Dec 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Iteration of #252, squashed and rebased.
internal/cmd/wasm-toolsas a thin CLI wrapper around packageinternal/wasmtools