Skip to content

Commit c354a7f

Browse files
committed
Update docs, add tests, fix podspec
Fix paths Fix up podspec Run tests with package manager missing space Update changelog Fix variable expansion Fix quoting More quoting Don’t use env variable Rename Update doc Try build only Link ref Add to index Sans quotes Doc Simplify podspec Update docs Update planning doc Missing closing quote yml doc Capitalization Remove ALL_IN_ONE_BUILD Use system sqlite3 Fix import Fix bridging header Fixing paths
1 parent 28dfcc7 commit c354a7f

File tree

18 files changed

+62
-68
lines changed

18 files changed

+62
-68
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ matrix:
1212
- env: VALIDATOR_SUBSPEC="standard"
1313
- env: VALIDATOR_SUBSPEC="standalone"
1414
- env: VALIDATOR_SUBSPEC="SQLCipher"
15+
- env: PACKAGE_MANAGER_COMMAND="test -Xlinker -lsqlite3"
1516
before_install:
1617
- gem update bundler
1718
- gem install xcpretty --no-document

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
========================================
33

44
* Fixed SQLCipher integration with read-only databases ([#559][])
5+
* Preliminary Swift Package Manager support ([#548][], [#560][])
56
* Fixed null pointer when fetching an empty BLOB ([#561][])
67

78
0.11.1 (06-12-2016), [diff][diff-0.11.1]
@@ -24,6 +25,8 @@
2425

2526
[#532]: https://github.com/stephencelis/SQLite.swift/issues/532
2627
[#546]: https://github.com/stephencelis/SQLite.swift/issues/546
28+
[#548]: https://github.com/stephencelis/SQLite.swift/pull/548
2729
[#553]: https://github.com/stephencelis/SQLite.swift/pull/553
2830
[#559]: https://github.com/stephencelis/SQLite.swift/pull/559
31+
[#560]: https://github.com/stephencelis/SQLite.swift/pull/560
2932
[#561]: https://github.com/stephencelis/SQLite.swift/issues/561

CocoaPodsTests/integration_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_validate_project
1313

1414
def validator
1515
@validator ||= TestRunningValidator.new(podspec, []).tap do |validator|
16-
validator.test_files = Dir["#{project_test_dir}/*.swift"]
16+
validator.test_files = Dir["#{project_test_dir}/**/*.swift"]
1717
validator.test_resources = Dir["#{project_test_dir}/fixtures"]
1818
validator.config.verbose = true
1919
validator.no_clean = true
@@ -38,6 +38,6 @@ def podspec
3838
end
3939

4040
def project_test_dir
41-
File.expand_path(File.dirname(__FILE__) + '/../SQLiteTests')
41+
File.expand_path(File.dirname(__FILE__) + '/../Tests/SQLiteTests')
4242
end
4343
end

Documentation/Index.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
- [Installation](#installation)
44
- [Carthage](#carthage)
55
- [CocoaPods](#cocoapods)
6+
- [Swift Package Manager](#swift-package-manager)
67
- [Manual](#manual)
7-
- [Frameworkless Targets](#frameworkless-targets)
88
- [Getting Started](#getting-started)
99
- [Connecting to a Database](#connecting-to-a-database)
1010
- [Read-Write Databases](#read-write-databases)
@@ -162,6 +162,24 @@ try db.rekey("another secret")
162162
[sqlite3pod]: https://github.com/clemensg/sqlite3pod
163163
[SQLCipher]: https://www.zetetic.net/sqlcipher/
164164

165+
### Swift Package Manager
166+
167+
The [Swift Package Manager][] is a tool for managing the distribution of Swift code.
168+
It’s integrated with the Swift build system to automate the process of
169+
downloading, compiling, and linking dependencies.
170+
171+
It is the recommended approach for using SQLite.swift in OSX CLI applications.
172+
173+
1. Add the following to your `Package.swift` file:
174+
175+
```swift
176+
dependencies: [
177+
.Package(url: "https://github.com/stephencelis/SQLite.swift.git", majorVersion: 0, minor: 11)
178+
]
179+
```
180+
181+
[Swift Package Manager]: https://swift.org/package-manager
182+
165183
### Manual
166184

167185
To install SQLite.swift as an Xcode sub-project:
@@ -186,24 +204,6 @@ Some additional steps are required to install the application on an actual devic
186204

187205
7. **Add**.
188206

189-
### Frameworkless Targets
190-
191-
It’s possible to use SQLite.swift in a target that doesn’t support frameworks, including iOS 7 apps and OS X command line tools, though it takes a little extra work.
192-
193-
1. In your target’s **Build Phases**, add **libsqlite3.dylib** to the **Link Binary With Libraries** build phase.
194-
195-
2. Copy the SQLite.swift source files (from its **SQLite** directory) into your Xcode project.
196-
197-
3. Add the following lines to your project’s [bridging header](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_79) (a file usually in the form of `$(TARGET_NAME)-Bridging-Header.h`).
198-
199-
``` swift
200-
#import <sqlite3.h>
201-
#import "SQLite-Bridging.h"
202-
```
203-
204-
> _Note:_ Adding SQLite.swift source files directly to your application will both remove the `SQLite` module namespace (no need—or ability—to `import SQLite`) and expose internal functions and variables. You will need to rename anything that conflicts with code of your own. Please [report any bugs](https://github.com/stephencelis/SQLite.swift/issues/new) (_e.g._, segfaults) you encounter.
205-
206-
207207
## Getting Started
208208

209209
To use SQLite.swift classes or structures in your target’s source file, first import the `SQLite` module.

Documentation/Planning.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@ _Lists agreed upon next steps in approximate priority order._
1111

1212
_A gathering point for ideas for new features. In general, the corresponding issue will be closed once it is added here, with the assumption that it will be referred to when it comes time to add the corresponding feature._
1313

14-
### Packaging
15-
16-
* linux support via Swift Package Manager, per [#315](https://github.com/stephencelis/SQLite.swift/issues/315), _in progress_: [#548](https://github.com/stephencelis/SQLite.swift/pull/548)
17-
1814
### Features
1915

2016
* encapsulate ATTACH DATABASE / DETACH DATABASE as methods, per [#30](https://github.com/stephencelis/SQLite.swift/issues/30)
2117
* provide separate threads for update vs read, so updates don't block reads, per [#236](https://github.com/stephencelis/SQLite.swift/issues/236)
22-
* expose more FTS4 options, e.g. virtual table support per [#164](https://github.com/stephencelis/SQLite.swift/issues/164)
2318
* expose triggers, per [#164](https://github.com/stephencelis/SQLite.swift/issues/164)
2419

2520
## Suspended Feature Requests

Package.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ let package = Package(
66
Target(
77
name: "SQLite",
88
dependencies: [
9-
.Target(name: "SQLiteObjc"),
10-
.Target(name: "CSQLite")
9+
.Target(name: "SQLiteObjc")
1110
]),
12-
Target(
13-
name: "SQLiteObjc",
14-
dependencies: [
15-
.Target(name: "CSQLite")
16-
]),
17-
Target(
18-
name: "CSQLite")
11+
Target(name: "SQLiteObjc")
12+
],
13+
dependencies: [
14+
.Package(url: "https://github.com/jberkel/CSQLite.git", majorVersion: 0)
1915
]
2016
)

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ For a more comprehensive example, see [this article](http://masteringswift.blogs
112112
> _Note:_ SQLite.swift requires Swift 3 (and [Xcode][] 8) or greater. If you absolutely
113113
> need compatibility with Swift 2.3 you can use the [swift-2.3][] branch or older
114114
> released versions. New development will happen exclusively on the master/Swift 3 branch.
115-
>
116-
> The following instructions apply to targets that support embedded
117-
> Swift frameworks. To use SQLite.swift in iOS 7 or an OS X command line
118-
> tool, please read the [Frameworkless Targets][] section of the
119-
> documentation.
120-
121115
122116
### Carthage
123117

@@ -174,6 +168,19 @@ SQLite.swift with CocoaPods:
174168
[CocoaPods]: https://cocoapods.org
175169
[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started
176170
171+
### Swift Package Manager
172+
173+
The [Swift Package Manager][] is a tool for managing the distribution of Swift code.
174+
175+
1. Add the following to your `Package.swift` file:
176+
177+
```swift
178+
dependencies: [
179+
.Package(url: "https://github.com/stephencelis/SQLite.swift.git", majorVersion: 0, minor: 11)
180+
]
181+
```
182+
183+
[Swift Package Manager]: https://swift.org/package-manager
177184

178185
### Manual
179186

@@ -200,7 +207,6 @@ Some additional steps are required to install the application on an actual devic
200207
7. **Add**.
201208

202209

203-
[Frameworkless Targets]: Documentation/Index.md#frameworkless-targets
204210
[Xcode]: https://developer.apple.com/xcode/downloads/
205211
[Submodule]: http://git-scm.com/book/en/Git-Tools-Submodules
206212
[download]: https://github.com/stephencelis/SQLite.swift/archive/master.zip

SQLite.swift.podspec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Pod::Spec.new do |s|
2525
}
2626

2727
s.subspec 'standard' do |ss|
28-
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
29-
ss.exclude_files = 'SQLite/Extensions/Cipher.swift'
30-
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
28+
ss.source_files = 'Sources/{SQLite,SQLiteObjc}/**/*.{c,h,m,swift}'
29+
ss.exclude_files = 'Sources/**/Cipher.swift'
30+
ss.private_header_files = 'Sources/SQLiteObjc/*.h'
3131

3232
ss.library = 'sqlite3'
3333
ss.preserve_paths = 'CocoaPods/**/*'
@@ -47,9 +47,9 @@ Pod::Spec.new do |s|
4747
end
4848

4949
s.subspec 'standalone' do |ss|
50-
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
51-
ss.exclude_files = 'SQLite/Extensions/Cipher.swift'
52-
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
50+
ss.source_files = 'Sources/{SQLite,SQLiteObjc}/**/*.{c,h,m,swift}'
51+
ss.exclude_files = 'Sources/**/Cipher.swift'
52+
ss.private_header_files = 'Sources/SQLiteObjc/*.h'
5353
ss.xcconfig = {
5454
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE'
5555
}
@@ -58,8 +58,8 @@ Pod::Spec.new do |s|
5858
end
5959

6060
s.subspec 'SQLCipher' do |ss|
61-
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
62-
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
61+
ss.source_files = 'Sources/{SQLite,SQLiteObjc}/**/*.{c,h,m,swift}'
62+
ss.private_header_files = 'Sources/SQLiteObjc/*.h'
6363
ss.xcconfig = {
6464
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_SQLCIPHER',
6565
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1'

SQLite.xcodeproj/project.pbxproj

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@
455455
EE247AE11C3F04ED00AE3E12 /* SQLiteTests */ = {
456456
isa = PBXGroup;
457457
children = (
458+
19A17E2695737FAB5D6086E3 /* fixtures */,
458459
EE247B1A1C3F137700AE3E12 /* AggregateFunctionsTests.swift */,
459460
EE247B1B1C3F137700AE3E12 /* BlobTests.swift */,
460461
EE247B1D1C3F137700AE3E12 /* ConnectionTests.swift */,
@@ -474,7 +475,6 @@
474475
19A1721B8984686B9963B45D /* FTS5Tests.swift */,
475476
19A1794CC4D7827E997E32A7 /* FoundationTests.swift */,
476477
19A17399EA9E61235D5D77BF /* CipherTests.swift */,
477-
19A17E2695737FAB5D6086E3 /* fixtures */,
478478
19A17B93B48B5560E6E51791 /* Fixtures.swift */,
479479
);
480480
name = SQLiteTests;
@@ -1104,7 +1104,7 @@
11041104
03A65E6D1C6BB0F60062603F /* Debug */ = {
11051105
isa = XCBuildConfiguration;
11061106
buildSettings = {
1107-
INFOPLIST_FILE = SQLite/Info.plist;
1107+
INFOPLIST_FILE = Tests/SQLite/Info.plist;
11081108
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
11091109
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
11101110
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1117,7 +1117,7 @@
11171117
03A65E6E1C6BB0F60062603F /* Release */ = {
11181118
isa = XCBuildConfiguration;
11191119
buildSettings = {
1120-
INFOPLIST_FILE = SQLite/Info.plist;
1120+
INFOPLIST_FILE = Tests/SQLite/Info.plist;
11211121
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
11221122
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
11231123
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1222,7 +1222,6 @@
12221222
ONLY_ACTIVE_ARCH = YES;
12231223
PRODUCT_NAME = "";
12241224
SDKROOT = iphoneos;
1225-
SWIFT_ACTIVE_COMPILATION_CONDITIONS = ALL_IN_ONE_BUILD;
12261225
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
12271226
TARGETED_DEVICE_FAMILY = "1,2,3";
12281227
VERSIONING_SYSTEM = "apple-generic";
@@ -1268,7 +1267,6 @@
12681267
MTL_ENABLE_DEBUG_INFO = NO;
12691268
PRODUCT_NAME = "";
12701269
SDKROOT = iphoneos;
1271-
SWIFT_ACTIVE_COMPILATION_CONDITIONS = ALL_IN_ONE_BUILD;
12721270
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
12731271
TARGETED_DEVICE_FAMILY = "1,2,3";
12741272
VALIDATE_PRODUCT = YES;
@@ -1331,7 +1329,7 @@
13311329
EE247AEB1C3F04ED00AE3E12 /* Debug */ = {
13321330
isa = XCBuildConfiguration;
13331331
buildSettings = {
1334-
INFOPLIST_FILE = SQLiteTests/Info.plist;
1332+
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
13351333
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13361334
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
13371335
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1342,7 +1340,7 @@
13421340
EE247AEC1C3F04ED00AE3E12 /* Release */ = {
13431341
isa = XCBuildConfiguration;
13441342
buildSettings = {
1345-
INFOPLIST_FILE = SQLiteTests/Info.plist;
1343+
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
13461344
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13471345
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
13481346
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1409,7 +1407,7 @@
14091407
buildSettings = {
14101408
CODE_SIGN_IDENTITY = "-";
14111409
COMBINE_HIDPI_IMAGES = YES;
1412-
INFOPLIST_FILE = SQLiteTests/Info.plist;
1410+
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
14131411
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
14141412
MACOSX_DEPLOYMENT_TARGET = 10.11;
14151413
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
@@ -1424,7 +1422,7 @@
14241422
buildSettings = {
14251423
CODE_SIGN_IDENTITY = "-";
14261424
COMBINE_HIDPI_IMAGES = YES;
1427-
INFOPLIST_FILE = SQLiteTests/Info.plist;
1425+
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
14281426
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
14291427
MACOSX_DEPLOYMENT_TARGET = 10.11;
14301428
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;

Sources/CSQLite/module.modulemap

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)