-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
55 lines (47 loc) · 2.51 KB
/
Copy pathbuild.sh
File metadata and controls
55 lines (47 loc) · 2.51 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
#!/usr/bin/env bash
# build.sh — build the DixScript LSP server (and optionally the CLI)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# ── defaults ──────────────────────────────────────────────────────────────────
PROFILE="${PROFILE:-release}" # override: PROFILE=dev ./build.sh
TARGET_DIR="target/$PROFILE"
# ── helpers ───────────────────────────────────────────────────────────────────
bold() { printf '\033[1m%s\033[0m\n' "$*"; }
ok() { printf '\033[32m✓\033[0m %s\n' "$*"; }
info() { printf '\033[34m→\033[0m %s\n' "$*"; }
err() { printf '\033[31m✗\033[0m %s\n' "$*" >&2; exit 1; }
# ── sanity checks ─────────────────────────────────────────────────────────────
command -v cargo &>/dev/null || err "cargo not found — install Rust from https://rustup.rs"
bold "DixScript build (profile: $PROFILE)"
echo ""
# ── build LSP ────────────────────────────────────────────────────────────────
info "Building mdix-lsp …"
if [[ "$PROFILE" == "release" ]]; then
cargo build -p mdix-lsp --release 2>&1
else
cargo build -p mdix-lsp 2>&1
fi
ok "mdix-lsp → $TARGET_DIR/mdix-lsp"
# ── build CLI (optional, skip with SKIP_CLI=1) ────────────────────────────────
if [[ "${SKIP_CLI:-0}" != "1" ]]; then
info "Building mdix-cli …"
if [[ "$PROFILE" == "release" ]]; then
cargo build -p mdix-cli --release 2>&1
else
cargo build -p mdix-cli 2>&1
fi
ok "mdix-cli → $TARGET_DIR/mdix"
fi
echo ""
bold "Done."
echo ""
echo " LSP binary : $SCRIPT_DIR/$TARGET_DIR/mdix-lsp"
if [[ "${SKIP_CLI:-0}" != "1" ]]; then
echo " CLI binary : $SCRIPT_DIR/$TARGET_DIR/mdix"
fi
echo ""
echo " VS Code / Neovim: point your mdix extension at the LSP binary above."
echo " Run tests: cargo test -p mdix-lsp"
echo " Run LSP tests: MDIX_LSP_BIN=$SCRIPT_DIR/$TARGET_DIR/mdix-lsp \\"
echo " cargo test -p mdix-lsp --test lsp_integration"