-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
97 lines (83 loc) · 3.92 KB
/
build.sh
File metadata and controls
97 lines (83 loc) · 3.92 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
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
# Builds all packages in dependency order with parallelism.
#
# Phase 1 (parallel): build-bin + objectiveai-json-schema
# Background: objectiveai-cli + mcp + claude-agent-sdk runners (after phase 1, concurrent with phases 2+3)
# Phase 2 (parallel): objectiveai-sdk-rs-wasm-js + objectiveai-sdk-rs-cffi
# Phase 3 (parallel): objectiveai-sdk-js + objectiveai-sdk-py + objectiveai-sdk-go
# (objectiveai-sdk-py builds its bundled Rust extension via maturin)
# (objectiveai-dotnet is disconnected from the root build for now;
# run `bash objectiveai-dotnet/build.sh` directly if you need it.)
# Phase 4 (sequential): objectiveai-viewer release (cross-platform)
# then host-target debug. Sequential because both invoke
# `tauri build`, which holds the workspace cargo target/
# lock — running them in parallel deadlocks. Both
# artifacts are required: cargo test / cargo build of
# objectiveai-cli compiles in debug and its build.rs
# validates the viewer's host-target debug embed.
#
# Usage:
# bash build.sh
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
# Run a phase: launch all given scripts in parallel, wait for all, fail if any failed.
run_phase() {
local pids=()
for script in "$@"; do
bash "$REPO_ROOT/$script" &
pids+=($!)
done
local failed=false
for pid in "${pids[@]}"; do
if ! wait "$pid"; then
failed=true
fi
done
if $failed; then
exit 1
fi
}
# Phase 1: build tools + json schema
run_phase build-bin.sh objectiveai-json-schema/build.sh
# CLI schema codegen (depends on phase 1, runs concurrently with phases 2+3)
bash "$REPO_ROOT/objectiveai-cli/build.sh" &
CLI_PID=$!
# Embedded binaries (depend on phase 1, run concurrently with phases 2+3).
# mcp-filesystem is a cargo build pinned to linux-musl (Docker container
# injection); claude-agent-sdk-runner and codex-sdk-runner are PyInstaller.
# mcp-proxy is NOT embedded — objectiveai-api consumes it in-process as a
# regular cargo path dep, so its build is folded into the api's own cargo
# build.
bash "$REPO_ROOT/objectiveai-mcp-filesystem/build.sh" --target "$(uname -m)-unknown-linux-musl" &
MCP_FILESYSTEM_PID=$!
bash "$REPO_ROOT/objectiveai-claude-agent-sdk-runner/build.sh" &
CLAUDE_RUNNER_PID=$!
bash "$REPO_ROOT/objectiveai-codex-sdk-runner/build.sh" &
CODEX_RUNNER_PID=$!
# Phase 2: wasm + cffi (need build tools from phase 1)
run_phase objectiveai-sdk-rs-wasm-js/build.sh objectiveai-sdk-rs-cffi/build.sh
# Phase 3: js + py + go (need wasm/cffi from phase 2). objectiveai-dotnet
# is intentionally NOT part of this phase — its codegen has a duplicate-
# variant-property bug that breaks on newly-added internally-tagged enums;
# run `bash objectiveai-dotnet/build.sh` directly if you need it.
# objectiveai-sdk-py compiles its own Rust extension (_pyo3) via maturin as part of its build.
run_phase objectiveai-sdk-js/build.sh objectiveai-sdk-py/build.sh objectiveai-sdk-go/build.sh
# Wait for background builds before running viewer (viewer depends on objectiveai-sdk-js)
FAILED=false
for pid in $CLI_PID $MCP_FILESYSTEM_PID $CLAUDE_RUNNER_PID $CODEX_RUNNER_PID; do
if ! wait "$pid"; then
FAILED=true
fi
done
if $FAILED; then
exit 1
fi
# Phase 4: viewer (depends on objectiveai-sdk-js package being built in phase 3).
# Two artifacts are produced: a cross-platform release embed (consumed by
# published CLI binaries) and a host-target debug embed (consumed by
# `cargo test`/`cargo build` of objectiveai-cli during local development).
# Run sequentially — both invoke `tauri build` which holds the workspace
# cargo target/ lock; parallel invocations deadlock.
bash "$REPO_ROOT/objectiveai-viewer/build.sh" --release
HOST_TARGET="$(rustc -vV | awk '/^host:/ {print $2}')"
bash "$REPO_ROOT/objectiveai-viewer/build.sh" --target "$HOST_TARGET"