Skip to content

fix(v2): run pre/post build hooks in project directory instead of bin directory#5215

Draft
leaanthony wants to merge 1 commit intomasterfrom
fix/3627-prebuild-hooks-working-dir
Draft

fix(v2): run pre/post build hooks in project directory instead of bin directory#5215
leaanthony wants to merge 1 commit intomasterfrom
fix/3627-prebuild-hooks-working-dir

Conversation

@leaanthony
Copy link
Copy Markdown
Member

Summary

Fixes #3627

Build hooks were executing in options.BinDirectory (e.g., build/bin) instead of the project root directory. This caused hooks that reference project-local files (like Makefile, package.json, etc.) to fail because the working directory was wrong.

Changes

  • Changed shell.RunCommand call in executeBuildHook() from options.BinDirectory to options.ProjectData.Path (v2/pkg/commands/build/build.go:451)
  • Added test in v2/test/3627/

Test plan

  • Configure a preBuildHooks in wails.json that references a project-local file (e.g., "*/*": "make lint")
  • Run wails build and verify the hook executes in the project root directory
  • Verify post-build hooks also run in the correct directory

… directory

Build hooks were executing in options.BinDirectory (build/bin) instead of
the project root directory. This caused hooks that reference project-local
files (like Makefiles) to fail. Fix by using options.ProjectData.Path as
the working directory for hook execution.

Fixes #3627
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8b0d284-fcdc-441c-9b13-e5d30b793597

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3627-prebuild-hooks-working-dir

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leaanthony
Copy link
Copy Markdown
Member Author

🤖 PR Triage Review

Accepted

Runs pre/post build hooks in project directory instead of bin directory (v2 CLI). Fixes build hook execution context.

Platform: All (v2, CLI)

Next Steps: Dispatching for testing on all platforms.


Reviewed by Wails PR Reviewer Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pre-Build Hooks execute in the post-build directory

1 participant