Skip to content

Commit 475a64c

Browse files
committed
Fix build warnings in the workflow for iOS
IMHO, it would be better to use `$(xcrun -f swift)` ("find" mode) instead of `xcrun swift` ("run" mode). `xcrun swift` is fine with packages that do not contain `executableTarget`, but it causes the following errors with packages that contain `executableTarget`: ``` clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] ``` To prevent this, we can use `$(xcrun -f swift)` instead of `xcrun swift`. Related discussion: https://forums.swift.org/t/getting-incompatible-sysroot-warning-when-compiling-for-ios-with-sdk-and-target-set/80584
1 parent e96b1ad commit 475a64c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/swift_package_test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ on:
134134
ios_build_command:
135135
type: string
136136
description: "macOS command to build the package for iOS"
137-
default: "xcrun swift build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
137+
default: "\"$(xcrun -f swift)\" build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
138138
ios_build_timeout:
139139
type: number
140140
description: "The default step timeout in minutes"
@@ -307,7 +307,8 @@ jobs:
307307
- name: Select Xcode
308308
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV
309309
- name: Swift version
310-
run: xcrun swift --version
310+
run: |
311+
"$(xcrun -f swift)" --version
311312
- name: Pre-build
312313
run: ${{ inputs.ios_pre_build_command }}
313314
- name: Build

0 commit comments

Comments
 (0)