Skip to content

Commit

Permalink
Merge pull request #1641 from groue/dev/GRDB7-Swift-6-language-mode
Browse files Browse the repository at this point in the history
GRDB7: Enable the Swift 6 language mode
  • Loading branch information
groue authored Sep 29, 2024
2 parents 625c529 + 9302925 commit 4132d02
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 15 deletions.
6 changes: 4 additions & 2 deletions GRDB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@
5698AD151DAAD16F0056AF8C /* FTS5Tokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5Tokenizer.swift; sourceTree = "<group>"; };
5698AD201DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizer.swift; sourceTree = "<group>"; };
5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5CustomTokenizer.swift; sourceTree = "<group>"; };
5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBTests.xcconfig; sourceTree = "<group>"; };
569BBA20228DE51800478429 /* AssociationPrefetchingFetchableRecordTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationPrefetchingFetchableRecordTests.swift; sourceTree = "<group>"; };
569BBA3522905FFA00478429 /* InflectionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InflectionsTests.swift; sourceTree = "<group>"; };
569BBA4522906A8200478429 /* InflectionsTests.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = InflectionsTests.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1769,6 +1770,7 @@
56C48E731C9A9923005DF1D9 /* module.modulemap */,
DC3773F719C8CBB3004FCF85 /* Info.plist */,
56B8F49A1B4E2F3600C24296 /* GRDB.xcconfig */,
5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */,
56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */,
);
name = "Supporting Files";
Expand Down Expand Up @@ -2344,7 +2346,7 @@
/* Begin XCBuildConfiguration section */
56E5D8021B4D422E00430942 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
baseConfigurationReference = 5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
Expand Down Expand Up @@ -2374,7 +2376,7 @@
};
56E5D8031B4D422E00430942 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
baseConfigurationReference = 5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
Expand Down
1 change: 0 additions & 1 deletion GRDB/Fixits.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Fixits for changes introduced by GRDB 7.0.0
// swiftlint:disable all

extension Configuration {
@available(*, unavailable, message: "The default transaction kind is now automatically managed.")
Expand Down
4 changes: 3 additions & 1 deletion GRDB/Record/Record.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
///
/// ## Overview
///
/// - warning: `Record` is a legacy GRDB type. Since GRDB 7, it is not recommended to define record types by subclassing the `Record` class. See <doc:SwiftConcurrency> for more information.
/// - warning: `Record` is a legacy GRDB type. Since GRDB 7, it is not
/// recommended to define record types by subclassing the `Record` class.
/// See <doc:SwiftConcurrency> for more information.
///
/// ## Topics
///
Expand Down
14 changes: 7 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ import PackageDescription

var swiftSettings: [SwiftSetting] = [
.define("SQLITE_ENABLE_FTS5"),
.enableUpcomingFeature("InferSendableFromCaptures"),
.enableUpcomingFeature("GlobalActorIsolatedTypesUsability"),
]
var cSettings: [CSetting] = []
var dependencies: [PackageDescription.Package.Dependency] = []

// For Swift 5.8+
//swiftSettings.append(.enableUpcomingFeature("ExistentialAny"))

// 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" {
Expand Down Expand Up @@ -81,7 +76,12 @@ let package = Package(
.copy("GRDBTests/Issue1383.sqlite"),
],
cSettings: cSettings,
swiftSettings: swiftSettings)
swiftSettings: swiftSettings + [
// Tests still use the Swift 5 language mode.
.swiftLanguageMode(.v5),
.enableUpcomingFeature("InferSendableFromCaptures"),
.enableUpcomingFeature("GlobalActorIsolatedTypesUsability"),
])
],
swiftLanguageModes: [.v5]
swiftLanguageModes: [.v6]
)
1 change: 1 addition & 0 deletions SQLiteCustom/GRDB.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ OTHER_CFLAGS = -DUSING_BUILTIN_SQLITE -DGRDBCUSTOMSQLITE $(CUSTOM_SQLLIBRARY_CFL
GCC_PREPROCESSOR_DEFINITIONS = "GRDBCUSTOMSQLITE=1"
OTHER_SWIFT_FLAGS = -D USING_BUILTIN_SQLITE -D GRDBCUSTOMSQLITE $(CUSTOM_OTHER_SWIFT_FLAGS)
HEADER_SEARCH_PATHS = $(SRCROOT)/SQLiteCustom/src
SWIFT_VERSION = 6.0
4 changes: 4 additions & 0 deletions SQLiteCustom/GRDBCustomSQLite-Testing.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ CUSTOM_OTHER_SWIFT_FLAGS= // do not modify

OTHER_CFLAGS = -DUSING_BUILTIN_SQLITE -DGRDBCUSTOMSQLITE $(CUSTOM_SQLLIBRARY_CFLAGS) // Do not modify.
OTHER_SWIFT_FLAGS = -D USING_BUILTIN_SQLITE -D GRDBCUSTOMSQLITE $(CUSTOM_OTHER_SWIFT_FLAGS) // Do not modify.

// Tests still use the Swift 5 language mode.
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability
2 changes: 0 additions & 2 deletions SQLiteCustom/GRDBDeploymentTarget.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0
MACOSX_DEPLOYMENT_TARGET = 10.15
TVOS_DEPLOYMENT_TARGET = 13.0
WATCHOS_DEPLOYMENT_TARGET = 7.0
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability
1 change: 1 addition & 0 deletions Support/GRDB.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ INFOPLIST_FILE = Support/Info.plist
PRODUCT_NAME = GRDB
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.$(PRODUCT_NAME:rfc1034identifier)
MODULEMAP_FILE = $(SRCROOT)/Support/module.modulemap
SWIFT_VERSION = 6.0

// Slow compilation hunt:
// OTHER_SWIFT_FLAGS = $(inherited) -Xfrontend -warn-long-expression-type-checking=100 -Xfrontend -warn-long-function-bodies=100
Expand Down
2 changes: 0 additions & 2 deletions Support/GRDBDeploymentTarget.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.15
TVOS_DEPLOYMENT_TARGET = 13.0
WATCHOS_DEPLOYMENT_TARGET = 7.0
OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability

//// Compile with all opt-in APIs
//GCC_PREPROCESSOR_DEFINITIONS = $(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1
Expand Down
5 changes: 5 additions & 0 deletions Support/GRDBTests.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "GRDBDeploymentTarget.xcconfig"

// Tests still use the Swift 5 language mode.
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability

0 comments on commit 4132d02

Please sign in to comment.