Skip to content

Commit

Permalink
Merge pull request #188 from pvzig/xcode8b6
Browse files Browse the repository at this point in the history
Xcode8b6
  • Loading branch information
damian-kolakowski authored Sep 22, 2016
2 parents caf411a + 0b4fada commit 29579e2
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
*.DS_Store

# CocoaPods
#
Expand Down
12 changes: 6 additions & 6 deletions Sources/Swifter/HttpServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ public class HttpServer: HttpServerIO {
public var DELETE, UPDATE, HEAD, POST, GET, PUT : MethodRoute
public var delete, update, head, post, get, put : MethodRoute

public func get(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
public func get(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
router.register("GET", path: path, handler: handler)
}

public func post(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
public func post(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
router.register("POST", path: path, handler: handler)
}

public func put(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
public func put(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
router.register("PUT", path: path, handler: handler)
}

public func head(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
public func head(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
router.register("HEAD", path: path, handler: handler)
}

public func delete(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
public func delete(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
router.register("DELETE", path: path, handler: handler)
}

public func update(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
public func update(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
router.register("UPDATE", path: path, handler: handler)
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Swifter/Scopes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import Foundation
#endif

public func scopes(_ scope: Closure) -> ((HttpRequest) -> HttpResponse) {
public func scopes(_ scope: @escaping Closure) -> ((HttpRequest) -> HttpResponse) {
return { r in
ScopesBuffer[Process.tid] = ""
scope()
Expand Down
11 changes: 8 additions & 3 deletions Sources/Swifter/Socket+File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

struct sf_hdtr { }

private func sendfileImpl(source: Int32, _ target: Int32, _: off_t, _: UnsafeMutablePointer<off_t>, _: UnsafeMutablePointer<sf_hdtr>, _: Int32) -> Int32 {
var buffer = [UInt8](count: 1024, repeatedValue: 0)
private func sendfileImpl(source: Int32, _ target: Int32, _: off_t, _: UnsafeMutablePointer<off_t>, _: UnsafeMutablePointer<sf_hdtr>?, _: Int32) -> Int32 {
var buffer = [UInt8](repeating: 0, count: 1024)
while true {
let readResult = read(source, &buffer, buffer.count)
guard readResult > 0 else {
Expand All @@ -40,14 +40,19 @@

#endif

#if os(iOS) || os (Linux)

extension Socket {

public func writeFile(file: String.File) throws -> Void {
var offset: off_t = 0
let result = sendfileImpl(fileno(file.pointer), self.socketFileDescriptor, 0, &offset, nil, 0)
let result = sendfileImpl(source: fileno(file.pointer), self.socketFileDescriptor, 0, &offset, nil, 0)
if result == -1 {
throw SocketError.writeFailed("sendfile: " + Process.lastErrno)
}
}

}

#endif

28 changes: 25 additions & 3 deletions XCode/Swifter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@
7AE893FA1C0512C400A29F63 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0800;
ProvisioningStyle = Manual;
ProvisioningStyle = Automatic;
};
7C839B6D19422CFF003A6950 = {
CreatedOnToolsVersion = 6.0;
Expand Down Expand Up @@ -1234,8 +1234,11 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifteriOS;
PRODUCT_NAME = Swifter;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1261,8 +1264,11 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifteriOS;
PRODUCT_NAME = Swifter;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1277,6 +1283,7 @@
CURRENT_PROJECT_VERSION = 1.1.3;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1289,7 +1296,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifterMac;
PRODUCT_NAME = Swifter;
PROVISIONING_PROFILE_SPECIFIER = JHSX9UH35H/;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -1309,6 +1316,7 @@
CURRENT_PROJECT_VERSION = 1.1.3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1321,7 +1329,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifterMac;
PRODUCT_NAME = Swifter;
PROVISIONING_PROFILE_SPECIFIER = JHSX9UH35H/;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down Expand Up @@ -1442,6 +1450,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -1457,6 +1466,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down Expand Up @@ -1512,6 +1522,7 @@
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifterSampletvOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.1;
};
Expand All @@ -1533,6 +1544,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.1;
};
Expand All @@ -1557,8 +1569,12 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwiftertvOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1584,8 +1600,12 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwiftertvOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1603,6 +1623,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifteriOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -1620,6 +1641,7 @@
PRODUCT_BUNDLE_IDENTIFIER = pl.kolakowski.SwifteriOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7CCD1BA81C8F84E60016D664"
BuildableName = "SwiftertvOS.framework"
BlueprintName = "SwiftertvOS"
ReferencedContainer = "container:Swifter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7CCD1BA81C8F84E60016D664"
BuildableName = "SwiftertvOS.framework"
BlueprintName = "SwiftertvOS"
ReferencedContainer = "container:Swifter.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7CCD1BA81C8F84E60016D664"
BuildableName = "SwiftertvOS.framework"
BlueprintName = "SwiftertvOS"
ReferencedContainer = "container:Swifter.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

0 comments on commit 29579e2

Please sign in to comment.