Skip to content

Commit 35a4e16

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 f1ef0dc commit 35a4e16

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
enable_ios_checks: true
9191
ios_pre_build_command: |
9292
pwd
93-
xcrun swift package init --type library
93+
"$(xcrun -f swift)" package init --type library
9494
9595
soundness:
9696
name: Soundness

.github/workflows/swift_package_test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ on:
110110
ios_build_command:
111111
type: string
112112
description: "macOS command to build the package for iOS"
113-
default: "xcrun swift build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
113+
default: "\"$(xcrun -f swift)\" build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
114114
linux_build_command:
115115
type: string
116116
description: "Linux command to build and test the package"
@@ -255,7 +255,8 @@ jobs:
255255
- name: Select Xcode
256256
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV
257257
- name: Swift version
258-
run: xcrun swift --version
258+
run: |
259+
"$(xcrun -f swift)" --version
259260
- name: Pre-build
260261
run: ${{ inputs.ios_pre_build_command }}
261262
- name: Build

0 commit comments

Comments
 (0)