Skip to content

buck2-based build system #226

@andreiltd

Description

@andreiltd

Hi everyone 👋

I've been working on an experimental fork of this repo that replaces the python build scripts with buck2, and I'd love to get your thoughts on whether this direction could be useful for the project.

I hope this won't start a "which build system is better" debate, they're all equally bad in their own ways 😄 I ended up using buck2 simply because I already had a collection of wasm component model rules written for other stuff, and starlark's syntax felt like a good fit given that the existing project infrastructure is python.

My primary goal with introducing a build system was to improve the dx for contributors working on wasi-testsuite itself: making it easy to build, test, and iterate without manual toolchain setup. The existing Python test runner and adapter architecture already serves great as a generic framework for downstream embedders.

You can start here to get a feel for how it works:

https://github.com/andreiltd/wasi-testsuite?tab=readme-ov-file#using-buck2

Some of the highlights:

  • Buck2 downloads all toolchains automatically using http_archive macro as a build step, for example runtimes, are pinned using bzl file
  • C and Rust tests are compiled using Buck2's built-in polyglot cxx_binary and rust_binary rules, for example
  • wasi-sdk, wasm-tools, nodejs and asc compiler are also downloaded hermetically as build step, see toolchian definition.
  • Build and test on Linux, macOS, and Windows from a single workflow. Results match upstream.
  • The existing python adapters and runners are reused as-is,
  • I went an extra mile and wrote a simple build step ./buck2 build //tests:dist that produces a self-contained .tar.gz with manifest, prebuilt wasm binaries, configs, and fixtures. This can be used instead of prod/testsuite-base branch, after extracting, the runner can just do: ./run-tests wasi-testsuite/ -r adapters/wasmtime.py. I've used the package to create a rolling GH release of test suite.

I'm genuinely curious whether this direction would be interesting for the project. It's not finished yet, but if there is an interest I can polish it and materialize some PRs. Thanks! 🙏

cc: @saulecabrera @alexcrichton @yoshuawuyts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions