Skip to content

Commit 46cbae8

Browse files
committed
Modify and apply new Android overlay patches to 6.0 devel branch on CI too
1 parent 3c8fc95 commit 46cbae8

File tree

5 files changed

+70
-49
lines changed

5 files changed

+70
-49
lines changed

.github/workflows/sdks.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ jobs:
114114
STUPID_FILE_RENAMING=Tool
115115
else
116116
sed -i "s%r26%ndk/26%" swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
117-
if [ ${{ matrix.version }} = 'devel' ]; then
118-
sed -i "s%canImport(Android%os(Android%" sourcekit-lsp/Sources/SKSupport/Process+Run.swift
119-
git apply -C1 readlink-devel.patch
120-
fi
121117
STUPID_FILE_RENAMING=Command
122118
fi
123119
if [ ${{ matrix.version }} = 'release-25c' ]; then
@@ -131,8 +127,13 @@ jobs:
131127
git apply -C0 swift-android-foundation-ndk26.patch
132128
if [ ${{ matrix.version }} = 'release-26d' ]; then
133129
git apply swift-android-stdlib-ndk26.patch
134-
elif [ ${{ matrix.version }} = 'trunk' ]; then
130+
else
135131
git apply android-overlay/foundation-fixes.patch android-overlay/import-android.patch android-overlay/swift-argument-parser.patch android-overlay/swift-system-tag.patch android-overlay/yams.patch
132+
if [ ${{ matrix.version }} = 'devel' ]; then
133+
git apply android-overlay/sourcekit-lsp-swiftpm-devel.patch
134+
else
135+
git apply android-overlay/sourcekit-lsp-trunk.patch
136+
fi
136137
fi
137138
fi
138139
sed -i "s%/data/data/com.termux/files%$SDK%" $SDK/usr/lib/pkgconfig/sqlite3.pc
@@ -159,6 +160,11 @@ jobs:
159160
if [ ! -d ${{ steps.version.outputs.tag }}-ubuntu22.04 ]; then
160161
tar xf ~/${{ steps.version.outputs.tag }}-ubuntu22.04.tar.gz
161162
fi
163+
if [ ${{ matrix.version }} = 'devel' ]; then
164+
sed -i "s%canImport(Glibc%canImport(Android%" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
165+
sed -i "s%import Glibc%import Android%" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
166+
sed -i "s%TSCBasic, would be nice%TSCBasic, would be %" ${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift-package
167+
fi
162168
./${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift --version
163169
164170
tar xf ~/swift-${{ matrix.version }}-android-${{ matrix.arch }}*-sdk.tar.xz
@@ -169,7 +175,7 @@ jobs:
169175
path: swift-argument-parser
170176
- name: Build Swift Argument Parser package
171177
run: |
172-
if [ ${{ matrix.version }} = 'trunk' ]; then
178+
if [[ ${{ matrix.version }} != 'release'* ]]; then
173179
git apply sdk-config/android-overlay/swift-argument-parser.patch
174180
fi
175181
cd swift-argument-parser
@@ -199,7 +205,7 @@ jobs:
199205
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem-both-ndks.patch
200206
if [ ${{ matrix.version }} = 'release-25c' ]; then
201207
git apply -R ../sdk-config/swift-nio-ndk26.patch
202-
elif [ ${{ matrix.version }} = 'trunk' ]; then
208+
elif [[ ${{ matrix.version }} != 'release-26d' ]]; then
203209
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift package update
204210
cd .build/checkouts/swift-system/
205211
git apply ../../../../sdk-config/android-overlay/swift-system-checkout.patch
@@ -224,7 +230,7 @@ jobs:
224230
- name: Build Swift System package
225231
run: |
226232
cd swift-system
227-
if [ ${{ matrix.version }} = 'trunk' ]; then
233+
if [[ ${{ matrix.version }} != 'release'* ]]; then
228234
git apply ../sdk-config/android-overlay/swift-system.patch
229235
fi
230236
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
@@ -251,7 +257,7 @@ jobs:
251257
- name: Build Swift NIO SSH package
252258
run: |
253259
cd sns
254-
if [ ${{ matrix.version }} = 'trunk' ]; then
260+
if [[ ${{ matrix.version }} != 'release'* ]]; then
255261
git apply ../sdk-config/android-overlay/swift-nio-ssh.patch
256262
fi
257263
sed -i "s%url: .*swift-\(\w\+\)\.git.*$%path: \"../swift-\1\"),%g" Package.swift
@@ -266,7 +272,7 @@ jobs:
266272
cd snl
267273
if [ ${{ matrix.version }} = 'release-25c' ]; then
268274
sed -i "s%#include <time%#include <signal.h>\n#include <time%" Sources/CNIOBoringSSL/include/CNIOBoringSSL_asn1.h
269-
elif [ ${{ matrix.version }} = 'trunk' ]; then
275+
elif [ ${{ matrix.version }} != 'release-26d' ]; then
270276
git apply ../sdk-config/android-overlay/swift-nio-ssl.patch
271277
fi
272278
SWIFTCI_USE_LOCAL_DEPS=1 ../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
@@ -277,7 +283,7 @@ jobs:
277283
path: yams
278284
- name: Build Yams package
279285
run: |
280-
if [ ${{ matrix.version }} = 'trunk' ]; then
286+
if [[ ${{ matrix.version }} != 'release'* ]]; then
281287
git apply sdk-config/android-overlay/yams.patch
282288
fi
283289
cd yams
@@ -292,7 +298,7 @@ jobs:
292298
if: ${{ matrix.arch != 'armv7' }}
293299
run: |
294300
cd snh
295-
if [ ${{ matrix.version }} = 'trunk' ]; then
301+
if [[ ${{ matrix.version }} != 'release'* ]]; then
296302
git apply ../sdk-config/android-overlay/swift-nio-http2.patch
297303
fi
298304
sed -i "s%url: .*swift-\(\w\+\)\.git.*$%path: \"../swift-\1\"),%g" Package.swift

android-overlay/import-android.patch

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,6 @@ index e9967f64..0630fe53 100644
102102
// This is a lazily initialised global variable that when read for the first time, will ignore SIGPIPE.
103103
private let globallyIgnoredSIGPIPE: Bool = {
104104
/* no F_SETNOSIGPIPE on Linux :( */
105-
diff --git a/sourcekit-lsp/Sources/SourceKitD/dlopen.swift b/sourcekit-lsp/Sources/SourceKitD/dlopen.swift
106-
index 4adf5b44..07573da1 100644
107-
--- a/sourcekit-lsp/Sources/SourceKitD/dlopen.swift
108-
+++ b/sourcekit-lsp/Sources/SourceKitD/dlopen.swift
109-
@@ -19,6 +19,8 @@ import Darwin
110-
import Glibc
111-
#elseif canImport(Musl)
112-
import Musl
113-
+#elseif canImport(Android)
114-
+import Android
115-
#endif
116-
117-
public final class DLHandle: Sendable {
118105
diff --git a/sourcekit-lsp/Sources/SourceKitD/SKDRequestArray.swift b/sourcekit-lsp/Sources/SourceKitD/SKDRequestArray.swift
119106
index a68c4ae3..f8aed9d7 100644
120107
--- a/sourcekit-lsp/Sources/SourceKitD/SKDRequestArray.swift
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/sourcekit-lsp/Sources/SKSupport/dlopen.swift b/sourcekit-lsp/Sources/SKSupport/dlopen.swift
2+
index 4adf5b44..07573da1 100644
3+
--- a/sourcekit-lsp/Sources/SKSupport/dlopen.swift
4+
+++ b/sourcekit-lsp/Sources/SKSupport/dlopen.swift
5+
@@ -19,6 +19,8 @@ import Darwin
6+
import Glibc
7+
#elseif canImport(Musl)
8+
import Musl
9+
+#elseif canImport(Android)
10+
+import Android
11+
#endif
12+
13+
public final class DLHandle {
14+
diff --git a/swiftpm/Sources/Build/TestObservation.swift b/swiftpm/Sources/Build/TestObservation.swift
15+
index 98a8f5f8e..a86ff4675 100644
16+
--- a/swiftpm/Sources/Build/TestObservation.swift
17+
+++ b/swiftpm/Sources/Build/TestObservation.swift
18+
@@ -132,6 +132,8 @@ public func generateTestObservationCode(buildParameters: BuildParameters) -> Str
19+
@_exported import WinSDK
20+
#elseif os(WASI)
21+
@_exported import WASILibc
22+
+ #elseif canImport(Android)
23+
+ @_exported import Android
24+
#else
25+
@_exported import Darwin.C
26+
#endif
27+
diff --git a/swiftpm/Sources/CoreCommands/SwiftCommandState.swift b/swiftpm/Sources/CoreCommands/SwiftCommandState.swift
28+
index 38c190ec3..27d0762cf 100644
29+
--- a/swiftpm/Sources/CoreCommands/SwiftCommandState.swift
30+
+++ b/swiftpm/Sources/CoreCommands/SwiftCommandState.swift
31+
@@ -39,6 +39,8 @@ import Darwin
32+
import Glibc
33+
#elseif canImport(Musl)
34+
import Musl
35+
+#elseif canImport(Android)
36+
+import Android
37+
#endif
38+
39+
import func TSCBasic.exec
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/sourcekit-lsp/Sources/SourceKitD/dlopen.swift b/sourcekit-lsp/Sources/SourceKitD/dlopen.swift
2+
index 4adf5b44..07573da1 100644
3+
--- a/sourcekit-lsp/Sources/SourceKitD/dlopen.swift
4+
+++ b/sourcekit-lsp/Sources/SourceKitD/dlopen.swift
5+
@@ -19,6 +19,8 @@ import Darwin
6+
import Glibc
7+
#elseif canImport(Musl)
8+
import Musl
9+
+#elseif canImport(Android)
10+
+import Android
11+
#endif
12+
13+
public final class DLHandle: Sendable {

readlink-devel.patch

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)