Skip to content

Commit ca3ddfb

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 a5ed4ea commit ca3ddfb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.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"
@@ -311,7 +311,8 @@ jobs:
311311
- name: Select Xcode
312312
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV
313313
- name: Swift version
314-
run: xcrun swift --version
314+
run: |
315+
"$(xcrun -f swift)" --version
315316
- name: Pre-build
316317
run: ${{ inputs.ios_pre_build_command }}
317318
- name: Build

0 commit comments

Comments
 (0)