Skip to content

Commit 38d0236

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 fe7a90a commit 38d0236

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
@@ -130,7 +130,7 @@ on:
130130
ios_build_command:
131131
type: string
132132
description: "macOS command to build the package for iOS"
133-
default: "xcrun swift build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
133+
default: "\"$(xcrun -f swift)\" build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
134134
linux_build_command:
135135
type: string
136136
description: "Linux command to build and test the package"
@@ -295,7 +295,8 @@ jobs:
295295
- name: Select Xcode
296296
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV
297297
- name: Swift version
298-
run: xcrun swift --version
298+
run: |
299+
"$(xcrun -f swift)" --version
299300
- name: Pre-build
300301
run: ${{ inputs.ios_pre_build_command }}
301302
- name: Build

0 commit comments

Comments
 (0)