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

Allow Swift static library integration via CocoaPods #570

Merged
merged 3 commits into from
Jul 31, 2019
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
46 changes: 31 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,16 @@ jobs:
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=CocoaPods GRDB
script: make test_install_GRDB_CocoaPods
- TID=CocoaPods GRDB (framework)
script: make test_install_GRDB_CocoaPods_framework

# CocoaPods Install GRDB
- stage: Test Installation Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=CocoaPods GRDB (static)
script: make test_install_GRDB_CocoaPods_static

# SPM Install
- stage: Test Installation Xcode 10.2
Expand Down Expand Up @@ -297,10 +305,10 @@ jobs:
# env:
# - TID=SQLCipher 4
# script: make test_framework_SQLCipher4
#
# ###########################################
# ## Test Installation Xcode 10
#

###########################################
## Test Installation Xcode 10

# # Manual Install
# - stage: Test Installation Xcode 10
# gemfile: .ci/gemfiles/Gemfile.travis
Expand All @@ -316,15 +324,23 @@ jobs:
# env:
# - TID=CocoaPods Lint
# script: make test_CocoaPodsLint_GRDB
#
# # CocoaPods Install GRDB
# - stage: Test Installation Xcode 10
# gemfile: .ci/gemfiles/Gemfile.travis
# osx_image: xcode10
# env:
# - TID=CocoaPods GRDB
# script: make test_install_GRDB_CocoaPods
#

# CocoaPods Install GRDB
- stage: Test Installation Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=CocoaPods GRDB (framework)
script: make test_install_GRDB_CocoaPods_framework

# CocoaPods Install GRDB
- stage: Test Installation Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=CocoaPods GRDB (static)
script: make test_install_GRDB_CocoaPods_static

# # SPM Install
# - stage: Test Installation Xcode 10
# gemfile: .ci/gemfiles/Gemfile.travis
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one expection:

