From 4a4ee301f982c2c3c65f01157d143c0e9403fcfe Mon Sep 17 00:00:00 2001 From: ddunn2 Date: Fri, 15 Dec 2017 15:09:07 +0000 Subject: [PATCH] Migrate to Swift 4.0.2 (#70) --- .gitignore | 2 +- .swift-version | 2 +- .travis.yml | 10 +------ Package.pins | 5 ---- Package.swift | 38 ++++++++++++++++++-------- Package@swift-4.swift | 50 ---------------------------------- Sources/CouchDB/Database.swift | 4 +-- 7 files changed, 31 insertions(+), 80 deletions(-) delete mode 100644 Package.pins delete mode 100644 Package@swift-4.swift diff --git a/.gitignore b/.gitignore index b472ff0..f6e0d30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .build/ build -Packages/ +Package.resolved Kitura-CouchDB.xcodeproj *.DS_Store diff --git a/.swift-version b/.swift-version index 94ff29c..4d54dad 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.1.1 +4.0.2 diff --git a/.travis.yml b/.travis.yml index 3aa9943..1e2dd13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,17 +14,9 @@ matrix: - os: linux dist: trusty sudo: required - - os: linux - dist: trusty - sudo: required - env: SWIFT_SNAPSHOT=$SWIFT_4_DEV_SNAPSHOT - - os: osx - osx_image: xcode8.3 - sudo: required - os: osx - osx_image: xcode9 + osx_image: xcode9.1 sudo: required - env: SWIFT_SNAPSHOT=$SWIFT_4_DEV_SNAPSHOT before_install: - git clone https://github.com/IBM-Swift/Package-Builder.git diff --git a/Package.pins b/Package.pins deleted file mode 100644 index e0570d6..0000000 --- a/Package.pins +++ /dev/null @@ -1,5 +0,0 @@ -{ - "autoPin": false, - "pins": [], - "version": 1 -} diff --git a/Package.swift b/Package.swift index 5d21336..41abd32 100644 --- a/Package.swift +++ b/Package.swift @@ -1,3 +1,6 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + /** * Copyright IBM Corporation 2016, 2017 * @@ -18,19 +21,30 @@ import PackageDescription let package = Package( name: "Kitura-CouchDB", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "CouchDB", + targets: ["CouchDB"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + .package(url: "https://github.com/IBM-Swift/HeliumLogger.git", .upToNextMinor(from: "1.7.0")), + .package(url: "https://github.com/IBM-Swift/Kitura-net.git", .upToNextMinor(from: "2.0.0")), + .package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", .upToNextMinor(from: "17.0.0")), + ], targets: [ - Target( + // Targets are the basic building blocks of a package. A target defines a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( name: "CouchDB", - dependencies: [] - ), - Target( + dependencies: ["HeliumLogger", "KituraNet", "SwiftyJSON"]), + .target( name: "CouchDBSample", - dependencies: [.Target(name: "CouchDB")] - ), - ], - dependencies: [ - .Package(url: "https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 7), - .Package(url: "https://github.com/IBM-Swift/Kitura-net.git", majorVersion: 1, minor: 7), - .Package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", majorVersion: 17) - ] + dependencies: ["CouchDB"]), + .testTarget( + name: "CouchDBTests", + dependencies: ["CouchDB"]), + ] ) diff --git a/Package@swift-4.swift b/Package@swift-4.swift deleted file mode 100644 index 3a754af..0000000 --- a/Package@swift-4.swift +++ /dev/null @@ -1,50 +0,0 @@ -// swift-tools-version:4.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -/** - * Copyright IBM Corporation 2016, 2017 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -import PackageDescription - -let package = Package( - name: "Kitura-CouchDB", - products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. - .library( - name: "CouchDB", - targets: ["CouchDB"]), - ], - dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), - .package(url: "https://github.com/IBM-Swift/HeliumLogger.git", .upToNextMinor(from: "1.7.0")), - .package(url: "https://github.com/IBM-Swift/Kitura-net.git", .upToNextMinor(from: "1.7.0")), - .package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", .upToNextMinor(from: "17.0.0")), - ], - targets: [ - // Targets are the basic building blocks of a package. A target defines a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. - .target( - name: "CouchDB", - dependencies: ["HeliumLogger", "KituraNet", "SwiftyJSON"]), - .target( - name: "CouchDBSample", - dependencies: ["CouchDB"]), - .testTarget( - name: "CouchDBTests", - dependencies: ["CouchDB"]), - ] -) diff --git a/Sources/CouchDB/Database.swift b/Sources/CouchDB/Database.swift index fde25de..55c4eee 100644 --- a/Sources/CouchDB/Database.swift +++ b/Sources/CouchDB/Database.swift @@ -433,8 +433,8 @@ public class Database { } } - if paramString.characters.count > 0 { - paramString = "?" + String(paramString.characters.dropLast()) + if paramString.count > 0 { + paramString = "?" + String(paramString.dropLast()) } var method = "GET"