Skip to content

Commit b78b081

Browse files
SonAIengineclaude
andcommitted
feat: graph-tool-call sidecar 빌드 자동화 — PyInstaller 크로스 플랫폼 스크립트
- build-sidecar.sh: OS/arch 자동 감지 → Tauri target triple 바이너리 생성 - build.sh Step 0에 sidecar 빌드 단계 추가 - .gitignore에 binaries/ 추가 (바이너리는 빌드 시 생성) - 결과: xgen-app 설치 시 graph-tool-call v0.18.0 (11MB) 내장 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3099a3b commit b78b081

3 files changed

Lines changed: 122 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Tauri 빌드 결과물
55
/src-tauri/target
66

7+
# Sidecar 바이너리 (빌드 시 자동 생성)
8+
/src-tauri/binaries/
9+
710
# Next.js 빌드 결과물
811
/dist
912

scripts/build-sidecar.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/bash
2+
3+
# graph-tool-call PyInstaller sidecar 빌드 스크립트
4+
# Tauri externalBin 규칙: binaries/{name}-{target_triple}
5+
6+
set -e
7+
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
10+
BINARIES_DIR="$PROJECT_ROOT/src-tauri/binaries"
11+
GRAPH_TOOL_CALL_DIR="${GRAPH_TOOL_CALL_DIR:-$HOME/projects/app/graph-tool-call}"
12+
13+
# 색상 정의
14+
GREEN='\033[0;32m'
15+
YELLOW='\033[1;33m'
16+
RED='\033[0;31m'
17+
NC='\033[0m'
18+
19+
print_step() { echo -e "\n${GREEN}==== $1 ====${NC}\n"; }
20+
print_warn() { echo -e "${YELLOW}[WARN] $1${NC}"; }
21+
print_error() { echo -e "${RED}[ERROR] $1${NC}"; }
22+
23+
# Tauri target triple 감지
24+
get_target_triple() {
25+
local arch=$(uname -m)
26+
local os=$(uname -s)
27+
28+
case "$os" in
29+
Linux)
30+
case "$arch" in
31+
x86_64) echo "x86_64-unknown-linux-gnu" ;;
32+
aarch64) echo "aarch64-unknown-linux-gnu" ;;
33+
*) print_error "Unsupported arch: $arch"; exit 1 ;;
34+
esac
35+
;;
36+
Darwin)
37+
case "$arch" in
38+
x86_64) echo "x86_64-apple-darwin" ;;
39+
arm64) echo "aarch64-apple-darwin" ;;
40+
*) print_error "Unsupported arch: $arch"; exit 1 ;;
41+
esac
42+
;;
43+
MINGW*|MSYS*|CYGWIN*)
44+
echo "x86_64-pc-windows-msvc"
45+
;;
46+
*)
47+
print_error "Unsupported OS: $os"
48+
exit 1
49+
;;
50+
esac
51+
}
52+
53+
TARGET_TRIPLE=$(get_target_triple)
54+
BINARY_NAME="graph-tool-call-${TARGET_TRIPLE}"
55+
56+
print_step "graph-tool-call sidecar 빌드 (target: ${TARGET_TRIPLE})"
57+
58+
# 1. graph-tool-call 소스 확인
59+
if [ ! -d "$GRAPH_TOOL_CALL_DIR" ]; then
60+
print_error "graph-tool-call 소스가 없습니다: $GRAPH_TOOL_CALL_DIR"
61+
print_warn "GRAPH_TOOL_CALL_DIR 환경변수로 경로를 지정하세요."
62+
exit 1
63+
fi
64+
65+
# 2. PyInstaller 확인
66+
if ! command -v pyinstaller &> /dev/null; then
67+
print_warn "PyInstaller가 없습니다. 설치 중..."
68+
pip install pyinstaller
69+
fi
70+
71+
# 3. PyInstaller 빌드
72+
print_step "PyInstaller 빌드"
73+
cd "$GRAPH_TOOL_CALL_DIR"
74+
75+
pyinstaller \
76+
--onefile \
77+
--name graph-tool-call \
78+
--collect-submodules graph_tool_call \
79+
--strip \
80+
--noconfirm \
81+
--distpath "$GRAPH_TOOL_CALL_DIR/dist" \
82+
graph_tool_call/__main__.py
83+
84+
# 4. 빌드 결과 검증
85+
BUILT_BINARY="$GRAPH_TOOL_CALL_DIR/dist/graph-tool-call"
86+
if [ ! -f "$BUILT_BINARY" ]; then
87+
print_error "빌드 실패: $BUILT_BINARY 가 없습니다."
88+
exit 1
89+
fi
90+
91+
# 버전 확인
92+
VERSION=$("$BUILT_BINARY" --version 2>&1 || true)
93+
echo "빌드된 바이너리: $VERSION"
94+
95+
# 5. Tauri binaries 디렉토리로 복사
96+
print_step "Tauri sidecar 배치"
97+
mkdir -p "$BINARIES_DIR"
98+
cp "$BUILT_BINARY" "$BINARIES_DIR/$BINARY_NAME"
99+
chmod +x "$BINARIES_DIR/$BINARY_NAME"
100+
101+
BINARY_SIZE=$(du -h "$BINARIES_DIR/$BINARY_NAME" | cut -f1)
102+
103+
echo ""
104+
echo -e "${GREEN}✅ 빌드 완료!${NC}"
105+
echo " 바이너리: $BINARIES_DIR/$BINARY_NAME"
106+
echo " 크기: $BINARY_SIZE"
107+
echo " 버전: $VERSION"
108+
echo ""
109+
echo "Tauri 앱 빌드 시 자동으로 번들됩니다."

scripts/build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
# xgen_app Tauri 데스크톱 앱 빌드 스크립트
4+
# 0. graph-tool-call sidecar 바이너리 빌드
45
# 1. xgen-frontend 소스 동기화
56
# 2. 프론트엔드 의존성 설치
67
# 3. Tauri 앱 빌드
@@ -63,6 +64,15 @@ done
6364

6465
cd "$PROJECT_ROOT"
6566

67+
# Step 0: graph-tool-call sidecar 빌드
68+
print_step "Step 0: graph-tool-call sidecar 빌드"
69+
if [ -f "$SCRIPT_DIR/build-sidecar.sh" ]; then
70+
bash "$SCRIPT_DIR/build-sidecar.sh"
71+
else
72+
print_warn "build-sidecar.sh 없음 — sidecar 빌드 건너뜀"
73+
print_warn "graph-tool-call이 시스템 PATH에 있어야 합니다."
74+
fi
75+
6676
# Step 1: 프론트엔드 소스 동기화
6777
if [ "$SKIP_SYNC" = false ]; then
6878
print_step "Step 1: xgen-frontend 소스 동기화"

0 commit comments

Comments
 (0)