Skip to content

Commit d0d4ecb

Browse files
authored
Android: switch to the new swift-toolchain-sqlite package instead of requiring an external dependency (#8148)
I've been building with this patch both natively on Android and [on my Android CI](https://github.com/finagolfin/swift-android-sdk/blob/3493a85cd1ae767792ba01c8634e3d9456d19901/swift-android-ci-except-release.patch#L34), confirming that it [got rid of the external dependency on `libsqlite3.so`](https://github.com/finagolfin/swift-android-sdk/actions/runs/12095721068/job/33729218006#step:8:20591) and works well. @jakepetroules, along with your recent llbuild pull, this gets rid of the external SQLite3 dependency for the Android toolchain except for one llbuild executable, `swift-build-tool`, whose build is configured by CMake and appears to be unused, so we can clean that up last.
1 parent cfde665 commit d0d4ecb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Package.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ let includeDynamicLibrary: Bool = false
7676
let systemSQLitePkgConfig: String? = nil
7777
#else
7878
let includeDynamicLibrary: Bool = true
79-
let systemSQLitePkgConfig: String? = "sqlite3"
79+
var systemSQLitePkgConfig: String? = "sqlite3"
80+
if ProcessInfo.processInfo.environment["SWIFTCI_INSTALL_RPATH_OS"] == "android" {
81+
systemSQLitePkgConfig = nil
82+
}
8083
#endif
8184

8285
/** An array of products which have two versions listed: one dynamically linked, the other with the
@@ -199,7 +202,7 @@ let package = Package(
199202
dependencies: [
200203
"_AsyncFileSystem",
201204
.target(name: "SPMSQLite3", condition: .when(platforms: [.macOS, .iOS, .tvOS, .watchOS, .visionOS, .macCatalyst, .linux])),
202-
.product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows])),
205+
.product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows, .android])),
203206
.product(name: "DequeModule", package: "swift-collections"),
204207
.product(name: "OrderedCollections", package: "swift-collections"),
205208
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),

Sources/Basics/SQLite.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if SWIFT_PACKAGE && os(Windows)
15+
#if SWIFT_PACKAGE && (os(Windows) || os(Android))
1616
#if USE_IMPL_ONLY_IMPORTS
1717
@_implementationOnly import SwiftToolchainCSQLite
1818
#else

0 commit comments

Comments
 (0)