-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
42 lines (34 loc) · 1 KB
/
build.sh
File metadata and controls
42 lines (34 loc) · 1 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
#!/usr/bin/env bash
# Builds all packages in dependency order with parallelism.
#
# Phase 1 (parallel): build-bin + objectiveai-json-schema
# Phase 2 (parallel): objectiveai-rs-wasm-js + objectiveai-rs-pyo3
# Phase 3 (parallel): objectiveai-js + objectiveai-py
#
# 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
# Phase 2: wasm + pyo3 (need build tools from phase 1)
run_phase objectiveai-rs-wasm-js/build.sh objectiveai-rs-pyo3/build.sh
# Phase 3: js + py (need wasm/pyo3 from phase 2)
run_phase objectiveai-js/build.sh objectiveai-py/build.sh