67 lines
1.6 KiB
Bash
Executable file
67 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Export all platforms in parallel.
|
|
#
|
|
# Usage: tools/export.sh [version] [--debug]
|
|
#
|
|
# Delegates to tools/export-single.sh per platform. Each runs concurrently;
|
|
# exits 0 iff every platform succeeds.
|
|
|
|
set -uo pipefail
|
|
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
SINGLE="$REPO_ROOT/tools/export-single.sh"
|
|
|
|
version=""
|
|
debug_flag=""
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--debug) debug_flag="--debug" ;;
|
|
*) version="$arg" ;;
|
|
esac
|
|
done
|
|
version="${version:-$(date +%Y%m%d_%H%M%S)}"
|
|
|
|
platforms=(macos linux windows android ios)
|
|
log_dir="$REPO_ROOT/.local/build/godot/$version/logs"
|
|
mkdir -p "$log_dir"
|
|
|
|
echo -e "${BLUE}Exporting ${#platforms[@]} platforms in parallel → $version${NC}"
|
|
echo ""
|
|
|
|
pids=()
|
|
for p in "${platforms[@]}"; do
|
|
(
|
|
"$SINGLE" "$p" "$version" $debug_flag > "$log_dir/$p.log" 2>&1
|
|
echo "$?" > "$log_dir/$p.exit"
|
|
) &
|
|
pids+=("$!:$p")
|
|
done
|
|
|
|
# Wait for all, collect exit codes
|
|
failed=()
|
|
for entry in "${pids[@]}"; do
|
|
pid="${entry%%:*}"
|
|
plat="${entry##*:}"
|
|
wait "$pid" 2>/dev/null || true
|
|
code="$(cat "$log_dir/$plat.exit" 2>/dev/null || echo 99)"
|
|
if [ "$code" -eq 0 ]; then
|
|
echo -e " ${GREEN}✓ $plat${NC}"
|
|
else
|
|
echo -e " ${RED}✗ $plat (exit $code, see $log_dir/$plat.log)${NC}"
|
|
failed+=("$plat")
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
if [ ${#failed[@]} -eq 0 ]; then
|
|
echo -e "${GREEN}All platforms exported → $REPO_ROOT/.local/build/godot/$version/${NC}"
|
|
exit 0
|
|
else
|
|
echo -e "${RED}Failed: ${failed[*]}${NC}"
|
|
exit 1
|
|
fi
|