feat(gfx): integrate wasi-gfx for loading and presenting GUI
CI / test (push) Successful in 24s

This commit is contained in:
Antigravity committed 2026-11-25 02:54:03 +00:00
1 parent ccb809bdc3
commit 7caadb3f7f
59 files changed
+7495 -16

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Build wasi-gfx GUI loader MoonBit component from wit/gfx/ and transpile with jco.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT"
export PATH="$ROOT/.tools/bin:$HOME/.moon/bin:$PATH"
JCO="$ROOT/host/node_modules/.bin/jco"
[ -x "$JCO" ] || { echo "error: jco missing; run: (cd host && npm ci)" >&2; exit 1; }
wasm-tools component wit wit/gfx >/dev/null
moon build --target wasm --release components/gfx-gui/gen 2>&1 | grep -v -E 'Warning|^\s*$|[│╭╰─]' || true
[ "${PIPESTATUS[0]}" -eq 0 ] || { echo "error: moon build failed" >&2; exit 1; }
mkdir -p build/components build/jco
core="_build/wasm/release/build/components/gfx-gui/gen/gen.wasm"
[ -f "$core" ] || { echo "error: $core missing" >&2; exit 1; }
out="build/components/gfx-gui.wasm"
wasm-tools component embed wit/gfx "$core" --world gui-loader --encoding utf16 -o "build/components/gfx-gui.embed.wasm"
wasm-tools component new "build/components/gfx-gui.embed.wasm" -o "$out"
rm -f "build/components/gfx-gui.embed.wasm"
wasm-tools validate --features component-model "$out"
wasm-tools component targets --world gui-loader wit/gfx "$out" >/dev/null
rm -rf "build/jco/gfx-gui"
"$JCO" transpile "$out" -o "build/jco/gfx-gui" --instantiation async --no-typescript --name gfx-gui >/dev/null
echo '{"type":"module"}' > "build/jco/gfx-gui/package.json"
printf ' %-18s %-20s %7s bytes\n' "gfx-gui" "gui-loader" "$(stat -c %s "$out")"
echo "ok (gfx)"
+4
View File
@@ -25,6 +25,10 @@ generate() { # <out-dir> <ignore-stub: 0|1>
--gen-dir "components/$name/gen" --project-name moonplasma/desktop \
--ignore-module-file "${extra[@]}" >/dev/null 2>"$log" || { cat "$log" >&2; exit 1; }
done < scripts/components.txt
extra=(); [ "$ignore" = 1 ] && extra+=(--ignore-stub)
wit-bindgen moonbit wit/gfx --world gui-loader --out-dir "$out" \
--gen-dir "components/gfx-gui/gen" --project-name moonplasma/desktop \
--ignore-module-file "${extra[@]}" >/dev/null 2>"$log" || { cat "$log" >&2; exit 1; }
}
if [ "${1:-}" = "--check" ]; then
+5 -2
View File
@@ -22,6 +22,9 @@ scripts/build.sh
step "build wm & decoration components"
scripts/build-wm.sh
step "build wasi-gfx GUI loader component"
scripts/build-gfx.sh
if command -v wasmtime >/dev/null; then
step "wasmtime accepts every component (compile only; hosts supply the imports)"
for f in build/components/*.wasm; do
@@ -32,6 +35,6 @@ fi
step "host integration tests (jco + Node)"
(cd host && npm test)
step "pure-MoonBit native Wayland compositor + e2e tests (compositor/)"
moon test --target native --warn-list -a compositor/renderer compositor/host
step "pure-MoonBit native Wayland compositor + wasi-gfx + e2e tests (compositor/)"
moon test --target native --warn-list -a compositor/renderer compositor/gfx compositor/host
moon build --target native --warn-list -a compositor/bin