Files
VandClaude Opus 5.5 af774d76fe
CI / test (push) Failing after 16s
Rename the project to Chandra
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
2026-11-25 17:12:57 +00:00

43 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build the panel's wasm modules (every *-widget component in scripts/components.txt)
# into build/components/<name>.wasm, the directory the compositor loads its panel from.
# Same steps as scripts/build.sh minus the jco/JS-host transpile, so it needs only
# moon and wasm-tools.
# scripts/build-modules.sh [name ...]
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT"
export PATH="$ROOT/.tools/bin:$HOME/.moon/bin:$PATH"
for t in moon wasm-tools; do
command -v "$t" >/dev/null || { echo "error: $t not found" >&2; exit 1; }
done
want=("$@")
mkdir -p build/components
moon build --target wasm --release 2>&1 | grep -E '^Error' -A8 || true
[ "${PIPESTATUS[0]}" -eq 0 ] || { echo "error: moon build failed" >&2; exit 1; }
n=0
while read -r name world; do
case "$name" in ''|'#'*) continue;; esac
case "$world" in *-widget) ;; *) continue;; esac
if [ ${#want[@]} -gt 0 ] && [[ ! " ${want[*]} " =~ " $name " ]]; then continue; fi
core="_build/wasm/release/build/components/$name/gen/gen.wasm"
if [ ! -f "$core" ]; then
# Listed in components.txt but its source isn't in the tree (yet): skip it, don't fail the build.
echo " $name: skipped (no source: $core missing)" >&2
continue
fi
out="build/components/$name.wasm"
wasm-tools component embed wit "$core" --world "$world" --encoding utf16 -o "build/components/$name.embed.wasm"
wasm-tools component new "build/components/$name.embed.wasm" -o "$out"
rm -f "build/components/$name.embed.wasm"
wasm-tools validate --features component-model "$out"
wasm-tools component targets --world "$world" wit "$out" >/dev/null
imports="$(wasm-tools component wit "$out" | sed -n 's/^ import chandra:desktop\/\([a-z-]*\)@.*;/\1/p' | grep -v '^types$' | sort | paste -sd, - || true)"
exports="$(wasm-tools component wit "$out" | sed -n 's/^ export chandra:desktop\/\([a-z-]*\)@.*;/\1/p' | sort | paste -sd, -)"
printf '{"name":"%s","world":"%s","imports":[%s],"exports":[%s]}\n' "$name" "$world" \
"$(echo "$imports" | sed 's/\([a-z-]\+\)/"\1"/g')" "$(echo "$exports" | sed 's/\([a-z-]\+\)/"\1"/g')" \
> "build/components/$name.meta.json"
printf ' %-16s %-22s %7s bytes imports=[%s]\n' "$name" "$world" "$(stat -c %s "$out")" "$imports"
n=$((n + 1))
done < scripts/components.txt
echo "built $n module(s) into build/components/"