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 # open the scratch wiki's index
|
||||||
# ./start-nvim.sh path/to/note.wiki # open a specific file
|
# ./start-nvim.sh path/to/note.wiki # open a specific file
|
||||||
# NUWIKI_DEV_WIKI=/tmp/foo ./start-nvim.sh
|
# 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
|
# Tested with Neovim 0.10+. State (cache/data/config) lives under
|
||||||
# $XDG_CACHE_HOME/nuwiki-dev/ so your real Neovim install stays
|
# $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() {
|
ensure_binary() {
|
||||||
local bin="$REPO_ROOT/bin/nuwiki-ls"
|
local bin="$REPO_ROOT/bin/nuwiki-ls"
|
||||||
local built="$REPO_ROOT/target/release/nuwiki-ls"
|
local built="$REPO_ROOT/target/release/nuwiki-ls"
|
||||||
if [[ -x "$bin" ]]; then
|
if [[ "${NUWIKI_DEV_SKIP_BUILD:-0}" == "1" ]]; then
|
||||||
return
|
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
|
fi
|
||||||
log "building nuwiki-ls (release)…"
|
log "building nuwiki-ls (release)…"
|
||||||
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml"
|
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml"
|
||||||
mkdir -p "$REPO_ROOT/bin"
|
mkdir -p "$REPO_ROOT/bin"
|
||||||
ln -sf "$built" "$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() {
|
seed_wiki() {
|
||||||
|
|||||||
+15
-4
@@ -11,7 +11,13 @@
|
|||||||
# ./start-vim.sh # open the scratch wiki's index
|
# ./start-vim.sh # open the scratch wiki's index
|
||||||
# ./start-vim.sh path/to/note.wiki # open a specific file
|
# ./start-vim.sh path/to/note.wiki # open a specific file
|
||||||
# NUWIKI_DEV_WIKI=/tmp/foo ./start-vim.sh
|
# NUWIKI_DEV_WIKI=/tmp/foo ./start-vim.sh
|
||||||
# NUWIKI_DEV_NO_LSP=1 ./start-vim.sh # skip vim-lsp setup
|
# NUWIKI_DEV_NO_LSP=1 ./start-vim.sh # skip vim-lsp setup
|
||||||
|
# NUWIKI_DEV_SKIP_BUILD=1 ./start-vim.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 Vim 9.1+. State (viminfo/sessions) lives under
|
# Tested with Vim 9.1+. State (viminfo/sessions) lives under
|
||||||
# $XDG_CACHE_HOME/nuwiki-dev/ so your real Vim install stays untouched.
|
# $XDG_CACHE_HOME/nuwiki-dev/ so your real Vim install stays untouched.
|
||||||
@@ -31,14 +37,19 @@ log() { printf '\033[1;34m[nuwiki-dev]\033[0m %s\n' "$*"; }
|
|||||||
ensure_binary() {
|
ensure_binary() {
|
||||||
local bin="$REPO_ROOT/bin/nuwiki-ls"
|
local bin="$REPO_ROOT/bin/nuwiki-ls"
|
||||||
local built="$REPO_ROOT/target/release/nuwiki-ls"
|
local built="$REPO_ROOT/target/release/nuwiki-ls"
|
||||||
if [[ -x "$bin" ]]; then
|
if [[ "${NUWIKI_DEV_SKIP_BUILD:-0}" == "1" ]]; then
|
||||||
return
|
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
|
fi
|
||||||
log "building nuwiki-ls (release)…"
|
log "building nuwiki-ls (release)…"
|
||||||
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml"
|
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml"
|
||||||
mkdir -p "$REPO_ROOT/bin"
|
mkdir -p "$REPO_ROOT/bin"
|
||||||
ln -sf "$built" "$bin"
|
ln -sf "$built" "$bin"
|
||||||
log "binary ready: $bin"
|
log "binary ready: $bin (built $(date -r "$built" '+%Y-%m-%d %H:%M:%S'))"
|
||||||
}
|
}
|
||||||
|
|
||||||
clone_if_missing() {
|
clone_if_missing() {
|
||||||
|
|||||||
Reference in New Issue
Block a user