-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·89 lines (79 loc) · 2.85 KB
/
build.sh
File metadata and controls
executable file
·89 lines (79 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Flags
SKIP_TEST=false
SKIP_TAURI=false
SKIP_DOCKER=false
SKIP_CHECK=false
TARGET_OVERRIDE=""
for arg in "$@"; do
case "$arg" in
--clean)
echo "==> Cleaning..."
cargo clean 2>/dev/null || true
rm -rf frontend/build frontend/.svelte-kit frontend/node_modules
rm -rf crates/xpressclaw-tauri/binaries
echo " Done."
echo ""
;;
--skip-test) SKIP_TEST=true ;;
--skip-tauri) SKIP_TAURI=true ;;
--skip-docker) SKIP_DOCKER=true ;;
--skip-check) SKIP_CHECK=true ;;
--target=*) TARGET_OVERRIDE="${arg#--target=}" ;;
esac
done
# Build CLI (release mode — disables debug_assertions so rust-embed
# embeds statically. The server's build.rs auto-rebuilds the frontend
# whenever frontend source files change.)
echo "==> Building CLI..."
cargo build --release -p xpressclaw-cli
# Copy CLI as Tauri sidecar
echo "==> Copying CLI binary as Tauri sidecar..."
if [ -n "$TARGET_OVERRIDE" ]; then
TARGET_TRIPLE="$TARGET_OVERRIDE"
else
TARGET_TRIPLE=$(rustc --print host-tuple 2>/dev/null || rustc -vV | grep host | cut -d' ' -f2)
fi
mkdir -p crates/xpressclaw-tauri/binaries
cp "target/release/xpressclaw" "crates/xpressclaw-tauri/binaries/xpressclaw-${TARGET_TRIPLE}"
echo " Copied to binaries/xpressclaw-${TARGET_TRIPLE}"
if [ "$SKIP_TEST" = false ]; then
echo "==> Running tests..."
cargo test -p xpressclaw-core -p xpressclaw-server
fi
if [ "$SKIP_TAURI" = false ]; then
echo "==> Building Tauri desktop app..."
# Pick platform-appropriate bundle format. Override with TAURI_BUNDLES env var.
TAURI_BUNDLES="${TAURI_BUNDLES:-}"
if [ -z "$TAURI_BUNDLES" ]; then
case "$(uname)" in
Linux*) TAURI_BUNDLES="deb" ;;
Darwin*) TAURI_BUNDLES="dmg" ;;
*) TAURI_BUNDLES="nsis" ;;
esac
fi
BUNDLE_FLAG=""
if [ "$TAURI_BUNDLES" != "all" ]; then
BUNDLE_FLAG="--bundles $TAURI_BUNDLES"
fi
TAURI_BUNDLER_DMG_IGNORE_CI=true npx -y @tauri-apps/cli build --target "${TARGET_TRIPLE}" $BUNDLE_FLAG
fi
if [ "$SKIP_DOCKER" = false ] && command -v docker &>/dev/null; then
echo "==> Building agent harness Docker images..."
docker build -t ghcr.io/xpressai/xpressclaw-harness-base:latest harnesses/base
docker build -t ghcr.io/xpressai/xpressclaw-harness-claude-sdk:latest harnesses/claude-sdk
docker build -t ghcr.io/xpressai/xpressclaw-harness-langchain:latest harnesses/langchain
docker build -t ghcr.io/xpressai/xpressclaw-harness-xaibo:latest harnesses/xaibo
else
echo "==> Skipping harness builds"
fi
if [ "$SKIP_CHECK" = false ]; then
echo "==> Running frontend type check..."
cd frontend
npm run check
cd ..
fi
echo "==> All done!"