feat(v3): add APP_TAGS, APP_LDFLAGS, APP_CGO_ENABLED build customizat… - #5798
feat(v3): add APP_TAGS, APP_LDFLAGS, APP_CGO_ENABLED build customizat…#5798mortenolsrud wants to merge 5 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe build templates add shared variables for Go tags, linker flags, and CGO settings. Server, mobile, native, and Docker builds now apply these variables. Tests and documentation cover propagation, precedence, and platform behavior. ChangesBuild customization
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
b4f5fcd to
70fe920
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v3/internal/commands/build_assets/windows/Taskfile.yml`:
- Around line 60-63: Update the build dispatch logic to compute one effective
CGO-enabled value by preferring APP_CGO_ENABLED over CGO_ENABLED before
selecting build:native or build:docker. Reuse that same effective value for the
native build environment’s CGO_ENABLED setting, ensuring APP_CGO_ENABLED=1
routes through Docker and APP_CGO_ENABLED=0 overrides CGO_ENABLED=1.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 559bec92-1930-4f38-ab7e-5849058de0ee
📒 Files selected for processing (7)
v3/internal/commands/build_assets/Taskfile.tmpl.ymlv3/internal/commands/build_assets/android/Taskfile.ymlv3/internal/commands/build_assets/darwin/Taskfile.ymlv3/internal/commands/build_assets/ios/Taskfile.ymlv3/internal/commands/build_assets/linux/Taskfile.ymlv3/internal/commands/build_assets/windows/Taskfile.ymlv3/internal/templates/_common/Taskfile.tmpl.yml
70fe920 to
f15015a
Compare
4265017 to
abcfe79
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The server Taskfile template incorrectly references EXTRA_TAGS inside a with block (breaking extra tags), and APP_CGO_ENABLED handling won’t honor a YAML numeric 0 override due to falsey checks.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds project-level, env-overridable build customization variables (tags, ldflags, and CGO override) to avoid editing platform Taskfiles directly, and threads those variables through all platform/server build Taskfiles while standardizing desktop dev builds to always include -tags dev.
Changes:
- Introduces root Taskfile variables
APP_TAGS*,APP_LDFLAGS, andAPP_CGO_ENABLEDfor additive build customization. - Updates platform Taskfiles (Windows/Linux/macOS/Android/iOS) and server build template to compose
APP_*with existing tag/ldflag behavior. - Adjusts Windows build dispatch to resolve an “effective” CGO setting before choosing native vs Docker build.
File summaries
| File | Description |
|---|---|
| v3/internal/templates/_common/Taskfile.tmpl.yml | Adds user-owned build customization vars (APP_TAGS*, APP_LDFLAGS, APP_CGO_ENABLED) to the root Taskfile template. |
| v3/internal/commands/build_assets/windows/Taskfile.yml | Composes APP_TAGS*/APP_LDFLAGS into build flags and introduces effective CGO resolution for docker/native dispatch. |
| v3/internal/commands/build_assets/linux/Taskfile.yml | Composes APP_TAGS*/APP_LDFLAGS into build flags and adds APP_CGO_ENABLED override support. |
| v3/internal/commands/build_assets/darwin/Taskfile.yml | Composes APP_TAGS*/APP_LDFLAGS into build flags and adds APP_CGO_ENABLED override support. |
| v3/internal/commands/build_assets/android/Taskfile.yml | Adds APP_TAGS* + APP_LDFLAGS composition for Android builds. |
| v3/internal/commands/build_assets/ios/Taskfile.yml | Adds APP_TAGS* + APP_LDFLAGS composition for iOS builds. |
| v3/internal/commands/build_assets/Taskfile.tmpl.yml | Extends server build flags template to include APP_TAGS*/APP_LDFLAGS/EXTRA_TAGS. |
Review details
Suppressed comments (1)
v3/internal/commands/build_assets/windows/Taskfile.yml:69
CGO_ENABLEDis derived withif .APP_CGO_ENABLED, so a YAML numericAPP_CGO_ENABLED: 0will be ignored (treated as false) and the environment will fall back to the default. This breaks the intended “override CGO_ENABLED” behavior for disabling CGO.
GOOS: windows
CGO_ENABLED: '{{if .APP_CGO_ENABLED}}{{.APP_CGO_ENABLED}}{{else}}{{.CGO_ENABLED | default "0"}}{{end}}'
GOARCH: '{{.ARCH | default ARCH}}'
- Files reviewed: 7/7 changed files
- Comments generated: 4
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
…ion vars
Projects that need custom build tags (e.g. sqlite_fts5 for CGO SQLite),
custom ldflags (e.g. -X main.Version=...), or CGO overrides currently must
edit platform Taskfiles directly. This creates merge conflicts on every
Wails version bump.
Add project-level build customization variables that are defined in the
root Taskfile.yml (user-owned, never overwritten) and consumed by all
platform Taskfiles (framework-owned, safely regenerable):
- APP_TAGS: build tags included on every platform and mode
- APP_TAGS_{LINUX,DARWIN,WINDOWS,ANDROID,IOS,SERVER}: platform-specific
- APP_LDFLAGS: linker flags appended (version injection, etc.)
- APP_CGO_ENABLED: optional CGO override (empty = platform default)
- EXTRA_TAGS: unchanged semantics (per-invocation CLI override)
All variables are env-overridable for ad-hoc builds. Empty values produce
no change from current behavior (fully backwards compatible).
Desktop dev builds now always emit -tags dev (matching mobile pattern)
to simplify the conditional logic.
Also adds EXTRA_TAGS + APP_* support to Android and iOS Taskfiles, which
previously had no user-extensible tag mechanism.
abcfe79 to
5ca2b20
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v3/internal/commands/build_assets/windows/Taskfile.yml`:
- Line 104: Update the EFFECTIVE_CGO_ENABLED fallback in the Windows Docker
build task to default to "0" instead of "1", matching the existing Windows task
defaults while preserving explicit APP_CGO_ENABLED and CGO_ENABLED overrides.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5dacd80f-e86a-42ca-a0d0-a8478af20fc8
📒 Files selected for processing (13)
docs/src/content/docs/guides/build/customization.mdxv3/internal/commands/build_assets/Taskfile.tmpl.ymlv3/internal/commands/build_assets/android/Taskfile.ymlv3/internal/commands/build_assets/darwin/Taskfile.ymlv3/internal/commands/build_assets/docker/Dockerfile.crossv3/internal/commands/build_assets/docker/Dockerfile.serverv3/internal/commands/build_assets/ios/Taskfile.ymlv3/internal/commands/build_assets/linux/Taskfile.ymlv3/internal/commands/build_assets/windows/Taskfile.ymlv3/internal/commands/taskfile_build_customization_test.gov3/internal/commands/taskfile_obfuscation_test.gov3/internal/templates/_common/Taskfile.tmpl.ymlv3/internal/templates/taskfile_template_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- v3/internal/commands/build_assets/android/Taskfile.yml
- v3/internal/templates/_common/Taskfile.tmpl.yml
- v3/internal/commands/build_assets/ios/Taskfile.yml
…ion vars
Description
Projects that need custom build tags (e.g.
sqlite_fts5for CGO SQLite), custom ldflags (e.g.-X main.Version=...), or CGO overrides currently must edit platform Taskfiles directly. This creates merge conflicts on every Wails version bump.Add project-level build customization variables defined in the root
Taskfile.yml(user-owned, never overwritten) and consumed by all platform Taskfiles (framework-owned, safely regenerable):APP_TAGS— build tags included on every platform and modeAPP_TAGS_{LINUX,DARWIN,WINDOWS,ANDROID,IOS,SERVER}— platform-specific tagsAPP_LDFLAGS— linker flags appended to all buildsAPP_CGO_ENABLED— optional CGO override (empty = platform default)EXTRA_TAGS— unchanged semantics (per-invocation CLI override)All variables are env-overridable for ad-hoc builds (
APP_TAGS="extra" task build). Empty values produce no change from current behavior (fully backwards compatible).Also adds
EXTRA_TAGS+APP_*support to Android and iOS Taskfiles, which previously had no user-extensible tag mechanism.Desktop dev builds now always emit
-tags dev(matching mobile pattern) to simplify the conditional logic.Type of change
How Has This Been Tested?
Verified on a production Wails Android app that uses
APP_TAGS: "sqlite_fts5,sqlite_foreign_keys"andAPP_LDFLAGS: "-X main.Version=1.0.0":task build— tags correctly appear ingo buildinvocationtask android:build— Android build includes APP_TAGS + APP_TAGS_ANDROIDEXTRA_TAGS="debug_sql" task build— env override composes correctlyEXTRA_TAGSusage unchangedLinux: Ubuntu 22.04.5 LTS
Test Configuration
Wails v3.0.0-alpha2.111
Go 1.26.4
Ubuntu 22.04.5 LTS
go-task v3.x
Checklist:
website/src/pages/changelog.mdxwith details of this PR (v3 changelog entries are added automatically)Summary by CodeRabbit