WIT package, MoonBit components, Node host and tests (WIP)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5548fc067
commit
e0bde1d150
125 files changed
+8681
No files matched your search
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# (Re)generate the MoonBit guest bindings for every component from wit/.
|
||||
#
|
||||
# Shared import bindings land in ./interface and ./world (one copy for all
|
||||
# components); each component's export bindings land in components/<n>/gen.
|
||||
# The first run also writes moon.pkg for each package; later runs pass
|
||||
# --ignore-stub so hand-edited moon.pkg / stub.mbt files are preserved.
|
||||
# `scripts/gen-bindings.sh --check` fails if regeneration changes tracked files.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT"
|
||||
export PATH="$ROOT/.tools/bin:$PATH"
|
||||
while read -r name world; do
|
||||
case "$name" in ''|'#'*) continue;; esac
|
||||
extra=()
|
||||
[ -d "components/$name/gen" ] && extra+=(--ignore-stub)
|
||||
wit-bindgen moonbit wit --world "$world" --out-dir . \
|
||||
--gen-dir "components/$name/gen" --project-name moonplasma/desktop \
|
||||
--ignore-module-file "${extra[@]}" >/dev/null 2>"$ROOT/.tools/bindgen.log" || { cat "$ROOT/.tools/bindgen.log" >&2; exit 1; }
|
||||
echo "bindings: $name ($world)"
|
||||
done < scripts/components.txt
|
||||
if [ "${1:-}" = "--check" ]; then
|
||||
git diff --exit-code -- interface world components '*/gen/*' \
|
||||
|| { echo "error: generated bindings are stale; run scripts/gen-bindings.sh and commit" >&2; exit 1; }
|
||||
fi
|
||||
Reference in new issue
Block a user