-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
52 lines (42 loc) · 1.4 KB
/
build.sh
File metadata and controls
52 lines (42 loc) · 1.4 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
#!/usr/bin/env bash
# Builds all packages in dependency order with parallelism.
#
# Phase 1 (parallel): build-bin + objectiveai-json-schema
# Background: objectiveai-cli (after phase 1, concurrent with phases 2+3)
# Phase 2 (parallel): objectiveai-rs-wasm-js + objectiveai-rs-pyo3 + objectiveai-rs-cffi
# Phase 3 (parallel): objectiveai-js + objectiveai-py + objectiveai-go
#
# 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=$!
# Phase 2: wasm + pyo3 + cffi (need build tools from phase 1)
run_phase objectiveai-rs-wasm-js/build.sh objectiveai-rs-pyo3/build.sh objectiveai-rs-cffi/build.sh
# Phase 3: js + py + go (need wasm/pyo3/cffi from phase 2)
run_phase objectiveai-js/build.sh objectiveai-py/build.sh objectiveai-go/build.sh objectiveai-dotnet/build.sh
# Wait for CLI build
if ! wait "$CLI_PID"; then
exit 1
fi