CI / test (push) Failing after 16s
moon-plasma / moonplasma / MoonPlasma / Moon Plasma become chandra / Chandra everywhere: the WIT package (chandra:desktop, chandra:host, chandra:wm), the MoonBit module (chandra/desktop) and generated bindings, the Rust host, identifiers (ChandraCompositor), the session script (chandra-session) and desktop entry (chandra.desktop), config and data paths ($XDG_CONFIG_HOME/chandra, share/chandra/modules), env vars (CHANDRA_*), UI strings, docs and tests. The test fixture components are rebuilt against the renamed WIT. Saved panel.edn and state.edn are still read from the old $XDG_CONFIG_HOME/moon-plasma until the first save writes the new copy. The remote repository keeps its experiments/moon-plasma name for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hi3L9oVBoRd373Qr4n
52 lines
2.2 KiB
Bash
Executable File
52 lines
2.2 KiB
Bash
Executable File
#!/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 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"
|
|
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 chandra/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 chandra/desktop \
|
|
--ignore-module-file "${extra[@]}" >/dev/null 2>"$log" || { cat "$log" >&2; exit 1; }
|
|
}
|
|
|
|
if [ "${1:-}" = "--check" ]; then
|
|
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
|