Skip to content

Commit

Permalink
Only apply patches to non-trunk branches on the CI because they've be…
Browse files Browse the repository at this point in the history
…en upstreamed
  • Loading branch information
finagolfin committed Dec 3, 2024
1 parent f86b18a commit 35bc5d0
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 57 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,11 @@ jobs:
git apply swift-android.patch swift-android-ci.patch swift-crypto.patch swift-system.patch
if [ ${{ matrix.version }} = 'release' ]; then
git apply swift-android-ci-release.patch swift-android-foundation-release.patch
git apply swift-android-ci-release.patch swift-android-foundation-release.patch
else
if [ ${{ matrix.version }} = 'devel' ]; then
git apply swift-android-ci-devel.patch
fi
git apply swift-android-ci-except-release.patch swift-android-foundation-except-release.patch
fi
Expand Down
68 changes: 68 additions & 0 deletions swift-android-ci-devel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
diff --git a/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift b/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
index 0be22ce8..33ca7ee5 100644
--- a/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
+++ b/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
@@ -16,6 +16,9 @@ public import Foundation
public import LanguageServerProtocol
import SKLogging
import SwiftExtensions
+#if canImport(Android)
+import Android
+#endif
#else
import Dispatch
import Foundation
diff --git a/swiftpm/Package.swift b/swiftpm/Package.swift
index 48cd98431..6eaacae00 100644
--- a/swiftpm/Package.swift
+++ b/swiftpm/Package.swift
@@ -76,7 +77,10 @@ let includeDynamicLibrary: Bool = false
let systemSQLitePkgConfig: String? = nil
#else
let includeDynamicLibrary: Bool = true
-let systemSQLitePkgConfig: String? = "sqlite3"
+var systemSQLitePkgConfig: String? = "sqlite3"
+if ProcessInfo.processInfo.environment["SWIFTCI_INSTALL_RPATH_OS"] == "android" {
+ systemSQLitePkgConfig = nil
+}
#endif

/** An array of products which have two versions listed: one dynamically linked, the other with the
@@ -199,7 +203,7 @@ let package = Package(
dependencies: [
"_AsyncFileSystem",
.target(name: "SPMSQLite3", condition: .when(platforms: [.macOS, .iOS, .tvOS, .watchOS, .visionOS, .macCatalyst, .linux])),
- .product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows])),
+ .product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows, .android])),
.product(name: "DequeModule", package: "swift-collections"),
.product(name: "OrderedCollections", package: "swift-collections"),
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
diff --git a/swiftpm/Sources/Basics/SQLite.swift b/swiftpm/Sources/Basics/SQLite.swift
index 2ad235030..803490b48 100644
--- a/swiftpm/Sources/Basics/SQLite.swift
+++ b/swiftpm/Sources/Basics/SQLite.swift
@@ -12,7 +12,7 @@

import Foundation

-#if SWIFT_PACKAGE && os(Windows)
+#if SWIFT_PACKAGE && (os(Windows) || os(Android))
#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftToolchainCSQLite
#else
From 355649608eb168652ff103d2a2029ba9539eea4b
From: Jake Petroules <[email protected]>
Date: Sun, 17 Nov 2024 02:21:37 -0800
Subject: [PATCH] Fix the Android build
diff --git a/swift-tools-support-core/Sources/TSCUtility/Tracing.swift b/swift-tools-support-core/Sources/TSCUtility/Tracing.swift
index b53d26ca..418d4f84 100644
--- a/swift-tools-support-core/Sources/TSCUtility/Tracing.swift
+++ b/swift-tools-support-core/Sources/TSCUtility/Tracing.swift
@@ -9,6 +9,7 @@
*/

import Foundation
+import TSCLibc

public enum TracingEventType: String, Codable, Sendable {
case asyncBegin
52 changes: 0 additions & 52 deletions swift-android-ci-except-release.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,6 @@ index 92a1ee38..52273afb 100644
add_subdirectory(BuildSystem)
-add_subdirectory(Ninja)
+#add_subdirectory(Ninja)
diff --git a/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift b/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
index 0be22ce8..33ca7ee5 100644
--- a/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
+++ b/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
@@ -16,6 +16,9 @@ public import Foundation
public import LanguageServerProtocol
import SKLogging
import SwiftExtensions
+#if canImport(Android)
+import Android
+#endif
#else
import Dispatch
import Foundation
diff --git a/swiftpm/Package.swift b/swiftpm/Package.swift
index 48cd98431..6eaacae00 100644
--- a/swiftpm/Package.swift
+++ b/swiftpm/Package.swift
@@ -76,7 +77,10 @@ let includeDynamicLibrary: Bool = false
let systemSQLitePkgConfig: String? = nil
#else
let includeDynamicLibrary: Bool = true
-let systemSQLitePkgConfig: String? = "sqlite3"
+var systemSQLitePkgConfig: String? = "sqlite3"
+if ProcessInfo.processInfo.environment["SWIFTCI_INSTALL_RPATH_OS"] == "android" {
+ systemSQLitePkgConfig = nil
+}
#endif

/** An array of products which have two versions listed: one dynamically linked, the other with the
@@ -199,7 +203,7 @@ let package = Package(
dependencies: [
"_AsyncFileSystem",
.target(name: "SPMSQLite3", condition: .when(platforms: [.macOS, .iOS, .tvOS, .watchOS, .visionOS, .macCatalyst, .linux])),
- .product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows])),
+ .product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows, .android])),
.product(name: "DequeModule", package: "swift-collections"),
.product(name: "OrderedCollections", package: "swift-collections"),
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
diff --git a/swiftpm/Sources/Basics/SQLite.swift b/swiftpm/Sources/Basics/SQLite.swift
index 2ad235030..803490b48 100644
--- a/swiftpm/Sources/Basics/SQLite.swift
+++ b/swiftpm/Sources/Basics/SQLite.swift
@@ -12,7 +12,7 @@

import Foundation

-#if SWIFT_PACKAGE && os(Windows)
+#if SWIFT_PACKAGE && (os(Windows) || os(Android))
#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftToolchainCSQLite
#else
diff --git a/swiftpm/Utilities/bootstrap b/swiftpm/Utilities/bootstrap
index 085056de..1ded1a90 100755
--- a/swiftpm/Utilities/bootstrap
Expand Down
11 changes: 7 additions & 4 deletions swift-android-ci-release.patch
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@ diff --git a/sourcekit-lsp/Sources/sourcekit-lsp/SourceKitLSP.swift b/sourcekit-

extension AbsolutePath {
public init?(argument: String) {
From 355649608eb168652ff103d2a2029ba9539eea4b
From: Jake Petroules <[email protected]>
Date: Sun, 17 Nov 2024 02:21:37 -0800
Subject: [PATCH] Fix the Android build
diff --git a/swift-tools-support-core/Sources/TSCUtility/Tracing.swift b/swift-tools-support-core/Sources/TSCUtility/Tracing.swift
index b53d26ca..418d4f84 100644
--- a/swift-tools-support-core/Sources/TSCUtility/Tracing.swift
+++ b/swift-tools-support-core/Sources/TSCUtility/Tracing.swift
@@ -9,6 +9,9 @@
@@ -9,6 +9,7 @@
*/

import Foundation
+#if canImport(Android)
+import Android
+#endif
+import TSCLibc

public enum TracingEventType: String, Codable, Sendable {
case asyncBegin
Expand Down

0 comments on commit 35bc5d0

Please sign in to comment.