fix: use CURDIR for Zoekt build output in Makefile#1096
fix: use CURDIR for Zoekt build output in Makefile#1096brendan-kellam merged 1 commit intosourcebot-dev:mainfrom
Conversation
The shell variable PWD is not set by GNU Make and is often empty on Windows, which broke go build -o paths. Use Make built-in CURDIR instead. Fixes sourcebot-dev#1095
WalkthroughThe Makefile's Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Makefile (1)
13-14: Pre-existing issue: Export statements have no effect.The
exportstatements on lines 13-14 run in separate shells (each recipe line spawns a new shell by default), so they don't affect subsequent commands or Make targets. If the intent is to make Zoekt binaries available onPATHfor other targets or to setCTAGS_COMMANDSfor Zoekt's use, consider one of these approaches:
If variables are only needed within this target: combine commands on one line:
zoekt: mkdir -p bin go build -C vendor/zoekt -o $(CURDIR)/bin ./cmd/... export PATH="$(CURDIR)/bin:$$PATH" CTAGS_COMMANDS=ctags && some_command_using_themIf variables should persist for all targets: use Make's export directive:
export PATH := $(CURDIR)/bin:$(PATH) export CTAGS_COMMANDS := ctags zoekt: mkdir -p bin go build -C vendor/zoekt -o $(CURDIR)/bin ./cmd/...If all recipe lines should share one shell: add
.ONESHELL:to the Makefile.Based on learnings, Zoekt binaries in
./bin/must be available beforeyarn dev, so option 2 (Make-level export) may be the most appropriate.Do you want me to open a new issue to track fixing the ineffective export statements?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Makefile` around lines 13 - 14, The Makefile currently uses shell export lines that don't persist between recipe lines, so PATH and CTAGS_COMMANDS changes have no effect; update the Makefile to export these at Makefile scope (e.g., use Make's export for PATH and CTAGS_COMMANDS) or add .ONESHELL: so recipe lines share a shell, and ensure the zoekt target (the rule that builds vendor/zoekt into ./bin) runs before yarn dev so ./bin is on PATH for subsequent targets; refer to the PATH and CTAGS_COMMANDS variables, the zoekt target, and .ONESHELL as the points to change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Makefile`:
- Around line 13-14: The Makefile currently uses shell export lines that don't
persist between recipe lines, so PATH and CTAGS_COMMANDS changes have no effect;
update the Makefile to export these at Makefile scope (e.g., use Make's export
for PATH and CTAGS_COMMANDS) or add .ONESHELL: so recipe lines share a shell,
and ensure the zoekt target (the rule that builds vendor/zoekt into ./bin) runs
before yarn dev so ./bin is on PATH for subsequent targets; refer to the PATH
and CTAGS_COMMANDS variables, the zoekt target, and .ONESHELL as the points to
change.
|
@brendan-kellam PTAL |
fixed cross-platform build issue
replaced
PWDwithCURDIRin Makefile so Zoekt builds correctly on Windows too. fixes #1095Summary by CodeRabbit