- [#560](https://github.com/groue/GRDB.swift/pull/560) by [@bellebethcooper](https://github.com/bellebethcooper): Minor typo fix
- [#562](https://github.com/groue/GRDB.swift/pull/562): Fix crash when using more than one DatabaseCollation
- [#570](https://github.com/groue/GRDB.swift/pull/570): Allow Swift static library integration via CocoaPods
- [#563](https://github.com/groue/GRDB.swift/pull/563): More tests for eager loading of hasMany associations
- [#574](https://github.com/groue/GRDB.swift/pull/574): SwiftLint
- [#576](https://github.com/groue/GRDB.swift/pull/576): Expose table name and full-text filtering methods to DerivableRequest
Expand Down
5 changes: 2 additions & 3 deletions GRDB.swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.9'
s.watchos.deployment_target = '2.0'
s.module_map = 'Support/module.modulemap'
s.default_subspec = 'standard'

s.subspec 'standard' do |ss|
ss.source_files = 'GRDB/**/*.swift', 'Support/*.h'
ss.source_files = 'GRDB/**/*.swift', 'Support/grdb_config.h'
ss.framework = 'Foundation'
ss.library = 'sqlite3'
end

s.subspec 'SQLCipher' do |ss|
ss.source_files = 'GRDB/**/*.swift', 'Support/*.h'
ss.source_files = 'GRDB/**/*.swift', 'Support/grdb_config.h'
ss.framework = 'Foundation'
ss.dependency 'SQLCipher', '>= 3.4.0'
ss.xcconfig = {
Expand Down
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,27 @@ test_install_SPM:
./.build/debug/SPM && \
$(SWIFT) package unedit --force GRDB

test_install_GRDB_CocoaPods:
test_install_GRDB_CocoaPods: test_install_GRDB_CocoaPods_framework test_install_GRDB_CocoaPods_static

test_install_GRDB_CocoaPods_framework:
ifdef POD
cd Tests/CocoaPods/GRDBiOS-framework && \
$(POD) install && \
$(XCODEBUILD) \
-workspace iOS.xcworkspace \
-scheme iOS \
-configuration Release \
-destination $(MAX_IOS_DESTINATION) \
clean build \
$(XCPRETTY)
else
@echo CocoaPods must be installed for test_install_GRDB_CocoaPods
@exit 1
endif

test_install_GRDB_CocoaPods_static:
ifdef POD
cd Tests/CocoaPods/GRDBiOS && \
cd Tests/CocoaPods/GRDBiOS-static && \
$(POD) install && \
$(XCODEBUILD) \
-workspace iOS.xcworkspace \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ See [Enabling FTS5 Support](#enabling-fts5-support) for the installation procedu
[CocoaPods](http://cocoapods.org/) is a dependency manager for Xcode projects. To use GRDB with CocoaPods (version 1.2 or higher), specify in your `Podfile`:

```ruby
use_frameworks!
pod 'GRDB.swift'
```

GRDB can be installed as a framework, or a static library.

## Swift Package Manager

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use_frameworks!

target 'iOS'
platform :ios, '9.0'
supports_swift_versions '4.2'
pod 'GRDB.swift', :path => '../../..'
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
567374431B4D46600089DE44 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374411B4D46600089DE44 /* Main.storyboard */; };
567374451B4D46600089DE44 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 567374441B4D46600089DE44 /* Assets.xcassets */; };
567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374461B4D46600089DE44 /* LaunchScreen.storyboard */; };
A1CCD2E34F7DE41D2EC4186E /* Pods_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C57F470F1DCB1126DFB5EB63 /* Pods_iOS.framework */; };
905ECD161513DA7089DC0E4F /* Pods_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 44319992BE6EA64810E8982A /* Pods_iOS.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -32,6 +32,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
44319992BE6EA64810E8982A /* Pods_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5626974C2110308E0066800A /* PlayersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayersViewController.swift; sourceTree = "<group>"; };
5626974D2110308E0066800A /* Player.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = "<group>"; };
5626974E2110308E0066800A /* PlayerEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerEditionViewController.swift; sourceTree = "<group>"; };
Expand All @@ -44,15 +45,14 @@
567374491B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
62C5B84AA50DF194B4DDDFD0 /* Pods-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iOS/Pods-iOS.debug.xcconfig"; sourceTree = "<group>"; };
9573251A237B01D90415D0D7 /* Pods-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-iOS/Pods-iOS.release.xcconfig"; sourceTree = "<group>"; };
C57F470F1DCB1126DFB5EB63 /* Pods_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
567374351B4D46600089DE44 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A1CCD2E34F7DE41D2EC4186E /* Pods_iOS.framework in Frameworks */,
905ECD161513DA7089DC0E4F /* Pods_iOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -97,7 +97,7 @@
8D9BFC4007F760CC8E01ACC6 /* Frameworks */ = {
isa = PBXGroup;
children = (
C57F470F1DCB1126DFB5EB63 /* Pods_iOS.framework */,
44319992BE6EA64810E8982A /* Pods_iOS.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -123,7 +123,7 @@
567374351B4D46600089DE44 /* Frameworks */,
567374361B4D46600089DE44 /* Resources */,
5644E4071C1072CA0090716E /* Embed Frameworks */,
CED3A5EE3229C5F98D69D6AF /* [CP] Embed Pods Frameworks */,
42992B3BE6585CF939B0D8EF /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -183,40 +183,40 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
C5E9DF0928754FE22F481D3A /* [CP] Check Pods Manifest.lock */ = {
42992B3BE6585CF939B0D8EF /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
"${PODS_ROOT}/Target Support Files/Pods-iOS/Pods-iOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/GRDB.swift/GRDB.framework",
);
name = "[CP] Check Pods Manifest.lock";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-iOS-checkManifestLockResult.txt",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRDB.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iOS/Pods-iOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CED3A5EE3229C5F98D69D6AF /* [CP] Embed Pods Frameworks */ = {
C5E9DF0928754FE22F481D3A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-iOS/Pods-iOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/GRDB.swift/GRDB.framework",
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Embed Pods Frameworks";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRDB.framework",
"$(DERIVED_FILE_DIR)/Pods-iOS-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iOS/Pods-iOS-frameworks.sh\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
4 changes: 4 additions & 0 deletions Tests/CocoaPods/GRDBiOS-static/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target 'iOS'
platform :ios, '9.0'
supports_swift_versions '4.2'
pod 'GRDB.swift', :path => '../../..'
Loading