fix: remove duplicate iOS subcommand and make SDK_PATH lazy in iOS Taskfile

- 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 <noreply@anthropic.com>
This commit is contained in:
Lea Anthony 2025-12-10 21:59:12 +11:00
commit 29f751931a
2 changed files with 13 additions and 7 deletions

View file

@ -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)

View file

@ -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: