forked from groue/GRDB.swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackage.swift
More file actions
113 lines (107 loc) · 4.04 KB
/
Package.swift
File metadata and controls
113 lines (107 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// swift-tools-version:6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import Foundation
import PackageDescription
let darwinPlatforms: [Platform] = [
.iOS,
.macOS,
.macCatalyst,
.tvOS,
.visionOS,
.watchOS,
]
var swiftSettings: [SwiftSetting] = [
.define("SQLITE_ENABLE_FTS5"),
.define("SQLITE_ENABLE_SNAPSHOT"),
// Not all Linux distributions have support for WAL snapshots.
.define("SQLITE_DISABLE_SNAPSHOT", .when(platforms: [.linux])),
]
var cSettings: [CSetting] = []
var dependencies: [PackageDescription.Package.Dependency] = []
// Don't rely on those environment variables. They are ONLY testing conveniences:
// $ SQLITE_ENABLE_PREUPDATE_HOOK=1 make test_SPM
if ProcessInfo.processInfo.environment["SQLITE_ENABLE_PREUPDATE_HOOK"] == "1" {
swiftSettings.append(.define("SQLITE_ENABLE_PREUPDATE_HOOK"))
cSettings.append(.define("GRDB_SQLITE_ENABLE_PREUPDATE_HOOK"))
}
// The SPI_BUILDER environment variable enables documentation building
// on <https://swiftpackageindex.com/groue/GRDB.swift>. See
// <https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/2122>
// for more information.
//
// SPI_BUILDER also enables the `make docs-localhost` command.
if ProcessInfo.processInfo.environment["SPI_BUILDER"] == "1" {
dependencies.append(.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"))
}
// GRDB+SQLCipher: Uncomment those lines
dependencies.append(.package(url: "https://github.com/sqlcipher/SQLCipher.swift.git", from: "4.11.0"))
cSettings.append(.define("SQLITE_HAS_CODEC"))
swiftSettings.append(.define("SQLITE_HAS_CODEC"))
swiftSettings.append(.define("SQLCipher"))
let package = Package(
name: "GRDB",
defaultLocalization: "en", // for tests
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v7),
],
products: [
// GRDB+SQLCipher: Delete the GRDBSQLite library
.library(name: "GRDB", targets: ["GRDB"]),
.library(name: "GRDB-dynamic", type: .dynamic, targets: ["GRDB"]),
],
dependencies: dependencies,
targets: [
// GRDB+SQLCipher: Delete the GRDBSQLite target
// GRDB+SQLCipher: Uncomment the GRDBSQLCipher target
.target(
name: "GRDBSQLCipher",
dependencies: [.product(name: "SQLCipher", package: "SQLCipher.swift")]
),
.target(
name: "GRDB",
dependencies: [
// GRDB+SQLCipher: Delete the GRDBSQLite dependency
// GRDB+SQLCipher: Uncomment the SQLCipher and GRDBSQLCipher dependencies
.product(name: "SQLCipher", package: "SQLCipher.swift"),
.target(name: "GRDBSQLCipher"),
],
path: "GRDB",
resources: [.copy("PrivacyInfo.xcprivacy")],
cSettings: cSettings,
swiftSettings: swiftSettings),
.testTarget(
name: "GRDBTests",
dependencies: ["GRDB"],
path: "Tests",
exclude: [
"CocoaPods",
"Crash",
"CustomSQLite",
"GRDBManualInstall",
"GRDBTests/getThreadsCount.c",
"Info.plist",
"Performance",
"SPM",
"Swift6Migration",
"generatePerformanceReport.rb",
"parsePerformanceTests.rb",
],
resources: [
.copy("GRDBTests/Betty.jpeg"),
.copy("GRDBTests/InflectionsTests.json"),
.copy("GRDBTests/Issue1383.sqlite"),
.copy("GRDBTests/db.SQLCipher3"),
],
cSettings: cSettings,
swiftSettings: swiftSettings + [
// Tests still use the Swift 5 language mode.
.swiftLanguageMode(.v5),
.enableUpcomingFeature("InferSendableFromCaptures"),
.enableUpcomingFeature("GlobalActorIsolatedTypesUsability"),
])
],
swiftLanguageModes: [.v6]
)