chore(dev): always rebuild release binary in start scripts
ensure_binary used to short-circuit whenever bin/nuwiki-ls existed, which left vim/nvim running an outdated LSP after every source change. Now always invoke cargo build (incremental, so a no-op when nothing changed) and refresh the symlink + log the build timestamp. Add NUWIKI_DEV_SKIP_BUILD=1 for the rare opt-out. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+14
-3
@@ -14,6 +14,12 @@
|
||||
# ./start-nvim.sh # open the scratch wiki's index
|
||||
# ./start-nvim.sh path/to/note.wiki # open a specific file
|
||||
# NUWIKI_DEV_WIKI=/tmp/foo ./start-nvim.sh
|
||||
# NUWIKI_DEV_SKIP_BUILD=1 ./start-nvim.sh # reuse the cached binary
|
||||
#
|
||||
# The release binary is rebuilt on every launch so source changes
|
||||
# always reach the running LSP. `cargo build --release` is incremental,
|
||||
# so this is a fast no-op when nothing changed. Set
|
||||
# NUWIKI_DEV_SKIP_BUILD=1 to skip the build step entirely.
|
||||
#
|
||||
# Tested with Neovim 0.10+. State (cache/data/config) lives under
|
||||
# $XDG_CACHE_HOME/nuwiki-dev/ so your real Neovim install stays
|
||||
@@ -34,14 +40,19 @@ log() { printf '\033[1;34m[nuwiki-dev]\033[0m %s\n' "$*"; }
|
||||
ensure_binary() {
|
||||
local bin="$REPO_ROOT/bin/nuwiki-ls"
|
||||
local built="$REPO_ROOT/target/release/nuwiki-ls"
|
||||
if [[ -x "$bin" ]]; then
|
||||
return
|
||||
if [[ "${NUWIKI_DEV_SKIP_BUILD:-0}" == "1" ]]; then
|
||||
if [[ ! -x "$bin" ]]; then
|
||||
log "NUWIKI_DEV_SKIP_BUILD=1 but $bin is missing — building anyway"
|
||||
else
|
||||
log "NUWIKI_DEV_SKIP_BUILD=1 — using existing $bin"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
log "building nuwiki-ls (release)…"
|
||||
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml"
|
||||
mkdir -p "$REPO_ROOT/bin"
|
||||
ln -sf "$built" "$bin"
|
||||
log "binary ready: $bin"
|
||||
log "binary ready: $bin (built $(date -r "$built" '+%Y-%m-%d %H:%M:%S'))"
|
||||
}
|
||||
|
||||
seed_wiki() {
|
||||
|
||||
Reference in New Issue
Block a user