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

Support for Xcode 10 and Swift 4.2 #396

Merged
merged 14 commits into from
Aug 31, 2018
Merged
144 changes: 92 additions & 52 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The OS X Build Environment
# https://docs.travis-ci.com/user/reference/osx/#Xcode-version
# https://docs.travis-ci.com/user/reference/osx/#xcode-version

language: objective-c
xcode_project: GRDB.xcodeproj
Expand All @@ -15,29 +15,45 @@ jobs:
###########################################
## Test GRDB

# Test GRDBOSX (Xcode 9.4)
# Test GRDBOSX (Xcode 10)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBOSX (Xcode 9.4, macOS)
script: make test_framework_GRDBOSX
- TID=GRDBOSX (Xcode 10, Swift 4.2, macOS)
script: make test_framework_GRDBOSX_maxSwift

# Test GRDBWatchOS (Xcode 9.4)
# Test GRDBOSX (Xcode 10)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBWatchOS (Xcode 9.4, watchOS)
- TID=GRDBOSX (Xcode 10, Swift 4.0, macOS)
script: make test_framework_GRDBOSX_minSwift

# Test GRDBWatchOS (Xcode 10)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBWatchOS (Xcode 10, watchOS)
script: make test_framework_GRDBWatchOS

# Test GRDBiOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBiOS (Xcode 10, Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift

