fix(v3): enable server mode build on macOS (darwin)#5103
fix(v3): enable server mode build on macOS (darwin)#5103RALIST wants to merge 1 commit 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 (22)
WalkthroughThis PR updates Go build constraints for Darwin-specific platform files to exclude server builds, and adds two no-op AttachModal method implementations for server mode compatibility. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.16.5)v3/pkg/application/application_server.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m v3/pkg/application/browser_window.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m v3/pkg/application/clipboard_darwin.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m
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 |
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