fix(v3): enable server mode build on macOS (darwin)#5103
fix(v3): enable server mode build on macOS (darwin)#5103leaanthony merged 8 commits intowailsapp:v3-alphafrom
Conversation
Server mode (`-tags server`) fails to compile on macOS because: 1. Most darwin-specific `.go` and `.m` files lack the `!server` build constraint, causing symbol redeclaration conflicts with the server stubs in `application_server.go`. 2. `BrowserWindow` and `serverWebviewWindow` are missing the `attachModal`/`AttachModal` methods added to the `Window` and `webviewWindowImpl` interfaces, causing interface satisfaction errors. This was not caught because server mode was developed and tested on Linux, where all platform files already had `!server` constraints. Changes: - Add `&& !server` to build constraints in 20 darwin files (14 .go + 6 .m) - Add no-op `AttachModal` to `BrowserWindow` (Window interface) - Add no-op `attachModal` to `serverWebviewWindow` (webviewWindowImpl interface) Tested: full Wails application (30+ services, 110+ event types) builds and runs successfully in server mode on macOS arm64, serving the complete UI in a browser with working IPC.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (3)
WalkthroughTightened build constraints on many Darwin-specific files to exclude Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
Both scripts declare package main with func main(), causing a compile error when Go tries to build all files in the directory together. The build tag excludes them from normal compilation while still allowing individual execution via `go run`. Fixes CI error in #5103 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Server mode (
go build -tags server) fails to compile on macOS with multiple redeclaration errors. This PR fixes the build constraints so server mode works on darwin, matching the existing Linux and Windows support.Root cause
When
AttachModalwas added to theWindowandwebviewWindowImplinterfaces, the server mode types (BrowserWindow,serverWebviewWindow) were not updated. Additionally, most darwin-specific files (.goand.m) lack the!serverbuild constraint — unlike their Linux and Windows counterparts which already have it. This causes darwin platform implementations and server stubs to compile simultaneously, resulting in symbol redeclaration errors.Changes
.go+ 6.m): add&& !serverto build constraintsbrowser_window.go: add no-opAttachModal(Window)to satisfyWindowinterfaceapplication_server.go: add no-opattachModal(*WebviewWindow)to satisfywebviewWindowImplinterfaceErrors before this fix
Testing
Tested with a production Wails v3 application (30+ services, 110+ registered event types) on macOS arm64:
go build -tags server ./pkg/application/— compiles cleango build ./pkg/application/— normal darwin build unaffectedlocalhost:8080, IPC bindings and WebSocket events work in browserSummary by CodeRabbit
New Features
Chores