Skip to content

Fix swift package build #1061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 38 additions & 40 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,50 @@ import PackageDescription
let package = Package(
name: "SQLite.swift",
products: [
.library(
name: "SQLite",
targets: ["SQLite"]
)
],
.library(
name: "SQLite",
targets: ["SQLite"]
)
],
targets: [
.target(
name: "SQLite",
dependencies: ["SQLiteObjc"],
exclude: [
"Info.plist"
]
),
name: "SQLite",
dependencies: ["SQLiteObjc"],
exclude: [
"Info.plist"
]
),
.target(
name: "SQLiteObjc",
dependencies: [],
exclude: [
"SQLiteObjc.h",
"fts3_tokenizer.h",
"include/README.md"
]
),
name: "SQLiteObjc",
dependencies: [],
exclude: [
"fts3_tokenizer.h"
]
),
.testTarget(
name: "SQLiteTests",
dependencies: [
"SQLite"
],
path: "Tests/SQLiteTests",
exclude: [
"Info.plist"
],
resources: [
.copy("fixtures/encrypted-3.x.sqlite"),
.copy("fixtures/encrypted-4.x.sqlite")
]
)
name: "SQLiteTests",
dependencies: [
"SQLite"
],
path: "Tests/SQLiteTests",
exclude: [
"Info.plist"
],
resources: [
.copy("fixtures/encrypted-3.x.sqlite"),
.copy("fixtures/encrypted-4.x.sqlite")
]
)
]
)

