-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathx
More file actions
executable file
·76 lines (68 loc) · 1.79 KB
/
x
File metadata and controls
executable file
·76 lines (68 loc) · 1.79 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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
RUNTIME_RELEASE_TARGET="//apps/runtime:flora_bin_release"
normalize_bindgen_args() {
if [[ -n "${BINDGEN_EXTRA_CLANG_ARGS:-}" ]]; then
BINDGEN_EXTRA_CLANG_ARGS="${BINDGEN_EXTRA_CLANG_ARGS//--resource-dir=/-resource-dir=}"
export BINDGEN_EXTRA_CLANG_ARGS
fi
}
build_runtime_release() {
BUCK_NO_INTERACTIVE_CONSOLE=1 buck2 build "$RUNTIME_RELEASE_TARGET" --show-full-simple-output | tail -n1
}
build_frontend_production() {
pnpm --filter frontend run build
}
usage() {
cat <<'EOF'
usage: ./x <command>
commands:
build-dev build runtime in dev mode (cargo build --package flora)
build-release build frontend + runtime release with buck2, print binary path
run-dev run runtime in dev mode (cargo run --package flora)
run-release build frontend + runtime release with buck2, then run it
sync-rust-deps update Cargo metadata snapshot for Buck tooling
buckify-rust-deps run reindeer vendor + buckify in third-party/rust
help show this help
EOF
}
cmd="${1:-help}"
case "$cmd" in
build-dev)
normalize_bindgen_args
exec cargo build --package flora
;;
build-release)
normalize_bindgen_args
build_frontend_production
build_runtime_release
;;
run-dev)
normalize_bindgen_args
exec cargo run --package flora
;;
run-release)
shift || true
normalize_bindgen_args
build_frontend_production
BIN_PATH="$(build_runtime_release)"
exec "$BIN_PATH" "$@"
;;
sync-rust-deps)
exec tools/buck/sync_rust_deps.sh
;;
buckify-rust-deps)
exec tools/buck/buckify_rust_deps.sh
;;
help | -h | --help)
usage
;;
*)
echo "unknown command: $cmd" >&2
echo >&2
usage >&2
exit 1
;;
esac