-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhosts.sh
More file actions
executable file
·43 lines (34 loc) · 1.16 KB
/
Copy pathhosts.sh
File metadata and controls
executable file
·43 lines (34 loc) · 1.16 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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT_DIR/target}"
PROFILE="${1:-release}"
if [[ "$TARGET_DIR" != /* ]]; then
TARGET_DIR="$ROOT_DIR/$TARGET_DIR"
fi
if [[ "$PROFILE" != "release" && "$PROFILE" != "debug" ]]; then
echo "usage: $0 [release|debug]" >&2
exit 2
fi
command -v bun >/dev/null 2>&1 || { echo "missing required command: bun" >&2; exit 1; }
command -v cargo >/dev/null 2>&1 || { echo "missing required command: cargo" >&2; exit 1; }
mkdir -p "$TARGET_DIR/$PROFILE"
broker_name="codetwo-tool-broker"
if [[ "${OS:-}" == "Windows_NT" ]]; then
broker_name="$broker_name.exe"
fi
bun build --compile "$ROOT_DIR/apps/desktop/src/electrobun/toolBrokerRpc.ts" \
--outfile "$TARGET_DIR/$PROFILE/$broker_name"
(
cd "$ROOT_DIR/apps/desktop"
bunx vite build --mode web --outDir "$TARGET_DIR/$PROFILE/web-ui" --emptyOutDir
)
cargo_args=(build -p codetwo-tui -p codetwo-server)
if [[ "$PROFILE" == "release" ]]; then
cargo_args+=(--release)
fi
(
cd "$ROOT_DIR"
cargo "${cargo_args[@]}"
)
echo "Rust hosts, Web UI, and $broker_name are ready in $TARGET_DIR/$PROFILE"