#if os(Linux)
package.dependencies = [.package(url: "https://github.com/stephencelis/CSQLite.git", from: "0.0.3")]
package.targets = [
.target(name: "SQLite", exclude: ["Extensions/FTS4.swift", "Extensions/FTS5.swift"]),
.testTarget(name: "SQLiteTests", dependencies: ["SQLite"], path: "Tests/SQLiteTests", exclude: [
"FTS4Tests.swift",
"FTS5Tests.swift"
])
]
package.dependencies = [.package(url: "https://github.com/stephencelis/CSQLite.git", from: "0.0.3")]
package.targets = [
.target(name: "SQLite", exclude: ["Extensions/FTS4.swift", "Extensions/FTS5.swift"]),
.testTarget(name: "SQLiteTests", dependencies: ["SQLite"], path: "Tests/SQLiteTests", exclude: [
"FTS4Tests.swift",
"FTS5Tests.swift"
])
]
#endif
20 changes: 10 additions & 10 deletions SQLite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
03A65E721C6BB2D30062603F /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };
03A65E731C6BB2D80062603F /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };
03A65E741C6BB2DA0062603F /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };
03A65E751C6BB2DF0062603F /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = EE91808D1C46E5230038162A /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
03A65E761C6BB2E60062603F /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };
03A65E771C6BB2E60062603F /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEF1C3F06E900AE3E12 /* Connection.swift */; };
03A65E781C6BB2EA0062603F /* fts3_tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AF01C3F06E900AE3E12 /* fts3_tokenizer.h */; };
Expand Down Expand Up @@ -101,9 +100,12 @@
3D67B3F71DB246D700A4F4C6 /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };
3D67B3F81DB246D700A4F4C6 /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };
3D67B3F91DB246E700A4F4C6 /* SQLiteObjc.m in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF11C3F06E900AE3E12 /* SQLiteObjc.m */; };
3D67B3FB1DB2470600A4F4C6 /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = EE91808D1C46E5230038162A /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
3D67B3FC1DB2471B00A4F4C6 /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };
3D67B3FD1DB2472D00A4F4C6 /* fts3_tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AF01C3F06E900AE3E12 /* fts3_tokenizer.h */; };
3DDC112F26CDBA0200CE369F /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DDC112E26CDBA0200CE369F /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
3DDC113626CDBE1900CE369F /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DDC112E26CDBA0200CE369F /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
3DDC113726CDBE1900CE369F /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DDC112E26CDBA0200CE369F /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
3DDC113826CDBE1C00CE369F /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DDC112E26CDBA0200CE369F /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
49EB68C41F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };
49EB68C51F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };
49EB68C61F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };
Expand Down Expand Up @@ -183,8 +185,6 @@
EE247B731C3F3FEC00AE3E12 /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B001C3F06E900AE3E12 /* Query.swift */; };
EE247B741C3F3FEC00AE3E12 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B011C3F06E900AE3E12 /* Schema.swift */; };
EE247B751C3F3FEC00AE3E12 /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B021C3F06E900AE3E12 /* Setter.swift */; };
EE91808E1C46E5230038162A /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = EE91808D1C46E5230038162A /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
EE91808F1C46E76D0038162A /* SQLiteObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = EE91808D1C46E5230038162A /* SQLiteObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
EE9180941C46EA210038162A /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE9180931C46EA210038162A /* libsqlite3.tbd */; };
EE9180951C46EBCC0038162A /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE9180911C46E9D30038162A /* libsqlite3.tbd */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -229,6 +229,7 @@
19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateAndTimeFunctions.swift; sourceTree = "<group>"; };
19A17E2695737FAB5D6086E3 /* fixtures */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = folder; path = fixtures; sourceTree = "<group>"; };
3D67B3E51DB2469200A4F4C6 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; };
3DDC112E26CDBA0200CE369F /* SQLiteObjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SQLiteObjc.h; path = ../SQLiteObjc/include/SQLiteObjc.h; sourceTree = "<group>"; };
49EB68C31F7B3CB400D89D40 /* Coding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coding.swift; sourceTree = "<group>"; };
A121AC451CA35C79005A31D1 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D4DB368A20C09C9B00D5A58E /* SelectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -280,7 +281,6 @@
EE247B911C3F822500AE3E12 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
EE247B921C3F822600AE3E12 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
EE247B931C3F826100AE3E12 /* SQLite.swift.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = SQLite.swift.podspec; sourceTree = "<group>"; };
EE91808D1C46E5230038162A /* SQLiteObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteObjc.h; path = ../../SQLiteObjc/SQLiteObjc.h; sourceTree = "<group>"; };
EE9180911C46E9D30038162A /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; };
EE9180931C46EA210038162A /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -384,6 +384,7 @@
isa = PBXGroup;
children = (
EE247AD61C3F04ED00AE3E12 /* SQLite.h */,
3DDC112E26CDBA0200CE369F /* SQLiteObjc.h */,
EE247AF71C3F06E900AE3E12 /* Foundation.swift */,
EE247AF81C3F06E900AE3E12 /* Helpers.swift */,
EE247AD81C3F04ED00AE3E12 /* Info.plist */,
Expand Down Expand Up @@ -430,7 +431,6 @@
EE247AED1C3F06E900AE3E12 /* Core */ = {
isa = PBXGroup;
children = (
EE91808D1C46E5230038162A /* SQLiteObjc.h */,
EE247AEE1C3F06E900AE3E12 /* Blob.swift */,
EE247AEF1C3F06E900AE3E12 /* Connection.swift */,
EE247AF01C3F06E900AE3E12 /* fts3_tokenizer.h */,
Expand Down Expand Up @@ -512,7 +512,7 @@
buildActionMask = 2147483647;
files = (
03A65E781C6BB2EA0062603F /* fts3_tokenizer.h in Headers */,
03A65E751C6BB2DF0062603F /* SQLiteObjc.h in Headers */,
3DDC113626CDBE1900CE369F /* SQLiteObjc.h in Headers */,
03A65E721C6BB2D30062603F /* SQLite.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -521,8 +521,8 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
3D67B3FB1DB2470600A4F4C6 /* SQLiteObjc.h in Headers */,
3D67B3FC1DB2471B00A4F4C6 /* SQLite.h in Headers */,
3DDC113726CDBE1900CE369F /* SQLiteObjc.h in Headers */,
3D67B3FD1DB2472D00A4F4C6 /* fts3_tokenizer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -531,8 +531,8 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
EE91808E1C46E5230038162A /* SQLiteObjc.h in Headers */,
EE247B051C3F06E900AE3E12 /* fts3_tokenizer.h in Headers */,
3DDC113826CDBE1C00CE369F /* SQLiteObjc.h in Headers */,
EE247AD71C3F04ED00AE3E12 /* SQLite.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -542,8 +542,8 @@
buildActionMask = 2147483647;
files = (
EE247B671C3F3FEC00AE3E12 /* fts3_tokenizer.h in Headers */,
3DDC112F26CDBA0200CE369F /* SQLiteObjc.h in Headers */,
EE247B621C3F3FDB00AE3E12 /* SQLite.h in Headers */,
EE91808F1C46E76D0038162A /* SQLiteObjc.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
20 changes: 10 additions & 10 deletions Tests/SQLiteTests/QueryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ class QueryIntegrationTests : SQLiteTestCase {
let id = Expression<Int64>("id")
let email = Expression<String>("email")
let age = Expression<Int>("age")

override func setUp() {
super.setUp()

Expand Down Expand Up @@ -509,16 +509,16 @@ class QueryIntegrationTests : SQLiteTestCase {
let fetchAge = { () throws -> Int? in
return try self.db.pluck(self.users.filter(self.email == "[email protected]")).flatMap { $0[self.age] }
}

let id = try db.run(users.upsert(email <- "[email protected]", age <- 30, onConflictOf: email))
XCTAssertEqual(1, id)
XCTAssertEqual(30, try fetchAge())

let nextId = try db.run(users.upsert(email <- "[email protected]", age <- 42, onConflictOf: email))
XCTAssertEqual(1, nextId)
XCTAssertEqual(42, try fetchAge())
}

func test_update() {
let changes = try! db.run(users.update(email <- "[email protected]"))
XCTAssertEqual(0, changes)
Expand All @@ -528,24 +528,24 @@ class QueryIntegrationTests : SQLiteTestCase {
let changes = try! db.run(users.delete())
XCTAssertEqual(0, changes)
}

func test_union() throws {
let expectedIDs = [
try db.run(users.insert(email <- "[email protected]")),
try db.run(users.insert(email <- "[email protected]"))
]

let query1 = users.filter(email == "[email protected]")
let query2 = users.filter(email == "[email protected]")

let actualIDs = try db.prepare(query1.union(query2)).map { $0[id] }
XCTAssertEqual(expectedIDs, actualIDs)

let query3 = users.select(users[*], Expression<Int>(literal: "1 AS weight")).filter(email == "[email protected]")
let query4 = users.select(users[*], Expression<Int>(literal: "2 AS weight")).filter(email == "[email protected]")

print(query3.union(query4).order(Expression<Int>(literal: "weight")).asSQL())

let orderedIDs = try db.prepare(query3.union(query4).order(Expression<Int>(literal: "weight"), email)).map { $0[id] }
XCTAssertEqual(Array(expectedIDs.reversed()), orderedIDs)
}
Expand Down