Skip to content

Commit ee8fbc9

Browse files
committed
Add post-install phase for Android to install_swift_sdk.sh
1 parent 102fa28 commit ee8fbc9

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.github/workflows/pull_request.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ jobs:
109109
name: Android Swift SDK
110110
# Workaround https://github.com/nektos/act/issues/1875
111111
uses: apple/swift-nio/.github/workflows/android_sdk.yml@main
112-
with:
113-
additional_command_arguments: "--target NIOCore"
114112

115113
release-builds:
116114
name: Release builds

Sources/NIOPerformanceTester/main.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ import NIOCore
2828
import NIOEmbedded
2929
import NIOFoundationCompat
3030
import NIOHTTP1
31+
#if os(Android)
32+
// workaround for error: reference to var 'stdout' is not concurrency-safe because it involves shared mutable state
33+
@preconcurrency import NIOPosix
34+
#else
3135
import NIOPosix
36+
#endif
3237
import NIOWebSocket
3338

3439
// Use unbuffered stdout to help detect exactly which test was running in the event of a crash.

scripts/install_swift_sdk.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,18 @@ swift --version
127127

128128
log "Installing Swift SDK"
129129
swift sdk install "$sdk_path"
130+
131+
if [[ "$sdk" == "android-sdk" ]]; then
132+
log "Swift SDK Post-install"
133+
# guess some common places where the swift-sdks file lives
134+
cd ~/Library/org.swift.swiftpm || cd ~/.config/swiftpm || cd ~/.local/swiftpm || cd ~/.swiftpm || cd /root/.swiftpm
135+
136+
# download and link the NDK
137+
local android_ndk_version="r27d"
138+
curl -fsSL -o ndk.zip --retry 3 "https://dl.google.com/android/repository/android-ndk-${android_ndk_version}-$(uname -s).zip"
139+
unzip -q ndk.zip
140+
rm ndk.zip
141+
export ANDROID_NDK_HOME="${PWD}/android-ndk-${android_ndk_version}"
142+
./swift-sdks/*android*.artifactbundle/swift-android/scripts/setup-android-sdk.sh
143+
cd -
144+
fi

0 commit comments

Comments
 (0)