Skip to content

fix(v3): replace Unix-only shell commands in cross-compilation Taskfiles#5456

Closed
taliesin-ai wants to merge 1 commit into
wailsapp:masterfrom
taliesin-ai:agent/engineer-windows/4923a358
Closed

fix(v3): replace Unix-only shell commands in cross-compilation Taskfiles#5456
taliesin-ai wants to merge 1 commit into
wailsapp:masterfrom
taliesin-ai:agent/engineer-windows/4923a358

Conversation

@taliesin-ai

@taliesin-ai taliesin-ai commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #5332 — same change, with all reviewer feedback addressed.

Replaces bash-only shell pipelines (grep/sed/tr, ${GOPATH:-$HOME/go}, command -v gcc) in the darwin/linux/windows cross-compilation Taskfiles with two new wails3 subcommands that work on Windows, Linux, and macOS:

wails3 tool docker-mounts

Outputs -v flags for the Go module cache and any local replace directives in go.mod. Addresses all coderabbitai/copilot review comments from #5332:

  • Double-quoted -v flags: single quotes are POSIX-only; cmd.exe treats them literally, breaking paths with spaces when go-task falls back to cmd.exe on Windows
  • GOPATH multi-entry: uses filepath.SplitList(gopath)[0] — only the first entry
  • Container path mapping: relative replace paths → /app/<relpath>; absolute Unix paths → /app/<relative-to-project-root>; Windows drive-letter paths (C:\...) → skipped (invalid Linux container destinations)

wails3 tool has-cc

Outputs true/false via exec.LookPath("gcc"/"clang"), replacing the bash-only command -v gcc check.

The chown $(id -u):$(id -g) step is gated with platforms: [linux, darwin] — Docker Desktop on Windows handles ownership automatically.

Test plan

  • go build ./v3/cmd/wails3/... — exit 0
  • go test ./v3/internal/commands/... — all pass
  • wails3 tool docker-mounts on Windows outputs -v "C:/Users/.../go/pkg/mod:/go/pkg/mod"
  • wails3 tool has-cc on Windows outputs true or false (no bash dependency)
  • wails3 build GOOS=darwin on Windows with Docker Desktop (requires Docker)

Summary by CodeRabbit

  • New Features

    • Added two new CLI utility commands: docker-mounts (generates Docker volume mount flags) and has-cc (detects compiler availability).
  • Refactor

    • Simplified cross-compilation build configuration by centralizing Docker mount logic into the new utility command, reducing redundant mount handling across macOS, Linux, and Windows build tasks.

Review Change Stack

Replaces bash-only shell pipelines (grep/sed/tr, ${GOPATH:-...},
command -v gcc) in the darwin/linux/windows cross-compilation Taskfiles
with two new wails3 subcommands that work on Windows, Linux, and macOS:

  wails3 tool docker-mounts
    Outputs -v flags for the Go module cache and any local replace
    directives in go.mod. Uses double quotes (not single quotes) so
    paths with spaces survive tokenisation in both POSIX sh and cmd.exe.
    Absolute replace paths: Windows drive-letter paths are skipped;
    Unix absolute paths are remapped relative to the project root
    under /app/, matching where Go resolves modules inside the container.

  wails3 tool has-cc
    Outputs "true"/"false" by calling exec.LookPath for gcc/clang,
    replacing the bash-only `command -v gcc` check.

The chown step that uses $(id -u):$(id -g) is gated with
`platforms: [linux, darwin]` — Docker Desktop on Windows handles
ownership automatically so the step is not needed there.

Fixes the original issue (PR wailsapp#5332) and addresses all reviewer
comments (coderabbitai, copilot) about container path mapping,
GOPATH multi-entry handling, and path quoting.
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

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: cbe2932c-f5f2-4d08-ab61-7ecf3b83bf73

📥 Commits

Reviewing files that changed from the base of the PR and between 99617cc and 5d7a23d.

📒 Files selected for processing (5)
  • v3/cmd/wails3/main.go
  • v3/internal/commands/build_assets/darwin/Taskfile.yml
  • v3/internal/commands/build_assets/linux/Taskfile.yml
  • v3/internal/commands/build_assets/windows/Taskfile.yml
  • v3/internal/commands/tool_docker_mounts.go

Walkthrough

This PR introduces two new CLI tool commands (docker-mounts and has-cc) to centralize Docker cross-compilation setup and C compiler detection, then refactors the darwin, linux, and windows Taskfiles to use these commands instead of inline mount composition logic.

Changes

Docker Mounts and Compiler Detection Tools

Layer / File(s) Summary
Tool commands implementation
v3/internal/commands/tool_docker_mounts.go
Adds ToolDockerMounts to generate Docker -v mount flags by resolving GOPATH, parsing go.mod local replace directives, validating replacement paths, and mapping them to container destinations. Adds ToolHasCC to detect gcc/clang availability via PATH probing. Includes firstGOPATHEntry helper and DockerMountsOptions/HasCCOptions option types.
CLI tool registration
v3/cmd/wails3/main.go
Registers new docker-mounts and has-cc subcommands in the wails3 tool command namespace, wiring each to its corresponding command handler.
Cross-platform Taskfile integration
v3/internal/commands/build_assets/darwin/Taskfile.yml, v3/internal/commands/build_assets/linux/Taskfile.yml, v3/internal/commands/build_assets/windows/Taskfile.yml
Updates build:docker tasks across all three platforms to replace inline GO_CACHE_MOUNT/REPLACE_MOUNTS mount logic with calls to wails3 tool docker-mounts. Linux Taskfile also replaces inline gcc/clang probing with wails3 tool has-cc for HAS_CC detection.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • wailsapp/wails#4845: Modifies the same Docker mount handling in Taskfiles to support spaces in paths; overlaps at the docker run command argument level.

Suggested labels

cli, v3-alpha

Suggested reviewers

  • leaanthony

Poem

🐰 Two new tools hop into the build process,
Docker mounts and compilers, no longer a mess!
From Taskfiles to CLI, the logic takes flight,
Cross-platform consistency, oh what a sight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% 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 directly relates to the main change: replacing Unix-only shell commands with cross-platform alternatives in the Taskfiles.
Description check ✅ Passed The description provides a comprehensive summary of changes, motivations, and test plans, addressing the key objectives. The linked issue reference and structured context are present, though formal checklist items are not explicitly checked.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 main module or its 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 and usage tips.

@taliesin-ai

Copy link
Copy Markdown
Collaborator Author

Superseded by PR #5470

This PR has been superseded by PR #5470 which rebases these changes on current master (this PR was behind by several commits and could not be merged directly).

PR #5470 contains the same fixes with all reviewer concerns addressed. Please close this PR and review PR #5470.

CC @leaanthony


Taliesin is an AI agent. CC @leaanthony

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.

1 participant