Skip to content

Commit

Permalink
Issue.swift402 (#233)
Browse files Browse the repository at this point in the history
* Migrate to Swift 4.0.2

* Removes compilation blocks

* Removes Swift 3.1.1 Compilation Blocks

* Adds docker-compose
  • Loading branch information
Aaron Liberatore committed Nov 17, 2017
1 parent 96c196e commit fc6e217
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 287 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
/build
/.build
/.build-ubuntu
/Packages
/*.xcodeproj
Package.resolved
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.1
4.0.2
12 changes: 2 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,14 @@ matrix:
- os: linux
dist: trusty
sudo: required
- os: linux
dist: trusty
sudo: required
env: SWIFT_SNAPSHOT=4.0
- os: linux
dist: trusty
sudo: required
services: docker
env: DOCKER_IMAGE=ubuntu:16.04 SWIFT_SNAPSHOT=4.0
- os: osx
osx_image: xcode8.3
sudo: required
env: DOCKER_IMAGE=ubuntu:16.04
- os: osx
osx_image: xcode9
osx_image: xcode9.1
sudo: required
env: SWIFT_SNAPSHOT=4.0

script:
- ./build.sh
5 changes: 0 additions & 5 deletions Package.pins

This file was deleted.

66 changes: 51 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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
*
Expand All @@ -16,23 +19,56 @@

import PackageDescription

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/IBM-Swift/LoggerAPI.git", .upToNextMinor(from: "1.7.0")),
.package(url: "https://github.com/IBM-Swift/BlueSocket.git", .upToNextMinor(from: "0.12.0")),
.package(url: "https://github.com/IBM-Swift/CCurl.git", .upToNextMinor(from: "0.4.0")),
.package(url: "https://github.com/IBM-Swift/BlueSSLService.git", .upToNextMinor(from: "0.12.0"))
]

var kituraNetDependencies: [Target.Dependency] = [
.byNameItem(name: "CHTTPParser"),
.byNameItem(name: "LoggerAPI"),
.byNameItem(name: "Socket"),
.byNameItem(name: "CCurl"),
.byNameItem(name: "SSLService")
]

#if os(Linux)
dependencies.append(contentsOf: [
.package(url: "https://github.com/IBM-Swift/CEpoll.git", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/IBM-Swift/BlueSignals.git", .upToNextMinor(from: "0.9.0"))
])

kituraNetDependencies.append(contentsOf: [
.byNameItem(name: "CEpoll"),
.byNameItem(name: "Signals")
])
#endif

let package = Package(
name: "Kitura-net",
targets: [
Target(name: "KituraNet", dependencies: ["CHTTPParser"]),
Target(name: "CHTTPParser", dependencies: [])
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "KituraNet",
targets: ["KituraNet"]
)
],
dependencies: [
.Package(url: "https://github.com/IBM-Swift/LoggerAPI.git", majorVersion: 1, minor: 7),
.Package(url: "https://github.com/IBM-Swift/BlueSocket.git", majorVersion: 0, minor: 12),
.Package(url: "https://github.com/IBM-Swift/CCurl.git", majorVersion: 0, minor: 4),
.Package(url: "https://github.com/IBM-Swift/BlueSSLService.git", majorVersion: 0, minor: 12)
dependencies: dependencies,
targets: [
// Targets are the basic building blocks of a package. A target can define 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: "CHTTPParser"
),
.target(
name: "KituraNet",
dependencies: kituraNetDependencies
),
.testTarget(
name: "KituraNetTests",
dependencies: ["KituraNet"]
)
]
)

#if os(Linux)
package.dependencies.append(
.Package(url: "https://github.com/IBM-Swift/CEpoll.git", majorVersion: 0, minor: 1))
package.dependencies.append(
.Package(url: "https://github.com/IBM-Swift/BlueSignals.git", majorVersion: 0, minor: 9))
#endif
74 changes: 0 additions & 74 deletions Package@swift-4.0.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Sources/KituraNet/ClientRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public class ClientRequest {
case .port(let thePort):
port = ":\(thePort)"
case .path(var thePath):
if thePath.characters.first != "/" {
if thePath.first != "/" {
thePath = "/" + thePath
}
path = thePath
Expand Down
2 changes: 1 addition & 1 deletion Sources/KituraNet/ConnectionUpgrader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct ConnectionUpgrader {
var protocolName: String?
for eachProtocol in protocolList {
let theProtocol = eachProtocol.first?.trimmingCharacters(in: CharacterSet.whitespaces) ?? ""
if theProtocol.characters.count != 0, let factory = registry[theProtocol.lowercased()] {
if theProtocol.count != 0, let factory = registry[theProtocol.lowercased()] {
(processor, responseBody, responseBodyMimeType) = factory.upgrade(handler: handler, request: request, response: response)
protocolName = theProtocol
notFound = false
Expand Down
2 changes: 1 addition & 1 deletion Sources/KituraNet/FastCGI/FastCGIRecordParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class FastCGIRecordParser {
throw FastCGI.RecordErrors.emptyParameters
}

guard nameString.characters.count > 0 else {
guard nameString.count > 0 else {
// The data received form the web server existed and transcoded,
// but someone resulted in a string of zero length.
// Strange, but an error none the less.
Expand Down
Loading

0 comments on commit fc6e217

Please sign in to comment.