Skip to content

Commit 0eeedfe

Browse files
committed
Split into standard / standalone subspecs
The standard subspec is the default and behaves as previously; the standalone subspec adds a dependency to the sqlite3 pod which downloads and compiles a version of SQLite instead of using the system-supplied version. The version of SQLite used can be further customized by requiring another sqlite3 subspec from the main Podfile.
1 parent d93f37b commit 0eeedfe

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

SQLite.swift.podspec

+25-14
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,30 @@ Pod::Spec.new do |s|
2424
s.tvos.deployment_target = "9.0"
2525
s.osx.deployment_target = "10.9"
2626
s.watchos.deployment_target = "2.0"
27+
s.default_subspec = 'standard'
2728

28-
s.preserve_paths = 'CocoaPods/**/*'
29-
s.pod_target_xcconfig = {
30-
'SWIFT_INCLUDE_PATHS[sdk=macosx*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/macosx',
31-
'SWIFT_INCLUDE_PATHS[sdk=iphoneos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphoneos',
32-
'SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphonesimulator',
33-
'SWIFT_INCLUDE_PATHS[sdk=appletvos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvos',
34-
'SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvsimulator',
35-
'SWIFT_INCLUDE_PATHS[sdk=watchos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchos',
36-
'SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchsimulator'
37-
}
38-
39-
s.libraries = 'sqlite3'
40-
s.source_files = 'SQLite/**/*.{c,h,m,swift}'
41-
s.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
29+
s.subspec 'standard' do |ss|
30+
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
31+
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
32+
33+
ss.library = 'sqlite3'
34+
ss.preserve_paths = 'CocoaPods/**/*'
35+
ss.pod_target_xcconfig = {
36+
'SWIFT_INCLUDE_PATHS[sdk=macosx*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/macosx',
37+
'SWIFT_INCLUDE_PATHS[sdk=iphoneos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphoneos',
38+
'SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphonesimulator',
39+
'SWIFT_INCLUDE_PATHS[sdk=appletvos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvos',
40+
'SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvsimulator',
41+
'SWIFT_INCLUDE_PATHS[sdk=watchos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchos',
42+
'SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchsimulator'
43+
}
44+
end
45+
46+
s.subspec 'standalone' do |ss|
47+
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
48+
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
49+
ss.xcconfig = { 'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE' }
50+
51+
ss.dependency 'sqlite3'
52+
end
4253
end

SQLite/Core/Connection.swift

+4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
//
2424

2525
import Dispatch
26+
#if SQLITE_SWIFT_STANDALONE
27+
import sqlite3
28+
#else
2629
import CSQLite
30+
#endif
2731

2832
/// A connection to SQLite.
2933
public final class Connection {

SQLite/Core/Statement.swift

+4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
// THE SOFTWARE.
2323
//
2424

25+
#if SQLITE_SWIFT_STANDALONE
26+
import sqlite3
27+
#else
2528
import CSQLite
29+
#endif
2630

2731
/// A single SQL statement.
2832
public final class Statement {

SQLite/Helpers.swift

+4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
// THE SOFTWARE.
2323
//
2424

25+
#if SQLITE_SWIFT_STANDALONE
26+
import sqlite3
27+
#else
2528
import CSQLite
29+
#endif
2630

2731
public typealias Star = (Expression<Binding>?, Expression<Binding>?) -> Expression<Void>
2832

0 commit comments

Comments
 (0)