Skip to content

Commit

Permalink
Merge pull request #22 from kiliankoe/master
Browse files Browse the repository at this point in the history
Add Swift frameworks
  • Loading branch information
tbrand authored May 8, 2017
2 parents 16c5ab0 + 120577d commit 3388981
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ rocket:
cd rust/rocket; cargo build --release
ln -s -f ../rust/rocket/target/release/server_rust_rocket bin/.

# --- Swift ---
swift: vapor perfect kitura

# Vapor
vapor:
cd swift/vapor; swift build --configuration release
ln -s -f ../swift/vapor/.build/release/server_swift_vapor bin/.

# Perfect
perfect:
cd swift/perfect; swift build --configuration release
ln -s -f ../swift/perfect/.build/release/server_swift_perfect bin/.

# Kitura
kitura:
cd swift/kitura; swift build --configuration release
ln -s -f ../swift/kitura/.build/release/server_swift_kitura bin/.

# --- Benchmarker ---
# client
client:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Measuring response times for each framework(middleware). Each framework has to
- [express](https://github.com/expressjs/express)
- Elixir
- [Plug](http://github.com/elixir-lang/plug)
- Swift
- [Vapor](https://vapor.codes)
- [Perfect](https://www.perfect.org)
- [Kitura](http://www.kitura.io)

See Development section when you want to add new languages for frameworks.

Expand Down
5 changes: 5 additions & 0 deletions benchmarker/src/benchmarker.cr
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ LANGS = [
{lang: "Elixir", targets: [
{name: "Plug", exec: "server_elixir_plug"},
]},
{lang: "Swift", targets: [
{name: "Vapor", exec: "server_swift_vapor"},
{name: "Perfect", exec: "server_swift_perfect"},
{name: "Kitura", exec: "server_swift_kitura"},
]},
]

# struct for benchmark result
Expand Down
27 changes: 27 additions & 0 deletions neph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,33 @@ plug:
chdir:
elixir/plug

swift:
depends_on:
- vapor
- perfect
- kitura

vapor:
command: |
swift build --configuration release
ln -s -f ../swift/vapor/.build/release/server_swift_vapor ../../bin/.
chdir:
swift/vapor

perfect:
command: |
swift build --configuration release
ln -s -f ../swift/perfect/.build/release/server_swift_perfect ../../bin/.
chdir:
swift/perfect

kitura:
command: |
swift build --configuration release
ln -s -f ../swift/kitura/.build/release/server_swift_kitura ../../bin/.
chdir:
swift/kitura

benchmarker:
command: |
crystal build src/benchmarker.cr -o bin/benchmarker --release
Expand Down
4 changes: 4 additions & 0 deletions swift/kitura/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
54 changes: 54 additions & 0 deletions swift/kitura/Package.pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"autoPin": true,
"pins": [
{
"package": "CCurl",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/CCurl.git",
"version": "0.2.3"
},
{
"package": "Kitura",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/Kitura.git",
"version": "1.7.3"
},
{
"package": "Kitura-TemplateEngine",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/Kitura-TemplateEngine.git",
"version": "1.7.0"
},
{
"package": "Kitura-net",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/Kitura-net.git",
"version": "1.7.4"
},
{
"package": "LoggerAPI",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/LoggerAPI.git",
"version": "1.7.0"
},
{
"package": "SSLService",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/BlueSSLService.git",
"version": "0.12.32"
},
{
"package": "Socket",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/BlueSocket.git",
"version": "0.12.46"
},
{
"package": "SwiftyJSON",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/SwiftyJSON.git",
"version": "16.0.0"
}
],
"version": 1
}
10 changes: 10 additions & 0 deletions swift/kitura/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// swift-tools-version:3.1

import PackageDescription

let package = Package(
name: "server_swift_kitura",
dependencies: [
.Package(url: "https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 7)
]
)
19 changes: 19 additions & 0 deletions swift/kitura/Sources/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Kitura

let router = Router()

router.get("/") { _, res, _ in
try res.send("").end()
}

router.get("/user/:id") { req, res, _ in
let id = req.parameters["id"] ?? ""
try res.send(id).end()
}

router.post("/user") { _, res, _ in
try res.send("").end()
}

Kitura.addHTTPServer(onPort: 3000, with: router)
Kitura.run()
4 changes: 4 additions & 0 deletions swift/perfect/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
42 changes: 42 additions & 0 deletions swift/perfect/Package.pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"autoPin": true,
"pins": [
{
"package": "COpenSSL",
"reason": null,
"repositoryURL": "https://github.com/PerfectlySoft/Perfect-COpenSSL.git",
"version": "2.0.4"
},
{
"package": "PerfectHTTP",
"reason": null,
"repositoryURL": "https://github.com/PerfectlySoft/Perfect-HTTP.git",
"version": "2.0.7"
},
{
"package": "PerfectHTTPServer",
"reason": null,
"repositoryURL": "https://github.com/PerfectlySoft/Perfect-HTTPServer.git",
"version": "2.0.9"
},
{
"package": "PerfectLib",
"reason": null,
"repositoryURL": "https://github.com/PerfectlySoft/PerfectLib.git",
"version": "2.0.9"
},
{
"package": "PerfectNet",
"reason": null,
"repositoryURL": "https://github.com/PerfectlySoft/Perfect-Net.git",
"version": "2.0.5"
},
{
"package": "PerfectThread",
"reason": null,
"repositoryURL": "https://github.com/PerfectlySoft/Perfect-Thread.git",
"version": "2.0.9"
}
],
"version": 1
}
10 changes: 10 additions & 0 deletions swift/perfect/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// swift-tools-version:3.1

import PackageDescription

let package = Package(
name: "server_swift_perfect",
dependencies: [
.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 2, minor: 0)
]
)
25 changes: 25 additions & 0 deletions swift/perfect/Sources/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import PerfectHTTP
import PerfectHTTPServer

let server = HTTPServer()

var routes = Routes()

routes.add(method: .get, uri: "/", handler: { _, response in
response.completed()
})

routes.add(method: .get, uri: "/user/{id}", handler: { request, response in
response.setBody(string: request.urlVariables["id"] ?? "")
response.completed()
})

routes.add(method: .post, uri: "/user", handler: { _, response in
response.completed()
})

server.addRoutes(routes)

server.serverPort = 3000

try! server.start()
4 changes: 4 additions & 0 deletions swift/vapor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
108 changes: 108 additions & 0 deletions swift/vapor/Package.pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"autoPin": true,
"pins": [
{
"package": "CLibreSSL",
"reason": null,
"repositoryURL": "https://github.com/vapor/clibressl.git",
"version": "1.0.0"
},
{
"package": "Console",
"reason": null,
"repositoryURL": "https://github.com/vapor/console.git",
"version": "1.0.2"
},
{
"package": "Core",
"reason": null,
"repositoryURL": "https://github.com/vapor/core.git",
"version": "1.1.2"
},
{
"package": "Crypto",
"reason": null,
"repositoryURL": "https://github.com/vapor/crypto.git",
"version": "1.1.0"
},
{
"package": "Engine",
"reason": null,
"repositoryURL": "https://github.com/vapor/engine.git",
"version": "1.3.12"
},
{
"package": "Fluent",
"reason": null,
"repositoryURL": "https://github.com/vapor/fluent.git",
"version": "1.4.3"
},
{
"package": "JSON",
"reason": null,
"repositoryURL": "https://github.com/vapor/json.git",
"version": "1.0.6"
},
{
"package": "Jay",
"reason": null,
"repositoryURL": "https://github.com/DanToml/Jay.git",
"version": "1.0.1"
},
{
"package": "Leaf",
"reason": null,
"repositoryURL": "https://github.com/vapor/leaf.git",
"version": "1.0.7"
},
{
"package": "Node",
"reason": null,
"repositoryURL": "https://github.com/vapor/node.git",
"version": "1.0.1"
},
{
"package": "PathIndexable",
"reason": null,
"repositoryURL": "https://github.com/vapor/path-indexable.git",
"version": "1.0.0"
},
{
"package": "Polymorphic",
"reason": null,
"repositoryURL": "https://github.com/vapor/polymorphic.git",
"version": "1.0.1"
},
{
"package": "Routing",
"reason": null,
"repositoryURL": "https://github.com/vapor/routing.git",
"version": "1.1.0"
},
{
"package": "Socks",
"reason": null,
"repositoryURL": "https://github.com/vapor/socks.git",
"version": "1.2.7"
},
{
"package": "TLS",
"reason": null,
"repositoryURL": "https://github.com/vapor/tls.git",
"version": "1.1.2"
},
{
"package": "Turnstile",
"reason": null,
"repositoryURL": "https://github.com/stormpath/Turnstile.git",
"version": "1.0.6"
},
{
"package": "Vapor",
"reason": null,
"repositoryURL": "https://github.com/vapor/vapor.git",
"version": "1.1.13"
}
],
"version": 1
}
10 changes: 10 additions & 0 deletions swift/vapor/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// swift-tools-version:3.1

import PackageDescription

let package = Package(
name: "server_swift_vapor",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 5)
]
)
Loading

0 comments on commit 3388981

Please sign in to comment.