From 29f751931ab7645bf8a972c9a7670002cd20536f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Wed, 10 Dec 2025 21:59:12 +1100 Subject: [PATCH] fix: remove duplicate iOS subcommand and make SDK_PATH lazy in iOS Taskfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove duplicate iOS subcommand registration in main.go (merge artifact) - Make SDK_PATH a task-level variable in iOS Taskfile to avoid eager evaluation that fails on non-macOS systems when running Android builds This fixes Android builds failing with "xcrun: command not found" on Linux systems where Xcode tools are unavailable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- v3/cmd/wails3/main.go | 5 ----- .../commands/build_assets/ios/Taskfile.yml | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/v3/cmd/wails3/main.go b/v3/cmd/wails3/main.go index cd84f2ad7..268beaa2e 100644 --- a/v3/cmd/wails3/main.go +++ b/v3/cmd/wails3/main.go @@ -130,11 +130,6 @@ func main() { return commands.SignWrapper(&signWrapperFlags, sign.OtherArgs()) }) - // iOS tools - ios := app.NewSubCommand("ios", "iOS tooling") - ios.NewSubCommandFunction("overlay:gen", "Generate Go overlay for iOS bridge shim", commands.IOSOverlayGen) - ios.NewSubCommandFunction("xcode:gen", "Generate Xcode project in output directory", commands.IOSXcodeGen) - // iOS tools ios := app.NewSubCommand("ios", "iOS tooling") ios.NewSubCommandFunction("overlay:gen", "Generate Go overlay for iOS bridge shim", commands.IOSOverlayGen) diff --git a/v3/internal/commands/build_assets/ios/Taskfile.yml b/v3/internal/commands/build_assets/ios/Taskfile.yml index bf1502a71..19f57f04f 100644 --- a/v3/internal/commands/build_assets/ios/Taskfile.yml +++ b/v3/internal/commands/build_assets/ios/Taskfile.yml @@ -5,8 +5,8 @@ includes: vars: BUNDLE_ID: '{{.BUNDLE_ID | default "com.wails.app"}}' - SDK_PATH: - sh: xcrun --sdk iphonesimulator --show-sdk-path + # SDK_PATH is computed lazily at task-level to avoid errors on non-macOS systems + # Each task that needs it defines SDK_PATH in its own vars section tasks: install:deps: @@ -44,6 +44,8 @@ tasks: BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production,ios -trimpath -buildvcs=false -ldflags="-w -s"{{else}}-tags ios,debug -buildvcs=false -gcflags=all="-l"{{end}}' DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}' OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}' + SDK_PATH: + sh: xcrun --sdk iphonesimulator --show-sdk-path env: GOOS: ios CGO_ENABLED: 1 @@ -54,6 +56,9 @@ tasks: compile:objc: summary: Compile Objective-C iOS wrapper + vars: + SDK_PATH: + sh: xcrun --sdk iphonesimulator --show-sdk-path cmds: - xcrun -sdk iphonesimulator clang -target arm64-apple-ios15.0-simulator -isysroot {{.SDK_PATH}} -framework Foundation -framework UIKit -framework WebKit -o {{.BIN_DIR}}/{{.APP_NAME}} build/ios/main.m - codesign --force --sign - {{.BIN_DIR}}/{{.APP_NAME}} @@ -113,6 +118,9 @@ tasks: summary: Compile the iOS executable from Go archive and main.m deps: - task: build + vars: + SDK_PATH: + sh: xcrun --sdk iphonesimulator --show-sdk-path cmds: - | MAIN_M=build/ios/xcode/main/main.m @@ -137,6 +145,9 @@ tasks: - go.sum generates: - frontend/bindings/**/* + vars: + SDK_PATH: + sh: xcrun --sdk iphonesimulator --show-sdk-path cmds: - wails3 generate bindings -f '{{.BUILD_FLAGS}}' -clean=true env: