forked from xiangwang25/whale-town-front-v2
feat: expand multiplayer, chat, and release support
- add network NPC synchronization and dialogue interactions - add world bulletin publishing and display - improve authentication, session refresh, and appearance sync - synchronize player direction and movement animations - improve input focus and progressive Web loading - add macOS/Windows builds and deployment configuration - include required fonts, shaders, and runtime assets
This commit is contained in:
79
scripts/build_desktop.sh
Executable file
79
scripts/build_desktop.sh
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
GODOT_BIN="${GODOT_BIN:-/Applications/Godot.app/Contents/MacOS/Godot}"
|
||||
TARGET="${1:-all}"
|
||||
VERSION="${WHALETOWN_VERSION:-1.0.0}"
|
||||
|
||||
if [[ ! -x "$GODOT_BIN" ]]; then
|
||||
echo "Godot executable not found: $GODOT_BIN" >&2
|
||||
echo "Set GODOT_BIN to the Godot 4.6.2 executable path." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export_target() {
|
||||
local preset="$1"
|
||||
local output="$2"
|
||||
local marker
|
||||
marker="$(mktemp /tmp/whaletown-export.XXXXXX)"
|
||||
mkdir -p "$(dirname "$output")"
|
||||
echo "Exporting $preset -> $output"
|
||||
"$GODOT_BIN" --headless --path "$PROJECT_DIR" --export-release "$preset" "$output"
|
||||
if [[ ! -e "$output" ]] || [[ -z "$(find "$output" -newer "$marker" -print -quit 2>/dev/null)" ]]; then
|
||||
echo "Export failed: Godot did not create a fresh artifact at $output" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
package_artifacts() {
|
||||
local release_dir="$PROJECT_DIR/build/desktop/release"
|
||||
local mac_app="$PROJECT_DIR/build/desktop/macos/WhaleTown.app"
|
||||
local windows_exe="$PROJECT_DIR/build/desktop/windows/WhaleTown.exe"
|
||||
local mac_zip="$release_dir/WhaleTown-macOS-$VERSION.zip"
|
||||
local windows_zip="$release_dir/WhaleTown-Windows-x86_64-$VERSION.zip"
|
||||
|
||||
if [[ ! -d "$mac_app" ]] || [[ ! -f "$windows_exe" ]]; then
|
||||
echo "Both macOS and Windows artifacts are required before packaging." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$release_dir"
|
||||
echo "Packaging $mac_zip"
|
||||
/usr/bin/ditto -c -k --sequesterRsrc --keepParent "$mac_app" "$mac_zip"
|
||||
echo "Packaging $windows_zip"
|
||||
/usr/bin/ditto -c -k --keepParent "$windows_exe" "$windows_zip"
|
||||
(
|
||||
cd "$release_dir"
|
||||
shasum -a 256 "$(basename "$mac_zip")" "$(basename "$windows_zip")" > SHA256SUMS.txt
|
||||
)
|
||||
echo "Release packages are under: $release_dir"
|
||||
}
|
||||
|
||||
case "$TARGET" in
|
||||
macos)
|
||||
export_target "WhaleTown macOS" "$PROJECT_DIR/build/desktop/macos/WhaleTown.app"
|
||||
;;
|
||||
windows)
|
||||
export_target "WhaleTown Windows" "$PROJECT_DIR/build/desktop/windows/WhaleTown.exe"
|
||||
;;
|
||||
all)
|
||||
export_target "WhaleTown macOS" "$PROJECT_DIR/build/desktop/macos/WhaleTown.app"
|
||||
export_target "WhaleTown Windows" "$PROJECT_DIR/build/desktop/windows/WhaleTown.exe"
|
||||
;;
|
||||
package)
|
||||
package_artifacts
|
||||
;;
|
||||
release)
|
||||
export_target "WhaleTown macOS" "$PROJECT_DIR/build/desktop/macos/WhaleTown.app"
|
||||
export_target "WhaleTown Windows" "$PROJECT_DIR/build/desktop/windows/WhaleTown.exe"
|
||||
package_artifacts
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [macos|windows|all|package|release]" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Desktop export complete. Files are under: $PROJECT_DIR/build/desktop"
|
||||
Reference in New Issue
Block a user