Skip to content
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

SPM support #202

Merged
merged 3 commits into from
Apr 11, 2017
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ SQLiteCustom/GRDBCustomSQLite-USER.xcconfig
# CocoaPods test
Tests/CocoaPods/GRDBiOS/Podfile.lock
Tests/CocoaPods/GRDBiOS/Pods

# SPM build directory
.build

4 changes: 4 additions & 0 deletions GRDB/Core/Configuration.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

/// Configuration for a DatabaseQueue or DatabasePool.
public struct Configuration {

Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/Database.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

/// A raw SQLite connection, suitable for the SQLite C API.
public typealias SQLiteConnection = OpaquePointer

Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/DatabaseError.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

public struct ResultCode : RawRepresentable, Equatable, CustomStringConvertible {
public let rawValue: Int32

Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/DatabasePool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import Foundation
import UIKit
#endif

#if SWIFT_PACKAGE
import CSQLite
#endif

/// A DatabasePool grants concurrent accesses to an SQLite database.
public final class DatabasePool {

Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/DatabaseReader.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if SWIFT_PACKAGE
import CSQLite
#endif

/// The protocol for all types that can fetch values from a database.
///
/// It is adopted by DatabaseQueue and DatabasePool.
Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/DatabaseValue.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

// MARK: - DatabaseValue

/// DatabaseValue is the intermediate type between SQLite and your values.
Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/Row.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

/// A database row.
public final class Row {

Expand Down
2 changes: 2 additions & 0 deletions GRDB/Core/RowAdapter.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// LayoutedColumnMapping is a type that supports the RowAdapter protocol.
public struct LayoutedColumnMapping {
/// An array of (baseIndex, mappedName) pairs, where baseIndex is the index
Expand Down
6 changes: 6 additions & 0 deletions GRDB/Core/SchedulingWatchdog.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import Dispatch

#if SWIFT_PACKAGE
import CSQLite
#endif

/// SchedulingWatchdog makes sure that databases connections are used on correct
/// dispatch queues, and warns the user with a fatal error whenever she misuses
/// a database connection.
Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/Statement.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

/// A raw SQLite statement, suitable for the SQLite C API.
public typealias SQLiteStatement = OpaquePointer

Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/StatementColumnConvertible.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if SWIFT_PACKAGE
import CSQLite
#endif

/// When a type adopts both DatabaseValueConvertible and
/// StatementColumnConvertible, it is granted with faster access to the SQLite
/// database values.
Expand Down
2 changes: 2 additions & 0 deletions GRDB/Core/Support/Foundation/ReferenceConvertible.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// DatabaseValueConvertible is free for ReferenceConvertible types whose
/// ReferenceType is itself DatabaseValueConvertible.
///
Expand Down
4 changes: 4 additions & 0 deletions GRDB/Core/Support/StandardLibrary/StandardLibrary.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if SWIFT_PACKAGE
import CSQLite
#endif

// MARK: - Value Types

/// Bool adopts DatabaseValueConvertible and StatementColumnConvertible.
Expand Down
3 changes: 3 additions & 0 deletions GRDB/Core/Utils.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Foundation

#if SWIFT_PACKAGE
import CSQLite
#endif

// MARK: - Public

Expand Down
1 change: 1 addition & 0 deletions GRDB/Record/FetchedRecordsController.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Foundation
#if os(iOS)
import UIKit
#endif
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 7,OS=10.3"
# We test framework test suites, and if GRBD can be installed in an application:
test: test_framework test_install

test_framework: test_framework_GRDB test_framework_GRDBCustom test_framework_GRDBCipher
test_framework: test_framework_GRDB test_framework_GRDBCustom test_framework_GRDBCipher test_framework_SPM
test_framework_GRDB: test_framework_GRDBOSX test_framework_GRDBWatchOS test_framework_GRDBiOS
test_framework_GRDBCustom: test_framework_GRDBCustomSQLiteOSX test_framework_GRDBCustomSQLiteiOS
test_framework_GRDBCipher: test_framework_GRDBCipherOSX test_framework_GRDBCipheriOS
Expand Down Expand Up @@ -117,6 +117,10 @@ test_framework_GRDBCipheriOS_minTarget: SQLCipher
-destination $(MIN_IOS_DESTINATION) \
$(TEST_ACTIONS)

test_framework_SPM:
swift package clean
swift build

test_install_manual:
xcodebuild \
-project DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj \
Expand Down
9 changes: 9 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import PackageDescription

let package = Package(
name: "GRDB",
dependencies: [
.Package(url: "https://github.com/groue/CSQLite.git", majorVersion: 0)
],
exclude: ["GRDB.xcworkspace", "Playgrounds", "SQLCipher", "SQLiteCustom", "Support", "DemoApps", "Tests", "Documentation"]
)