# Test GRDBiOS (Xcode 9.4, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
env:
- TID=GRDBiOS (Xcode 9.4, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget
script: make test_framework_GRDBiOS_maxTarget_maxSwift

# Test GRDBiOS (Xcode 9.3, iOS <MINIMUM VERSION>))
- stage: Test GRDB
Expand All @@ -47,25 +63,41 @@ jobs:
- TID=GRDBiOS (Xcode 9.3, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget

# Test GRDB [SPM] (Xcode 9.4, macOS)
# Test GRDB [SPM] (Xcode 10, macOS)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDB [SPM] (Xcode 9.4, macOS)
- TID=GRDB [SPM] (Xcode 10, macOS)
script: make test_SPM

###########################################
## Test GRDB (Custom SQLite)

# Test GRDBCustomSQLiteOSX (Xcode 9.4)
# Test GRDBCustomSQLiteOSX (Xcode 10)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBCustomSQLiteOSX (Xcode 9.4, macOS)
- TID=GRDBCustomSQLiteOSX (Xcode 10, macOS)
script: make test_framework_GRDBCustomSQLiteOSX

# Test GRDBCustomSQLiteiOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBCustomSQLiteiOS (Xcode 10, Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift

# Test GRDBCustomSQLiteiOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBCustomSQLiteiOS (Xcode 10, Swift 4.0, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift

# Test GRDBCustomSQLiteiOS (Xcode 9.4, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
Expand All @@ -85,14 +117,22 @@ jobs:
###########################################
## Test GRDB (SQLCipher)

# Test GRDBCipherOSX (Xcode 9.4)
# Test GRDBCipherOSX (Xcode 10)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBCipherOSX (Xcode 9.4, macOS)
- TID=GRDBCipherOSX (Xcode 10, macOS)
script: make test_framework_GRDBCipherOSX

# Test GRDBCipheriOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBCipheriOS (Xcode 10, iOS <MAX>)
script: make test_framework_GRDBCipheriOS_maxTarget

# Test GRDBCipheriOS (Xcode 9.4, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
Expand All @@ -112,88 +152,88 @@ jobs:
###########################################
## Test Installation Methods

# Manual Install (Xcode 9.4)
# Manual Install (Xcode 10)
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=Manual Install (Xcode 9.4)
- TID=Manual Install (Xcode 10)
script: make test_install_manual

# Manual Install (GRDBCipher, Xcode 9.4)
# Manual Install (GRDBCipher, Xcode 10)
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=Manual Install (GRDBCipher, Xcode 9.4)
- TID=Manual Install (GRDBCipher, Xcode 10)
script: make test_install_GRDBCipher

# CocoaPods Lint (Xcode 9.4)
# CocoaPods Lint (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods Lint GRDB.swift (Xcode 9.4)
- TID=CocoaPods Lint GRDB.swift (Xcode 10)
script: make test_CocoaPodsLint_GRDB

# CocoaPods Lint (Xcode 9.4)
# CocoaPods Lint (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods Lint GRDBPlus (Xcode 9.4)
- TID=CocoaPods Lint GRDBPlus (Xcode 10)
script: make test_CocoaPodsLint_GRDBPlus

# CocoaPods Lint (Xcode 9.4)
# CocoaPods Lint (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods Lint GRDBCipher (Xcode 9.4)
- TID=CocoaPods Lint GRDBCipher (Xcode 10)
script: make test_CocoaPodsLint_GRDBCipher

# CocoaPods Install (Xcode 9.4)
# CocoaPods Install (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods GRDB (Xcode 9.4)
- TID=CocoaPods GRDB (Xcode 10)
script: make test_install_GRDB_CocoaPods

# CocoaPods Install (Xcode 9.4)
# CocoaPods Install (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods GRDB+FTS5 (Xcode 9.4)
- TID=CocoaPods GRDB+FTS5 (Xcode 10)
script: make test_install_GRDBFTS5_CocoaPods

# CocoaPods Install (Xcode 9.4)
# CocoaPods Install (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods GRDBCipher (Xcode 9.4)
- TID=CocoaPods GRDBCipher (Xcode 10)
script: make test_install_GRDBCipher_CocoaPods

# SPM Install (Xcode 9.4)
# SPM Install (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=SPM (Xcode 9.4)
- TID=SPM (Xcode 10)
script: make test_install_SPM

## Carthage Build
## Commented out until `make test_CarthageBuild` performs *reliably*.
## See https://github.com/groue/GRDB.swift/pull/262
# - stage: Test Installation
# osx_image: xcode9.4
# osx_image: xcode10
# before_install:
# - brew update
# - brew outdated carthage || brew upgrade carthage
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This release focuses on enhancing the relationships between [Codable records](RE

Other notable enhancements are:

- Support for Swift 4.2 and Xcode 10
- Support for the FTS5 full-text engine when available in the operating system (iOS 11.4+ / macOS 10.13+ / watchOS 4.3+)


Expand Down
12 changes: 6 additions & 6 deletions GRDB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3096,7 +3096,7 @@
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_SWIFT_FLAGS = "-D GRDB_COMPARE";
OTHER_SWIFT_FLAGS = "$(inherited) -D GRDB_COMPARE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand All @@ -3119,7 +3119,7 @@
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_SWIFT_FLAGS = "-D GRDB_COMPARE";
OTHER_SWIFT_FLAGS = "$(inherited) -D GRDB_COMPARE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand Down Expand Up @@ -3275,7 +3275,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand All @@ -3293,7 +3293,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand All @@ -3311,7 +3311,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand All @@ -3329,7 +3329,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand Down
9 changes: 5 additions & 4 deletions GRDB/Core/Database+Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,10 @@ struct SchemaInfo: Equatable {
var name: String
var tbl_name: String?

// TODO: remove when Hashable conformance is synthesized
var hashValue: Int {
return type.hashValue ^ name.hashValue ^ (tbl_name?.hashValue ?? 0)
}
#if !swift(>=4.2)
var hashValue: Int {
return type.hashValue ^ name.hashValue ^ (tbl_name?.hashValue ?? 0)
}
#endif
}
}
21 changes: 14 additions & 7 deletions GRDB/Core/DatabaseCollation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,24 @@ public final class DatabaseCollation {
}
}

extension DatabaseCollation : Hashable {
extension DatabaseCollation: Hashable {
// Collation equality is based on the sqlite3_strnicmp SQLite function.
// (see https://www.sqlite.org/c3ref/create_collation.html). Computing
// a hash value that honors the Swift Hashable contract (value equality
// implies hash equality) is thus non trivial. But it's not that
// important, since this hashValue is only used when one adds
// or removes a collation from a database connection.
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
hasher.combine(0)
}
#else
/// :nodoc:
public var hashValue: Int {
// Collation equality is based on the sqlite3_strnicmp SQLite function.
// (see https://www.sqlite.org/c3ref/create_collation.html). Computing
// a hash value that honors the Swift Hashable contract (value equality
// implies hash equality) is thus non trivial. But it's not that
// important, since this hashValue is only used when one adds
// or removes a collation from a database connection.
return 0
}
#endif

/// Two collations are equal if they share the same name (case insensitive)
/// :nodoc:
Expand Down
8 changes: 7 additions & 1 deletion GRDB/Core/DatabaseFunction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,17 @@ public final class DatabaseFunction: Hashable {
}

extension DatabaseFunction {
/// The hash value
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
hasher.combine(identity)
}
#else
/// :nodoc:
public var hashValue: Int {
return identity.hashValue
}
#endif

/// Two functions are equal if they share the same name and arity.
/// :nodoc:
Expand Down
Loading