Skip to content

fix(v3): run root Taskfile for build/package/dev so customisations are honoured (#5615) - #5617

Merged
taliesin-ai merged 5 commits into
masterfrom
fix/v3-taskfile-root-dispatch-5615
Jul 1, 2026
Merged

taliesin-ai merged 5 commits into
masterfrom
fix/v3-taskfile-root-dispatch-5615

Conversation

@leaanthony

@leaanthony leaanthony commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes #5615.

wails3 build / dev / package were silently bypassing the project's root Taskfile.yml. In task_wrapper.go, the CLI rewrote the verb to a platform-namespaced task (build → linux:build) unconditionally — because the target OS defaults to runtime.GOOS, which is always a valid platform. So every invocation jumped straight into the platform namespace, and any customisation a user made to the root build/package/run task never ran. Editing the root Taskfile (the file users are meant to customise) appeared to have no effect, which is what triggered the report.

Fix

The root tasks now dispatch to the platform Taskfile via a {{.GOOS}} variable instead of the {{OS}} built-in:

vars:
  GOOS: '{{.GOOS | default OS}}'   # host OS by default, overridden by `wails3 build GOOS=...`
tasks:
  build:
    cmds:
      - task: "{{.GOOS}}:build"

The CLI now runs the root task (build/package) and passes GOOS/ARCH through as variables, rather than targeting the platform-prefixed task directly. This means root-Taskfile customisations are honoured for both native and cross-compilation builds:

  • wails3 build → root build → {{.GOOS}} = host → darwin:build (root task runs)
  • wails3 build GOOS=windows → root build (with GOOS=windows) → windows:build (root task still runs)

sign, which has no root task, still targets the platform-specific task directly. The experimental wake runner keeps using the concrete platform task name (unchanged).

Verification

  • New/updated unit tests in task_wrapper_test.go (host & cross dispatch, sign, GOOS arg/env precedence — host-relative so they pass on any platform) and a template regression test TestCommonTaskfileDispatchesViaGOOS.
  • End-to-end on macOS and Linux with a fresh wails3 init -t react: a marker added to the root build task now runs for both wails3 build and wails3 build GOOS=windows, then dispatches to the correct platform task. (Confirmed via the literal wails3 dev path on Linux too.)

⚠️ Backward compatibility

Projects generated before this change have a root Taskfile that still uses {{OS}}:build and no GOOS var. With the new CLI:

  • Native builds work as before.
  • Cross-compilation (wails3 build GOOS=…) on such projects will build for the host OS, because the old root task ignores the passed GOOS var. Those projects need to update their root Taskfile.yml to use {{.GOOS}} (or be re-initialised) to cross-compile. Since this targets v3 alpha, calling this out for awareness.

Note on the original report

I could not reproduce the reporter's literal symptom — a fresh wails3 init -t react + wails3 dev built successfully on both Linux and macOS. This PR fixes the root-Taskfile bypass identified during triage (the behaviour @leaanthony pointed to). If @its-ernest hit an actual compile/task error, that may be separate — worth confirming with their exact task output before closing.

Summary by CodeRabbit

  • New Features

    • Build, package, and run task routing is now driven by a configurable target OS setting (defaulting to the host OS), improving cross-platform consistency.
  • Bug Fixes

    • Cross-compilation now consistently passes both target OS and architecture to task execution.
    • Build/package flows apply root task customizations correctly while keeping platform-specific targeting where required.
    • MCP-enabled builds updated to align with the new routing and tag handling (no duplicate tags).

…e honoured (#5615)

wails3 build/dev/package rewrote the verb to a platform-namespaced task
(build -> {{OS}}:build) unconditionally, bypassing the project's root
Taskfile.yml. Any user customisation to the root build/package/run task
was silently ignored.

The root tasks now dispatch to the platform Taskfile via a {{.GOOS}}
variable (defaulting to the host OS), and the CLI runs the root task,
passing GOOS/ARCH through as variables. This honours root-Taskfile
customisations for both native and cross-compilation builds. sign, which
has no root task, still targets the platform task directly. The
experimental wake runner keeps using the concrete platform task name.
Copilot AI review requested due to automatic review settings June 15, 2026 21:14
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4eea873d-6f53-48d3-a8a1-1b7e8fa2f1c5

📥 Commits

Reviewing files that changed from the base of the PR and between 6d97949 and e71e8db.

📒 Files selected for processing (2)
  • v3/internal/commands/task_wrapper.go
  • v3/internal/templates/taskfile_template_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • v3/internal/templates/taskfile_template_test.go
  • v3/internal/commands/task_wrapper.go

Walkthrough

Adds a GOOS variable to the common Taskfile template and updates CLI task dispatch so build and package use root tasks with explicit GOOS and ARCH arguments. Tests were updated to match the new routing and template behavior.

Changes

Root Taskfile GOOS dispatch

Layer / File(s) Summary
Common Taskfile GOOS variable and dispatch routing
v3/internal/templates/_common/Taskfile.tmpl.yml
Adds GOOS variable defaulting to OS and changes build, package, and run to dispatch through {{.Opn}}.GOOS: targets.
CLI task wrapper rootDispatchTasks and wrapTask refactor
v3/internal/commands/task_wrapper.go
Adds rootDispatchTasks for build and package, changes wrapTask to pass GOOS and ARCH, and separates CLI task selection from Wake execution targeting.
Updated wrapper and template tests
v3/internal/commands/task_wrapper_test.go, v3/internal/commands/mcp_tags_test.go, v3/internal/templates/taskfile_template_test.go
Updates task-name and argument expectations across wrapper tests, MCP-tag build tests, and template dispatch validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • wailsapp/wails#3748: Updates the same common Taskfile template’s build/package/run dispatch routing.
  • wailsapp/wails#4488: Modifies the same task_wrapper.go dispatch path and argument forwarding logic.
  • wailsapp/wails#5126: Also changes Taskfile template dispatch selection for platform-specific tasks.

Suggested labels

Enhancement, cli, v3-alpha, size:XL

🐇 I hopped through Taskfiles, with GOOS in my paw,
Root tasks now dispatch cleanly—no brittle old law.
build and package say hello to the root,
While ARCH and GOOS tag along in the route.
The template now hums with a platform-wise tune. 🌙

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: root Taskfile dispatch for build/package/dev to honor customizations.
Description check ✅ Passed The description covers the fix, motivation, verification, and linked issue, but omits some template sections like type and checklist details.
Linked Issues check ✅ Passed The changes update the scaffolded Taskfile and CLI dispatch so root tasks run correctly for dev/build/package, matching #5615.
Out of Scope Changes check ✅ Passed The diff stays focused on Taskfile dispatch and related tests, with no clear unrelated or extra-scope code changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/v3-taskfile-root-dispatch-5615

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.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the v3 CLI’s task dispatch so wails3 build and wails3 package execute the project’s root Taskfile.yml tasks (allowing user customisations there to run), while still dispatching into platform-specific Taskfiles via a new GOOS variable in the scaffolded Taskfile template.

Changes:

  • Update the root Taskfile template to dispatch build/package/run via {{.GOOS}} (with a default to host OS).
  • Change the CLI task wrapper to run root tasks for build/package and pass GOOS/ARCH through as Task variables.
  • Add/adjust unit tests to cover host vs cross dispatch, and template regression coverage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v3/UNRELEASED_CHANGELOG.md Adds a changelog entry describing the task dispatch fix (currently mentions dev, which appears inaccurate).
v3/internal/templates/taskfile_template_test.go Adds a regression test ensuring the Taskfile template dispatches via {{.GOOS}}.
v3/internal/templates/_common/Taskfile.tmpl.yml Introduces a GOOS var and updates root tasks to dispatch to {{.GOOS}}:<verb>.
v3/internal/commands/task_wrapper.go Routes build/package through root tasks and forwards GOOS/ARCH as variables.
v3/internal/commands/task_wrapper_test.go Updates/extends tests to validate new wrapper behavior and variable passthrough.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread v3/internal/commands/task_wrapper.go Outdated
Comment thread v3/UNRELEASED_CHANGELOG.md Outdated
Comment thread v3/internal/templates/taskfile_template_test.go Outdated

@taliesin-ai taliesin-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. De-conflicted task_wrapper.go against master's MCP build-tag feature (add/add — kept both rootDispatchTasks and envTags/mergeTags). Updated TestBuildCommandWithMCPEnvVar to reflect this PR's root-dispatch change (task name 'build' + GOOS var) while preserving the MCP-tag assertions; the mcp tag still flows via EXTRA_TAGS. commands + templates tests pass.

@taliesin-ai
taliesin-ai enabled auto-merge (squash) June 30, 2026 00:48
@taliesin-ai
taliesin-ai disabled auto-merge June 30, 2026 00:56
Addresses review feedback: rootDispatchTasks covers build/package only; the
root Taskfile's run dispatch is invoked by 'wails3 dev' directly, not through
this wrapper. Reword the test comment likewise.
@taliesin-ai
taliesin-ai enabled auto-merge (squash) June 30, 2026 04:22
@taliesin-ai
taliesin-ai merged commit 75c74f2 into master Jul 1, 2026
20 of 22 checks passed
@taliesin-ai
taliesin-ai deleted the fix/v3-taskfile-root-dispatch-5615 branch July 1, 2026 00:07
leaanthony pushed a commit that referenced this pull request Jul 1, 2026
…kfile for build/package/dev so customisations are honoured (#5615)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wails v3 CLI project scaffold with react does not yields broken Taskfile.yml

3 participants