f464aab543
Build and Deploy / build-and-push (push) Failing after 44s
- solitaire_data/sync_client.rs: fix SyncPayload/SyncResponse import split (SyncResponse is needed by LocalOnlyProvider which compiles on wasm32) - solitaire_engine/assets/sources.rs: cfg-gate AssetApp/AssetSourceBuilder imports (only used in the non-wasm FileAssetReader block) - solitaire_engine/auto_complete_plugin.rs: cfg-gate AUTO_COMPLETE_CHIME_VOLUME - solitaire_engine/daily_challenge_plugin.rs: cfg-gate Task/AsyncComputeTaskPool imports and DailyChallengeTask struct (server fetch systems are non-wasm only) - solitaire_engine/resources.rs: cfg-gate std::sync::Arc (TokioRuntimeResource is non-wasm only) - solitaire_engine/settings_plugin.rs: cfg-gate ScanThemes variant, pill_button, and their match arms; fix refresh_registry import placement - solitaire_server/src/lib.rs: point /play route at play.html (Bevy canvas); keep /play-classic serving game.html during transition period - build_wasm.sh: add --no-typescript to wasm-bindgen call for canvas build - solitaire_server/web/pkg: add canvas.js + canvas_bg.wasm build artifacts wasm32 build and native clippy --workspace -D warnings both clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
78 lines
2.6 KiB
Bash
Executable File
78 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Rebuild WASM artifacts and install them into solitaire_server/web/pkg/.
|
|
#
|
|
# Two artifacts are produced:
|
|
# solitaire_wasm.* — thin replay-viewer + interactive JS API (wasm-pack)
|
|
# canvas.* — full Bevy WASM app for play.html (cargo + wasm-bindgen)
|
|
#
|
|
# Prerequisites:
|
|
# cargo install wasm-pack wasm-bindgen-cli
|
|
# rustup target add wasm32-unknown-unknown
|
|
# (optional) cargo install wasm-opt # for smaller canvas_bg.wasm
|
|
#
|
|
# Run from the repo root:
|
|
# ./build_wasm.sh
|
|
#
|
|
# The generated pkg/ files are committed to git so self-hosters who don't
|
|
# touch the WASM crates can skip this step. Regenerate after any change to
|
|
# solitaire_wasm/, solitaire_web/, solitaire_engine/, or solitaire_core/.
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
OUT_DIR="$REPO_ROOT/solitaire_server/web/pkg"
|
|
|
|
if ! command -v wasm-pack &> /dev/null; then
|
|
echo "error: wasm-pack not found." >&2
|
|
echo " Install with: cargo install wasm-pack" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Building solitaire_wasm (target: web)..."
|
|
wasm-pack build \
|
|
--target web \
|
|
--out-dir "$OUT_DIR" \
|
|
--no-typescript \
|
|
"$REPO_ROOT/solitaire_wasm"
|
|
|
|
# wasm-pack writes a package.json and .gitignore into the output dir.
|
|
# Remove them — we manage the output directory ourselves.
|
|
rm -f "$OUT_DIR/package.json" "$OUT_DIR/.gitignore"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Bevy WASM app (solitaire_web → canvas.js + canvas_bg.wasm)
|
|
# ---------------------------------------------------------------------------
|
|
|
|
if ! command -v wasm-bindgen &> /dev/null; then
|
|
echo "error: wasm-bindgen not found." >&2
|
|
echo " Install with: cargo install wasm-bindgen-cli" >&2
|
|
echo " The CLI version must match the wasm-bindgen crate dep." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Building solitaire_web (Bevy WASM app)..."
|
|
cargo build --release --target wasm32-unknown-unknown -p solitaire_web
|
|
|
|
echo "Running wasm-bindgen for solitaire_web..."
|
|
wasm-bindgen \
|
|
--out-dir "$OUT_DIR" \
|
|
--out-name canvas \
|
|
--target web \
|
|
--no-typescript \
|
|
"$REPO_ROOT/target/wasm32-unknown-unknown/release/solitaire_web.wasm"
|
|
|
|
# Optional size optimisation — Bevy bundles are large (~5-15 MB uncompressed).
|
|
# wasm-opt passes are skipped silently when the tool is not installed.
|
|
if command -v wasm-opt &> /dev/null; then
|
|
echo "Running wasm-opt on canvas_bg.wasm..."
|
|
wasm-opt -Oz \
|
|
-o "$OUT_DIR/canvas_bg.wasm" \
|
|
"$OUT_DIR/canvas_bg.wasm"
|
|
else
|
|
echo "note: wasm-opt not found; skipping size optimisation."
|
|
echo " Install with: cargo install wasm-opt (or via binaryen)"
|
|
fi
|
|
|
|
echo "Done. Output:"
|
|
ls -lh "$OUT_DIR"
|