feat(cli): support building WASM via podman

Previously, `tree-sitter build-wasm` had the ability to build WASM
by using docker to pull in an image with a complete emscripten toolchain.
This commit adds the ability to use podman to do the same thing.

Using podman requires two notable changes:
1. Using the fully-qualified image name. Docker defaults to prepending
    `docker.io` to the image name, but podman does not.
2. Podman will mount the `/src/` volume as belonging to root unless
  `--userns=keep-id` is passed. I think podman's different
  volume-ownership is related to podman's daemonless execution and
  `--uidmap` functionality, but I'm not 100% sure.

To test, I ran
```sh
script/fetch-fixtures
script/generate-fixtures
script/generate-fixtures-wasm # <- the important one!
```

which worked as well as the docker version.
This commit is contained in:
Steven Kalt 2023-12-08 19:42:53 -05:00 committed by Amaan Qureshi
parent 78c297e6ed
commit d35efd4608
No known key found for this signature in database
GPG key ID: E67890ADC4227273
5 changed files with 119 additions and 49 deletions

View file

@ -291,9 +291,9 @@ fn run() -> Result<()> {
.alias("bw")
.about("Compile a parser to WASM")
.arg(
Arg::with_name("docker")
.long("docker")
.help("Run emscripten via docker even if it is installed locally"),
Arg::with_name("docker").long("docker").help(
"Run emscripten via docker or podman even if it is installed locally",
),
)
.arg(Arg::with_name("path").index(1).multiple(true)),
)