Browser host, screenshots, docs, CI, README, LICENSE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e0bde1d150
commit
de8abfaa26
17 files changed
+1019
-13
No files matched your search
+35
-12
@@ -5,20 +5,43 @@
|
||||
# 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.
|
||||
#
|
||||
# scripts/gen-bindings.sh regenerate in place
|
||||
# scripts/gen-bindings.sh --check regenerate into a temp dir and fail if the
|
||||
# committed bindings differ (order-insensitive:
|
||||
# wit-bindgen 0.63 emits helper fns in varying order)
|
||||
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
|
||||
mkdir -p .tools
|
||||
log="$ROOT/.tools/bindgen.log"
|
||||
|
||||
generate() { # <out-dir> <ignore-stub: 0|1>
|
||||
local out="$1" ignore="$2" name world extra
|
||||
while read -r name world; do
|
||||
case "$name" in ''|'#'*) continue;; esac
|
||||
extra=(); [ "$ignore" = 1 ] && extra+=(--ignore-stub)
|
||||
wit-bindgen moonbit wit --world "$world" --out-dir "$out" \
|
||||
--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
|
||||
}
|
||||
|
||||
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; }
|
||||
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
||||
generate "$tmp" 0
|
||||
bad=0
|
||||
while IFS= read -r f; do
|
||||
rel="${f#"$tmp"/}"
|
||||
case "$rel" in */moon.pkg|*/README.md) continue;; esac # hand-edited / docs
|
||||
if [ ! -f "$rel" ] || ! diff -q <(sort "$f") <(sort "$rel") >/dev/null; then
|
||||
echo "stale binding: $rel" >&2; bad=1
|
||||
fi
|
||||
done < <(find "$tmp" -type f)
|
||||
[ "$bad" = 0 ] || { echo "error: bindings differ from wit/; run scripts/gen-bindings.sh and commit" >&2; exit 1; }
|
||||
echo "bindings up to date"
|
||||
else
|
||||
first=0; [ -d components/shell/gen ] || first=1
|
||||
generate . $((1 - first))
|
||||
echo "bindings regenerated"
|
||||
fi
|
||||
Reference in new issue
Block a user