From 4a96270af035dedb7c574c998e934a145903cca3 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Tue, 8 Mar 2016 14:09:37 +0200 Subject: [PATCH 01/28] Works with Boilerplate --- Cartfile | 1 + ExecutionContext.xcodeproj/project.pbxproj | 38 +++++++++++++++++-- ExecutionContext/CustomExecutionContext.swift | 1 + .../DispatchExecutionContext.swift | 1 + ExecutionContext/ExecutionContext.swift | 4 +- .../ImmediateExecutionContext.swift | 1 + .../PThreadExecutionContext.swift | 1 + ExecutionContext/RunLoop.swift | 1 + 8 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Cartfile b/Cartfile index a4f1358..8663ec8 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1,2 @@ github "crossroadlabs/Result" ~> 1.0 +github "crossroadlabs/RunLoop" "master" diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index 8030b62..458e8de 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -7,6 +7,19 @@ objects = { /* Begin PBXBuildFile section */ + 65246B4D1C8E1F6B00421D73 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B491C8E1F6B00421D73 /* Boilerplate.framework */; }; + 65246B4E1C8E1F6B00421D73 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4A1C8E1F6B00421D73 /* Result.framework */; }; + 65246B4F1C8E1F6B00421D73 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; }; + 65246B501C8E1F6B00421D73 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; }; + 65246B511C8E1F8500421D73 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B491C8E1F6B00421D73 /* Boilerplate.framework */; }; + 65246B531C8E1F8500421D73 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; }; + 65246B541C8E1F8500421D73 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; }; + 65246B561C8E1F9000421D73 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4A1C8E1F6B00421D73 /* Result.framework */; }; + 65246B571C8E1F9B00421D73 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B491C8E1F6B00421D73 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65246B581C8E1F9B00421D73 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4A1C8E1F6B00421D73 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65246B591C8E1F9B00421D73 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65246B5A1C8E1F9B00421D73 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65246B5B1C8E1F9B00421D73 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E61C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 658566A31C7CAEE3003B0E08 /* LoopSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */; }; 659E80891C77450200DE85B1 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E807E1C77450200DE85B1 /* ExecutionContext.framework */; }; 659E808E1C77450200DE85B1 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; @@ -34,7 +47,6 @@ 65E646F31C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; 65E646F41C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; 65E646F51C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; - 65FB86901C78A8330005CD1B /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E61C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 65FB86921C78A8D30005CD1B /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E31C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 65FB86A21C78AA400005CD1B /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65FB86981C78AA400005CD1B /* ExecutionContext.framework */; }; 65FB86AF1C78AADB0005CD1B /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; @@ -93,7 +105,11 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 65FB86901C78A8330005CD1B /* Result.framework in Copy Frameworks */, + 65246B571C8E1F9B00421D73 /* Boilerplate.framework in Copy Frameworks */, + 65246B581C8E1F9B00421D73 /* Result.framework in Copy Frameworks */, + 65246B591C8E1F9B00421D73 /* RunLoop.framework in Copy Frameworks */, + 65246B5A1C8E1F9B00421D73 /* UV.framework in Copy Frameworks */, + 65246B5B1C8E1F9B00421D73 /* Result.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -123,6 +139,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 65246B491C8E1F6B00421D73 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 65246B4A1C8E1F6B00421D73 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; + 65246B4C1C8E1F6B00421D73 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoopSemaphore.swift; sourceTree = ""; }; 659E807E1C77450200DE85B1 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 659E80831C77450200DE85B1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -144,7 +164,6 @@ 659E80E31C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; 659E80E41C78A70700DE85B1 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; 659E80E61C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 659E80E71C78A70700DE85B1 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; 659E80E91C78A70700DE85B1 /* B664D9B2-6E95-32DB-AE17-189723115AE7.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "B664D9B2-6E95-32DB-AE17-189723115AE7.bcsymbolmap"; sourceTree = ""; }; 659E80EA1C78A70700DE85B1 /* EFEDA4F1-6B1F-3501-98EF-3133DB0026EA.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "EFEDA4F1-6B1F-3501-98EF-3133DB0026EA.bcsymbolmap"; sourceTree = ""; }; 659E80EB1C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; @@ -166,7 +185,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 65246B4F1C8E1F6B00421D73 /* RunLoop.framework in Frameworks */, + 65246B4E1C8E1F6B00421D73 /* Result.framework in Frameworks */, + 65246B4D1C8E1F6B00421D73 /* Boilerplate.framework in Frameworks */, 659E81131C78A72C00DE85B1 /* Result.framework in Frameworks */, + 65246B501C8E1F6B00421D73 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -175,6 +198,10 @@ buildActionMask = 2147483647; files = ( 659E80891C77450200DE85B1 /* ExecutionContext.framework in Frameworks */, + 65246B511C8E1F8500421D73 /* Boilerplate.framework in Frameworks */, + 65246B531C8E1F8500421D73 /* RunLoop.framework in Frameworks */, + 65246B561C8E1F9000421D73 /* Result.framework in Frameworks */, + 65246B541C8E1F8500421D73 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -301,8 +328,11 @@ 659E80E51C78A70700DE85B1 /* Mac */ = { isa = PBXGroup; children = ( + 65246B491C8E1F6B00421D73 /* Boilerplate.framework */, + 65246B4A1C8E1F6B00421D73 /* Result.framework */, + 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */, + 65246B4C1C8E1F6B00421D73 /* UV.framework */, 659E80E61C78A70700DE85B1 /* Result.framework */, - 659E80E71C78A70700DE85B1 /* Result.framework.dSYM */, ); name = Mac; path = Carthage/Build/Mac; diff --git a/ExecutionContext/CustomExecutionContext.swift b/ExecutionContext/CustomExecutionContext.swift index 0e81a1f..aeb38ce 100644 --- a/ExecutionContext/CustomExecutionContext.swift +++ b/ExecutionContext/CustomExecutionContext.swift @@ -15,6 +15,7 @@ //===----------------------------------------------------------------------===// import Foundation +import Boilerplate public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType { let executor:Executor diff --git a/ExecutionContext/DispatchExecutionContext.swift b/ExecutionContext/DispatchExecutionContext.swift index e2e10e9..5f17459 100644 --- a/ExecutionContext/DispatchExecutionContext.swift +++ b/ExecutionContext/DispatchExecutionContext.swift @@ -19,6 +19,7 @@ import Foundation import Dispatch import Result + import Boilerplate public class DispatchExecutionContext : ExecutionContextBase, ExecutionContextType, DefaultExecutionContextType { private let queue:dispatch_queue_t diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 9cb5779..05fe5b7 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -16,6 +16,7 @@ import Foundation import Result +import Boilerplate #if os(Linux) import Glibc @@ -25,9 +26,6 @@ import Result import Dispatch #endif -public typealias Task = () throws -> Void -public typealias SafeTask = () -> Void - // return true if error successfully handled, false otherwise public typealias ErrorHandler = (e:ErrorType) throws -> Bool diff --git a/ExecutionContext/ImmediateExecutionContext.swift b/ExecutionContext/ImmediateExecutionContext.swift index 043448f..e1804a4 100644 --- a/ExecutionContext/ImmediateExecutionContext.swift +++ b/ExecutionContext/ImmediateExecutionContext.swift @@ -15,6 +15,7 @@ //===----------------------------------------------------------------------===// import Foundation +import Boilerplate public class ImmediateExecutionContext : ExecutionContextBase, ExecutionContextType { public func async(task:SafeTask) { diff --git a/ExecutionContext/PThreadExecutionContext.swift b/ExecutionContext/PThreadExecutionContext.swift index 7a9c1ce..023bd05 100644 --- a/ExecutionContext/PThreadExecutionContext.swift +++ b/ExecutionContext/PThreadExecutionContext.swift @@ -21,6 +21,7 @@ import Foundation import Result + import Boilerplate #if os(Linux) import Glibc #endif diff --git a/ExecutionContext/RunLoop.swift b/ExecutionContext/RunLoop.swift index 93c59c5..69a704d 100644 --- a/ExecutionContext/RunLoop.swift +++ b/ExecutionContext/RunLoop.swift @@ -16,6 +16,7 @@ import Foundation import CoreFoundation +import Boilerplate private extension NSString { var cfString: CFString { return unsafeBitCast(self, CFString.self) } From c6a31e56c51fb2b206b2d3c7eab382543b7e989b Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Tue, 8 Mar 2016 17:04:17 +0200 Subject: [PATCH 02/28] Test mode run loop context --- ExecutionContext.xcodeproj/project.pbxproj | 18 ++ .../DefaultExecutionContext.swift | 2 +- ExecutionContext/LoopSemaphore.swift | 116 +++++++++++- .../PThreadExecutionContext.swift | 14 +- ExecutionContext/RunLoop.swift | 58 +++--- .../RunLoopExecutionContext.swift | 165 ++++++++++++++++++ .../ExecutionContextTests.swift | 8 +- 7 files changed, 334 insertions(+), 47 deletions(-) create mode 100644 ExecutionContext/RunLoopExecutionContext.swift diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index 458e8de..38c7bc1 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -20,6 +20,10 @@ 65246B591C8E1F9B00421D73 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 65246B5A1C8E1F9B00421D73 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 65246B5B1C8E1F9B00421D73 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E61C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 653FF6DF1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; + 653FF6E01C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; + 653FF6E11C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; + 653FF6E21C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; 658566A31C7CAEE3003B0E08 /* LoopSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */; }; 659E80891C77450200DE85B1 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E807E1C77450200DE85B1 /* ExecutionContext.framework */; }; 659E808E1C77450200DE85B1 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; @@ -143,6 +147,7 @@ 65246B4A1C8E1F6B00421D73 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; 65246B4C1C8E1F6B00421D73 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; + 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoopSemaphore.swift; sourceTree = ""; }; 659E807E1C77450200DE85B1 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 659E80831C77450200DE85B1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -286,6 +291,7 @@ 65E646F11C79E0580036D028 /* Semaphore.swift */, 659E80831C77450200DE85B1 /* Info.plist */, 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */, + 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */, ); path = ExecutionContext; sourceTree = ""; @@ -647,6 +653,7 @@ 659E809E1C77457E00DE85B1 /* DefaultExecutionContext.swift in Sources */, 65E646F21C79E0590036D028 /* Semaphore.swift in Sources */, 658566A31C7CAEE3003B0E08 /* LoopSemaphore.swift in Sources */, + 653FF6DF1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 659E80A21C77457E00DE85B1 /* PThreadExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -672,6 +679,7 @@ 659E80DB1C78A4B800DE85B1 /* ImmediateExecutionContext.swift in Sources */, 659E80D71C78A4AB00DE85B1 /* ExecutionContext.swift in Sources */, 65E646F31C79E0590036D028 /* Semaphore.swift in Sources */, + 653FF6E01C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 659E80D91C78A4B200DE85B1 /* DispatchExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -697,6 +705,7 @@ 65FB86B31C78AAE50005CD1B /* ImmediateExecutionContext.swift in Sources */, 65FB86AF1C78AADB0005CD1B /* ExecutionContext.swift in Sources */, 65E646F41C79E0590036D028 /* Semaphore.swift in Sources */, + 653FF6E11C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 65FB86B11C78AAE50005CD1B /* DispatchExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -722,6 +731,7 @@ 65FB86CA1C78AC8B0005CD1B /* ImmediateExecutionContext.swift in Sources */, 65FB86C61C78AC8B0005CD1B /* ExecutionContext.swift in Sources */, 65E646F51C79E0590036D028 /* Semaphore.swift in Sources */, + 653FF6E21C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 65FB86C81C78AC8B0005CD1B /* DispatchExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -850,12 +860,15 @@ "$(PROJECT_DIR)/Carthage/Build/watchOS", ); FRAMEWORK_VERSION = A; + HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = ExecutionContext/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; + SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Carthage/Checkouts"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -877,12 +890,15 @@ "$(PROJECT_DIR)/Carthage/Build/watchOS", ); FRAMEWORK_VERSION = A; + HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = ExecutionContext/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; + SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Carthage/Checkouts"; }; name = Release; }; @@ -896,6 +912,7 @@ ); INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -911,6 +928,7 @@ ); INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; PRODUCT_NAME = "$(TARGET_NAME)"; }; diff --git a/ExecutionContext/DefaultExecutionContext.swift b/ExecutionContext/DefaultExecutionContext.swift index b37bcd9..bf03ebe 100644 --- a/ExecutionContext/DefaultExecutionContext.swift +++ b/ExecutionContext/DefaultExecutionContext.swift @@ -18,7 +18,7 @@ import Foundation #if !os(Linux) || dispatch - public typealias DefaultExecutionContext = DispatchExecutionContext + public typealias DefaultExecutionContext = RunLoopExecutionContext #else diff --git a/ExecutionContext/LoopSemaphore.swift b/ExecutionContext/LoopSemaphore.swift index 60c5841..a9c87c0 100644 --- a/ExecutionContext/LoopSemaphore.swift +++ b/ExecutionContext/LoopSemaphore.swift @@ -110,7 +110,7 @@ public class CFRunLoopSemaphore : SemaphoreType { while value <= 0 { while !self.signaled && !timedout { - RunLoop.runUntilOnce(RunLoop.defaultMode, until: until) + CoreFoundationRunLoop.runUntilOnce(CoreFoundationRunLoop.defaultMode, until: until) timedout = until.timeIntervalSinceNow <= 0 } if timedout { @@ -132,18 +132,122 @@ public class CFRunLoopSemaphore : SemaphoreType { } public func willUse() { - let loop:RunLoop = RunLoop.currentRunLoop() - loop.addSource(source!, mode: RunLoop.defaultMode) + let loop:CoreFoundationRunLoop = CoreFoundationRunLoop.currentRunLoop() + loop.addSource(source!, mode: CoreFoundationRunLoop.defaultMode) } public func didUse() { - let loop:RunLoop = RunLoop.currentRunLoop() - loop.removeSource(source!, mode: RunLoop.defaultMode) + let loop:CoreFoundationRunLoop = CoreFoundationRunLoop.currentRunLoop() + loop.removeSource(source!, mode: CoreFoundationRunLoop.defaultMode) + } +} + +import RunLoop +import Boilerplate + +extension RunnableRunLoopType { + func runWithConditionalDate(until:NSDate?) -> Bool { + if let until = until { + return self.run(Timeout(until: until)) + } else { + return self.run() + } + } +} + +class HashableAnyContainer : AnyContainer, Hashable { + let hashValue: Int = random() + + override init(_ item: T) { + super.init(item) + } +} + +func ==(lhs:HashableAnyContainer, rhs:HashableAnyContainer) -> Bool { + return lhs.hashValue == rhs.hashValue +} + +public class RunLoopSemaphore : SemaphoreType { + private var signals:[HashableAnyContainer] + private let lock:NSLock + private var value:Int + + public required convenience init() { + self.init(value: 0) + } + + public required init(value: Int) { + self.value = value + signals = Array() + lock = NSLock() + } + + public func wait() -> Bool { + return wait(nil) + } + + public func wait(until:NSDate?) -> Bool { + lock.lock() + value -= 1 + defer { + lock.unlock() + } + + if value >= 0 { + value += 1 + return true + } + + var signaled = false + var timedout = false + + let rl = RunLoop.current as! RunnableRunLoopType + + let signal = HashableAnyContainer { + rl.execute { + signaled = true + rl.stop() + } + } + + signals.append(signal) + + while value < 0 { + lock.unlock() + defer { + lock.lock() + } + while !signaled && !timedout { + timedout = rl.runWithConditionalDate(until) + } + + if timedout { + break + } + } + + let index = signals.indexOf { element in + element == signal + } + if let index = index { + signals.removeAtIndex(index) + } + + return signaled + } + + public func signal() -> Int { + lock.lock() + value += 1 + let signal:AnyContainer? = signals.isEmpty ? nil : signals.removeFirst() + lock.unlock() + signal?.content() + return 1 } } #if !os(Linux) || dispatch - public typealias LoopSemaphore = DispatchLoopSemaphore + public typealias LoopSemaphore = RunLoopSemaphore #else public typealias LoopSemaphore = CFRunLoopSemaphore #endif diff --git a/ExecutionContext/PThreadExecutionContext.swift b/ExecutionContext/PThreadExecutionContext.swift index 023bd05..ef6659c 100644 --- a/ExecutionContext/PThreadExecutionContext.swift +++ b/ExecutionContext/PThreadExecutionContext.swift @@ -108,11 +108,11 @@ // This class is workaround around retain cycle in pthread run loop creation. See below in init(). Stupid ARC :( private class RunLoopHolder { - var loop: RunLoop? = nil + var loop: CoreFoundationRunLoop? = nil } private class SerialContext : ExecutionContextBase, ExecutionContextType { - private let rl:RunLoop + private let rl:CoreFoundationRunLoop override init() { let holder = RunLoopHolder() @@ -123,10 +123,10 @@ } PThread(task: { [unowned holder] in - holder.loop = RunLoop.currentRunLoop() + holder.loop = CoreFoundationRunLoop.currentRunLoop() holder.loop!.startTaskQueue() sema.signal() - RunLoop.run() + CoreFoundationRunLoop.run() }).start() sema.wait() @@ -134,7 +134,7 @@ self.rl = holder.loop! } - init(runLoop:RunLoop) { + init(runLoop:CoreFoundationRunLoop) { rl = runLoop rl.startTaskQueue() } @@ -148,7 +148,7 @@ } func async(after:Double, task:SafeTask) { - rl.addDelay(RunLoopDelay(task, delay: after), mode: RunLoop.defaultMode) + rl.addDelay(RunLoopDelay(task, delay: after), mode: CoreFoundationRunLoop.defaultMode) } func sync(task:() throws -> ReturnType) throws -> ReturnType { @@ -186,7 +186,7 @@ inner.async(after, task: task) } - public static let main:ExecutionContextType = PThreadExecutionContext(inner: SerialContext(runLoop: RunLoop.mainRunLoop())) + public static let main:ExecutionContextType = PThreadExecutionContext(inner: SerialContext(runLoop: CoreFoundationRunLoop.mainRunLoop())) public static let global:ExecutionContextType = PThreadExecutionContext(kind: .Parallel) } diff --git a/ExecutionContext/RunLoop.swift b/ExecutionContext/RunLoop.swift index 69a704d..95213c7 100644 --- a/ExecutionContext/RunLoop.swift +++ b/ExecutionContext/RunLoop.swift @@ -74,7 +74,7 @@ private class TaskQueue { private class RunLoopCallbackInfo { private let lock = NSLock() private let task: SafeTask - private var runLoops: [RunLoop] = [] + private var runLoops: [CoreFoundationRunLoop] = [] init(_ task: SafeTask) { self.task = task @@ -84,7 +84,7 @@ private class RunLoopCallbackInfo { task() } - func addRunLoop(rl: RunLoop) { + func addRunLoop(rl: CoreFoundationRunLoop) { defer { lock.unlock() } @@ -92,7 +92,7 @@ private class RunLoopCallbackInfo { runLoops.append(rl) } - func removeRunLoop(rl: RunLoop) { + func removeRunLoop(rl: CoreFoundationRunLoop) { defer { lock.unlock() } @@ -238,10 +238,10 @@ class RunLoopDelay : RunLoopCallback { } private func runLoopTLRelease(rl : UnsafeMutablePointer) { - Unmanaged.fromOpaque(COpaquePointer(rl)).release() + Unmanaged.fromOpaque(COpaquePointer(rl)).release() } -class RunLoop { +class CoreFoundationRunLoop { private let cfRunLoop: CFRunLoop! private var taskQueueSource: RunLoopTaskQueueSource? = nil @@ -256,7 +256,7 @@ class RunLoop { private static let threadKey = PThreadKey(destructionCallback: runLoopTLRelease) private static let threadLocalLock = NSLock() - private static let MainRunLoop = RunLoop.createMainRunLoop() + private static let MainRunLoop = CoreFoundationRunLoop.createMainRunLoop() init(_ cfRunLoop: CFRunLoop) { self.cfRunLoop = cfRunLoop @@ -266,15 +266,15 @@ class RunLoop { self.init(unsafeBitCast(runLoop, CFRunLoop.self)) } - private static func createMainRunLoop() -> RunLoop { + private static func createMainRunLoop() -> CoreFoundationRunLoop { defer { - RunLoop.threadLocalLock.unlock() + CoreFoundationRunLoop.threadLocalLock.unlock() } - RunLoop.threadLocalLock.lock() - let runLoop = RunLoop(CFRunLoopGetMain()) + CoreFoundationRunLoop.threadLocalLock.lock() + let runLoop = CoreFoundationRunLoop(CFRunLoopGetMain()) if runLoop.isCurrent() { - PThread.setSpecific(runLoop, key: RunLoop.threadKey, retain: true) + PThread.setSpecific(runLoop, key: CoreFoundationRunLoop.threadKey, retain: true) } else { let sema = Semaphore() sema.willUse() @@ -282,7 +282,7 @@ class RunLoop { sema.didUse() } runLoop.addTask({ - PThread.setSpecific(runLoop, key: RunLoop.threadKey, retain: true) + PThread.setSpecific(runLoop, key: CoreFoundationRunLoop.threadKey, retain: true) sema.signal() }) sema.wait() @@ -290,20 +290,20 @@ class RunLoop { return runLoop } - static func currentRunLoop() -> RunLoop { + static func currentRunLoop() -> CoreFoundationRunLoop { defer { - RunLoop.threadLocalLock.unlock() + CoreFoundationRunLoop.threadLocalLock.unlock() } - RunLoop.threadLocalLock.lock() - guard let loop = PThread.getSpecific(RunLoop.threadKey) else { - let loop = RunLoop(CFRunLoopGetCurrent()) - PThread.setSpecific(loop, key: RunLoop.threadKey, retain: true) + CoreFoundationRunLoop.threadLocalLock.lock() + guard let loop = PThread.getSpecific(CoreFoundationRunLoop.threadKey) else { + let loop = CoreFoundationRunLoop(CFRunLoopGetCurrent()) + PThread.setSpecific(loop, key: CoreFoundationRunLoop.threadKey, retain: true) return loop } - return unsafeBitCast(loop, RunLoop.self) + return unsafeBitCast(loop, CoreFoundationRunLoop.self) } - static func mainRunLoop() -> RunLoop { + static func mainRunLoop() -> CoreFoundationRunLoop { return MainRunLoop } @@ -314,7 +314,7 @@ class RunLoop { taskQueueLock.lock() self.taskQueueSource = RunLoopTaskQueueSource() - addSource(taskQueueSource!, mode: RunLoop.defaultMode) + addSource(taskQueueSource!, mode: CoreFoundationRunLoop.defaultMode) } func stopTaskQueue() { @@ -331,15 +331,15 @@ class RunLoop { } static func run() { - runInMode(RunLoop.defaultMode) + runInMode(CoreFoundationRunLoop.defaultMode) } static func runUntil(mode: NSString, until:NSDate) { - RunLoop.runWithTimeout(mode, timeout: until.timeIntervalSinceNow) + CoreFoundationRunLoop.runWithTimeout(mode, timeout: until.timeIntervalSinceNow) } static func runUntilOnce(mode: NSString, until:NSDate) { - RunLoop.runWithOptions(mode, timeout: until.timeIntervalSinceNow, once: true) + CoreFoundationRunLoop.runWithOptions(mode, timeout: until.timeIntervalSinceNow, once: true) } static func runWithOptions(mode: NSString, timeout:NSTimeInterval, once:Bool) { @@ -356,11 +356,11 @@ class RunLoop { } static func runWithTimeout(mode: NSString, timeout:NSTimeInterval) { - RunLoop.runWithOptions(mode, timeout: timeout, once: false) + CoreFoundationRunLoop.runWithOptions(mode, timeout: timeout, once: false) } static func runInMode(mode: NSString) { - RunLoop.runWithTimeout(mode, timeout: Double.infinity) + CoreFoundationRunLoop.runWithTimeout(mode, timeout: Double.infinity) } @noreturn static func runForever() { @@ -403,7 +403,7 @@ class RunLoop { queue.addTask(task) } else { let source = RunLoopSource(task, priority: 0, runOnce: true) - addSource(source, mode: RunLoop.defaultMode) + addSource(source, mode: CoreFoundationRunLoop.defaultMode) source.signal() } } @@ -413,9 +413,9 @@ class RunLoop { } } -extension RunLoop : Equatable { +extension CoreFoundationRunLoop : Equatable { } -func ==(lhs: RunLoop, rhs: RunLoop) -> Bool { +func ==(lhs: CoreFoundationRunLoop, rhs: CoreFoundationRunLoop) -> Bool { return lhs.cfRunLoop === rhs.cfRunLoop } \ No newline at end of file diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift new file mode 100644 index 0000000..b9ee412 --- /dev/null +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -0,0 +1,165 @@ +//===--- RunLoopExecutionContext.swift -----------------------------------------------===// +//Copyright (c) 2016 Daniel Leping (dileping) +// +//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 Foundation +import Result +import Boilerplate +import RunLoop + +private func thread_proc(arg: UnsafeMutablePointer) -> UnsafeMutablePointer { + let task = Unmanaged>.fromOpaque(COpaquePointer(arg)).takeRetainedValue() + task.content() + return nil +} + +private func detach_pthread(task:SafeTask) throws { + var thread:pthread_t = pthread_t() + let unmanaged = Unmanaged.passRetained(AnyContainer(task)) + let arg = UnsafeMutablePointer(unmanaged.toOpaque()) + do { + try ccall(CError.self) { + pthread_create(&thread, nil, thread_proc, arg) + } + } catch { + unmanaged.release() + throw error + } +} + +private class ParallelContext : ExecutionContextBase, ExecutionContextType { + func runAsync(task:SafeTask) { + do { + try detach_pthread { +/* if (!RunLoop.trySetFactory { + return RunLoop() + }) { + print("unable to set run loop") + exit(1) + }*/ + + guard let loop = RunLoop.current as? RunnableRunLoopType else { + print("unable to run run loop") + exit(1) + } + + loop.execute(task) + + loop.run() + } + } catch let e as CError { + switch e { + case .Unknown: + print("Got unknown CError while creating pthread") + case .Code(let code): + print("Got CError with code \(code) while creating pthread") + } + } catch { + print("Got Unknown error while creating pthread: ", error) + } + } + + func async(task:SafeTask) { + runAsync(task) + } + + func async(after:Double, task:SafeTask) { + runAsync { + RunLoop.current.execute(Timeout(timeout: after), task: task) + } + } + + func sync(task:() throws -> ReturnType) throws -> ReturnType { + return try syncThroughAsync(task) + } +} + +private class SerialContext : ExecutionContextBase, ExecutionContextType { + private let rl:RunnableRunLoopType + + override init() { + let sema = Semaphore() + let loop = MutableAnyContainer(nil) + + //yeah, fail for now + try! detach_pthread { + loop.content = (RunLoop.current as! RunnableRunLoopType) + sema.signal() + + (RunLoop.current as! RunnableRunLoopType).run() + } + + sema.wait() + + self.rl = loop.content! + } + + init(runLoop:RunLoopType) { + rl = runLoop as! RunnableRunLoopType + } + + deinit { + let rl = self.rl + rl.execute { + rl.stop() + } + } + + func async(task:SafeTask) { + rl.execute(task) + } + + func async(after:Double, task:SafeTask) { + rl.execute(Timeout(timeout: after), task: task) + } + + func sync(task:() throws -> ReturnType) throws -> ReturnType { + if rl.isEqualTo(RunLoop.current) { + return try task() + } else { + return try syncThroughAsync(task) + } + } +} + +public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextType, DefaultExecutionContextType { + let inner:ExecutionContextType + + init(inner:ExecutionContextType) { + self.inner = inner + } + + public required init(kind:ExecutionContextKind) { + switch kind { + case .Serial: inner = SerialContext() + case .Parallel: inner = ParallelContext() + } + } + + public func async(task:SafeTask) { + inner.async(task) + } + + public func sync(task:() throws -> ReturnType) throws -> ReturnType { + return try inner.sync(task) + } + + public func async(after:Double, task:SafeTask) { + inner.async(after, task: task) + } + + public static let main:ExecutionContextType = PThreadExecutionContext(inner: SerialContext(runLoop: RunLoop.main)) + public static let global:ExecutionContextType = PThreadExecutionContext(kind: .Parallel) +} \ No newline at end of file diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index b7bd3ad..0fcfc86 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -99,14 +99,14 @@ class ExecutionContextTests: XCTestCase { afterTestAdvanced(context) } - func testMain() { +/* func testMain() { let context:ExecutionContextType = DefaultExecutionContext.main syncTest(context) asyncTest(context) afterTest(context) //afterTestAdvanced - no it will not work here - } + }*/ func testCustomOnGlobal() { let context = executionContext(global.execute) @@ -117,14 +117,14 @@ class ExecutionContextTests: XCTestCase { afterTestAdvanced(context) } - func testCustomOnMain() { +/* func testCustomOnMain() { let context = executionContext(main.execute) syncTest(context) asyncTest(context) afterTest(context) //afterTestAdvanced - no it will not work here - } + }*/ func testCustomSimple() { let context = executionContext { task in From e5865ab5d9e0d26600fa51f51ba3396c4bbc5d76 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Fri, 11 Mar 2016 18:17:10 +0200 Subject: [PATCH 03/28] new run loops --- Cartfile | 2 +- ExecutionContext.xcodeproj/project.pbxproj | 52 +-- ExecutionContext/CustomExecutionContext.swift | 2 +- .../DefaultExecutionContext.swift | 4 +- .../DispatchExecutionContext.swift | 18 +- ExecutionContext/ExecutionContext.swift | 53 +-- .../ImmediateExecutionContext.swift | 2 +- ExecutionContext/LoopSemaphore.swift | 253 ----------- .../PThreadExecutionContext.swift | 193 -------- ExecutionContext/Result+Some.swift | 60 --- ExecutionContext/RunLoop.swift | 421 ------------------ .../RunLoopExecutionContext.swift | 66 +-- ExecutionContext/Semaphore.swift | 115 ----- .../ExecutionContextTests.swift | 30 +- 14 files changed, 68 insertions(+), 1203 deletions(-) delete mode 100644 ExecutionContext/LoopSemaphore.swift delete mode 100644 ExecutionContext/PThreadExecutionContext.swift delete mode 100644 ExecutionContext/Result+Some.swift delete mode 100644 ExecutionContext/RunLoop.swift delete mode 100644 ExecutionContext/Semaphore.swift diff --git a/Cartfile b/Cartfile index 8663ec8..5aa2c05 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ github "crossroadlabs/Result" ~> 1.0 -github "crossroadlabs/RunLoop" "master" +github "crossroadlabs/RunLoop" "feature-relay-2" diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index 38c7bc1..e2a3df0 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -24,22 +24,17 @@ 653FF6E01C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; 653FF6E11C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; 653FF6E21C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; - 658566A31C7CAEE3003B0E08 /* LoopSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */; }; 659E80891C77450200DE85B1 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E807E1C77450200DE85B1 /* ExecutionContext.framework */; }; 659E808E1C77450200DE85B1 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; 659E809E1C77457E00DE85B1 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; 659E809F1C77457E00DE85B1 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; 659E80A01C77457E00DE85B1 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; 659E80A11C77457E00DE85B1 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 659E80A21C77457E00DE85B1 /* PThreadExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809C1C77457E00DE85B1 /* PThreadExecutionContext.swift */; }; - 659E80A31C77457E00DE85B1 /* Result+Some.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809D1C77457E00DE85B1 /* Result+Some.swift */; }; 659E80CA1C78A47800DE85B1 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80C01C78A47800DE85B1 /* ExecutionContext.framework */; }; 659E80D71C78A4AB00DE85B1 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; 659E80D81C78A4AF00DE85B1 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; 659E80D91C78A4B200DE85B1 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 659E80DA1C78A4B500DE85B1 /* PThreadExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809C1C77457E00DE85B1 /* PThreadExecutionContext.swift */; }; 659E80DB1C78A4B800DE85B1 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 659E80DC1C78A4BC00DE85B1 /* Result+Some.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809D1C77457E00DE85B1 /* Result+Some.swift */; }; 659E80DD1C78A4F000DE85B1 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; 659E81121C78A71F00DE85B1 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E31C78A70700DE85B1 /* Result.framework */; }; 659E81131C78A72C00DE85B1 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E61C78A70700DE85B1 /* Result.framework */; }; @@ -47,35 +42,20 @@ 65E646DE1C7994A00036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; 65E646DF1C7994A10036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; 65E646E01C7994A20036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; - 65E646F21C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; - 65E646F31C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; - 65E646F41C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; - 65E646F51C79E0590036D028 /* Semaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646F11C79E0580036D028 /* Semaphore.swift */; }; 65FB86921C78A8D30005CD1B /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E31C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 65FB86A21C78AA400005CD1B /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65FB86981C78AA400005CD1B /* ExecutionContext.framework */; }; 65FB86AF1C78AADB0005CD1B /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; 65FB86B01C78AAE00005CD1B /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; 65FB86B11C78AAE50005CD1B /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 65FB86B21C78AAE50005CD1B /* PThreadExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809C1C77457E00DE85B1 /* PThreadExecutionContext.swift */; }; 65FB86B31C78AAE50005CD1B /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 65FB86B41C78AAE50005CD1B /* Result+Some.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809D1C77457E00DE85B1 /* Result+Some.swift */; }; 65FB86B51C78AAEC0005CD1B /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; 65FB86B61C78AB290005CD1B /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80EB1C78A70700DE85B1 /* Result.framework */; }; 65FB86B81C78AB4E0005CD1B /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80EB1C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 65FB86C61C78AC8B0005CD1B /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; 65FB86C71C78AC8B0005CD1B /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; 65FB86C81C78AC8B0005CD1B /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 65FB86C91C78AC8B0005CD1B /* PThreadExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809C1C77457E00DE85B1 /* PThreadExecutionContext.swift */; }; 65FB86CA1C78AC8B0005CD1B /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 65FB86CB1C78AC8B0005CD1B /* Result+Some.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809D1C77457E00DE85B1 /* Result+Some.swift */; }; 65FB86CC1C78ACAE0005CD1B /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80F01C78A70700DE85B1 /* Result.framework */; }; - 963ED1C71C81E491002351EE /* LoopSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */; }; - 963ED1C81C81E49E002351EE /* LoopSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */; }; - 963ED1C91C81E4A4002351EE /* LoopSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */; }; - 9678EA2D1C7B22DC00E39B17 /* RunLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9678EA2C1C7B22DC00E39B17 /* RunLoop.swift */; }; - 9678EA2E1C7B22DC00E39B17 /* RunLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9678EA2C1C7B22DC00E39B17 /* RunLoop.swift */; }; - 9678EA2F1C7B22DC00E39B17 /* RunLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9678EA2C1C7B22DC00E39B17 /* RunLoop.swift */; }; - 9678EA301C7B22DC00E39B17 /* RunLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9678EA2C1C7B22DC00E39B17 /* RunLoop.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -148,7 +128,6 @@ 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; 65246B4C1C8E1F6B00421D73 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; - 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoopSemaphore.swift; sourceTree = ""; }; 659E807E1C77450200DE85B1 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 659E80831C77450200DE85B1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 659E80881C77450200DE85B1 /* ExecutionContextTests-OSX.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-OSX.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -158,8 +137,6 @@ 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchExecutionContext.swift; sourceTree = ""; }; 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContext.swift; sourceTree = ""; }; 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateExecutionContext.swift; sourceTree = ""; }; - 659E809C1C77457E00DE85B1 /* PThreadExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PThreadExecutionContext.swift; sourceTree = ""; }; - 659E809D1C77457E00DE85B1 /* Result+Some.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Result+Some.swift"; sourceTree = ""; }; 659E80C01C78A47800DE85B1 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 659E80C91C78A47800DE85B1 /* ExecutionContextTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 659E80DF1C78A70700DE85B1 /* 5DAA48E3-5755-35D2-AB25-E1F30299A0F7.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "5DAA48E3-5755-35D2-AB25-E1F30299A0F7.bcsymbolmap"; sourceTree = ""; }; @@ -178,11 +155,9 @@ 659E80F01C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; 659E80F11C78A70700DE85B1 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomExecutionContext.swift; sourceTree = ""; }; - 65E646F11C79E0580036D028 /* Semaphore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Semaphore.swift; sourceTree = ""; }; 65FB86981C78AA400005CD1B /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 65FB86A11C78AA400005CD1B /* ExecutionContextTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 65FB86BE1C78AC260005CD1B /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9678EA2C1C7B22DC00E39B17 /* RunLoop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoop.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -283,15 +258,10 @@ 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */, 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */, 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */, - 659E809C1C77457E00DE85B1 /* PThreadExecutionContext.swift */, - 9678EA2C1C7B22DC00E39B17 /* RunLoop.swift */, + 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */, 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */, 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */, - 659E809D1C77457E00DE85B1 /* Result+Some.swift */, - 65E646F11C79E0580036D028 /* Semaphore.swift */, 659E80831C77450200DE85B1 /* Info.plist */, - 658566A21C7CAEE3003B0E08 /* LoopSemaphore.swift */, - 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */, ); path = ExecutionContext; sourceTree = ""; @@ -645,16 +615,11 @@ buildActionMask = 2147483647; files = ( 659E809F1C77457E00DE85B1 /* DispatchExecutionContext.swift in Sources */, - 9678EA2D1C7B22DC00E39B17 /* RunLoop.swift in Sources */, 659E80A01C77457E00DE85B1 /* ExecutionContext.swift in Sources */, 65E646DD1C79949C0036D028 /* CustomExecutionContext.swift in Sources */, - 659E80A31C77457E00DE85B1 /* Result+Some.swift in Sources */, 659E80A11C77457E00DE85B1 /* ImmediateExecutionContext.swift in Sources */, 659E809E1C77457E00DE85B1 /* DefaultExecutionContext.swift in Sources */, - 65E646F21C79E0590036D028 /* Semaphore.swift in Sources */, - 658566A31C7CAEE3003B0E08 /* LoopSemaphore.swift in Sources */, 653FF6DF1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, - 659E80A21C77457E00DE85B1 /* PThreadExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -670,15 +635,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 963ED1C71C81E491002351EE /* LoopSemaphore.swift in Sources */, 659E80D81C78A4AF00DE85B1 /* DefaultExecutionContext.swift in Sources */, - 9678EA2E1C7B22DC00E39B17 /* RunLoop.swift in Sources */, - 659E80DA1C78A4B500DE85B1 /* PThreadExecutionContext.swift in Sources */, 65E646DE1C7994A00036D028 /* CustomExecutionContext.swift in Sources */, - 659E80DC1C78A4BC00DE85B1 /* Result+Some.swift in Sources */, 659E80DB1C78A4B800DE85B1 /* ImmediateExecutionContext.swift in Sources */, 659E80D71C78A4AB00DE85B1 /* ExecutionContext.swift in Sources */, - 65E646F31C79E0590036D028 /* Semaphore.swift in Sources */, 653FF6E01C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 659E80D91C78A4B200DE85B1 /* DispatchExecutionContext.swift in Sources */, ); @@ -696,15 +656,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 963ED1C81C81E49E002351EE /* LoopSemaphore.swift in Sources */, 65FB86B01C78AAE00005CD1B /* DefaultExecutionContext.swift in Sources */, - 9678EA2F1C7B22DC00E39B17 /* RunLoop.swift in Sources */, - 65FB86B21C78AAE50005CD1B /* PThreadExecutionContext.swift in Sources */, 65E646DF1C7994A10036D028 /* CustomExecutionContext.swift in Sources */, - 65FB86B41C78AAE50005CD1B /* Result+Some.swift in Sources */, 65FB86B31C78AAE50005CD1B /* ImmediateExecutionContext.swift in Sources */, 65FB86AF1C78AADB0005CD1B /* ExecutionContext.swift in Sources */, - 65E646F41C79E0590036D028 /* Semaphore.swift in Sources */, 653FF6E11C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 65FB86B11C78AAE50005CD1B /* DispatchExecutionContext.swift in Sources */, ); @@ -722,15 +677,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 963ED1C91C81E4A4002351EE /* LoopSemaphore.swift in Sources */, 65FB86C71C78AC8B0005CD1B /* DefaultExecutionContext.swift in Sources */, - 9678EA301C7B22DC00E39B17 /* RunLoop.swift in Sources */, - 65FB86C91C78AC8B0005CD1B /* PThreadExecutionContext.swift in Sources */, 65E646E01C7994A20036D028 /* CustomExecutionContext.swift in Sources */, - 65FB86CB1C78AC8B0005CD1B /* Result+Some.swift in Sources */, 65FB86CA1C78AC8B0005CD1B /* ImmediateExecutionContext.swift in Sources */, 65FB86C61C78AC8B0005CD1B /* ExecutionContext.swift in Sources */, - 65E646F51C79E0590036D028 /* Semaphore.swift in Sources */, 653FF6E21C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, 65FB86C81C78AC8B0005CD1B /* DispatchExecutionContext.swift in Sources */, ); diff --git a/ExecutionContext/CustomExecutionContext.swift b/ExecutionContext/CustomExecutionContext.swift index aeb38ce..35fe6ee 100644 --- a/ExecutionContext/CustomExecutionContext.swift +++ b/ExecutionContext/CustomExecutionContext.swift @@ -35,7 +35,7 @@ public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType } } - public func sync(task:() throws -> ReturnType) throws -> ReturnType { + public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try syncThroughAsync(task) } } \ No newline at end of file diff --git a/ExecutionContext/DefaultExecutionContext.swift b/ExecutionContext/DefaultExecutionContext.swift index bf03ebe..cb7cd25 100644 --- a/ExecutionContext/DefaultExecutionContext.swift +++ b/ExecutionContext/DefaultExecutionContext.swift @@ -16,13 +16,13 @@ import Foundation -#if !os(Linux) || dispatch +#if dispatch public typealias DefaultExecutionContext = RunLoopExecutionContext #else - public typealias DefaultExecutionContext = PThreadExecutionContext + public typealias DefaultExecutionContext = RunLoopExecutionContext #endif diff --git a/ExecutionContext/DispatchExecutionContext.swift b/ExecutionContext/DispatchExecutionContext.swift index 5f17459..cbde8ca 100644 --- a/ExecutionContext/DispatchExecutionContext.swift +++ b/ExecutionContext/DispatchExecutionContext.swift @@ -53,17 +53,19 @@ } } - public func sync(task:() throws -> ReturnType) throws -> ReturnType { + public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { if dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(queue) { return try task() } else { - var result:Result? - - dispatch_sync(queue) { - result = materialize(task) - } - - return try result!.dematerializeAnyError() + return try { + var result:Result? + + dispatch_sync(queue) { + result = materializeAny(task) + } + + return try result!.dematerializeAny() + }() } } diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 05fe5b7..007e63f 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -49,8 +49,7 @@ public protocol TaskSchedulerType { func async(after:Double, task:Task) func async(after:Double, task:SafeTask) - func sync(task:() throws -> ReturnType) throws -> ReturnType - func sync(task:() -> ReturnType) -> ReturnType + func sync(task:() throws -> ReturnType) rethrows -> ReturnType } public protocol ExecutionContextType : TaskSchedulerType, ErrorHandlerRegistryType { @@ -63,6 +62,27 @@ public extension ExecutionContextType { } } +import RunLoop + +extension ExecutionContextType { + func syncThroughAsync(task:() throws -> ReturnType) rethrows -> ReturnType { + return try { + var result:Result? + + let sema = RunLoop.current.semaphore() + + async { + result = materializeAny(task) + sema.signal() + } + + sema.wait() + + return try result!.dematerializeAny() + }() + } +} + public typealias Executor = (SafeTask)->Void public class ExecutionContextBase : ErrorHandlerRegistryType { @@ -116,14 +136,6 @@ public extension ErrorHandlerRegistryType where Self : TaskSchedulerType { } } -public extension TaskSchedulerType { - public func sync(task:() -> ReturnType) -> ReturnType { - return try! sync { () throws -> ReturnType in - return task() - } - } -} - public enum ExecutionContextKind { case Serial case Parallel @@ -131,27 +143,6 @@ public enum ExecutionContextKind { public typealias ExecutionContext = DefaultExecutionContext -extension ExecutionContextType { - func syncThroughAsync(task:() throws -> ReturnType) throws -> ReturnType { - var result:Result? - - let sema = LoopSemaphore() - sema.willUse() - defer { - sema.didUse() - } - - async { - result = materialize(task) - sema.signal() - } - - sema.wait() - - return try result!.dematerializeAnyError() - } -} - public let immediate:ExecutionContextType = ImmediateExecutionContext() public let main:ExecutionContextType = ExecutionContext.main public let global:ExecutionContextType = ExecutionContext.global diff --git a/ExecutionContext/ImmediateExecutionContext.swift b/ExecutionContext/ImmediateExecutionContext.swift index e1804a4..2fab0a5 100644 --- a/ExecutionContext/ImmediateExecutionContext.swift +++ b/ExecutionContext/ImmediateExecutionContext.swift @@ -29,7 +29,7 @@ public class ImmediateExecutionContext : ExecutionContextBase, ExecutionContextT } } - public func sync(task:() throws -> ReturnType) throws -> ReturnType { + public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try task() } } \ No newline at end of file diff --git a/ExecutionContext/LoopSemaphore.swift b/ExecutionContext/LoopSemaphore.swift deleted file mode 100644 index a9c87c0..0000000 --- a/ExecutionContext/LoopSemaphore.swift +++ /dev/null @@ -1,253 +0,0 @@ -//===--- LoopSemaphore.swift -----------------------------------------------===// -//Copyright (c) 2016 Daniel Leping (dileping) -// -//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 Foundation -import CoreFoundation - -#if !os(Linux) || dispatch - import Dispatch - - public class DispatchLoopSemaphore : SemaphoreType { - let sema:dispatch_semaphore_t - - public required convenience init() { - self.init(value: 0) - } - - public required init(value: Int) { - self.sema = dispatch_semaphore_create(value) - } - - public func wait() -> Bool { - return dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER) == 0 - } - - public func wait(until:NSDate?) -> Bool { - let timeout = until?.timeIntervalSinceNow - return wait(timeout) - } - - public func wait(timeout: Double?) -> Bool { - guard let timeout = timeout else { - return wait() - } - let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSTimeInterval(NSEC_PER_SEC))) - let result = dispatch_semaphore_wait(sema, time) - return result == 0 - } - - public func signal() -> Int { - return dispatch_semaphore_signal(sema) - } - } -#endif - -extension Optional { - func getOrElse(@autoclosure f:()->Wrapped) -> Wrapped { - switch self { - case .Some(let value): - return value - case .None: - return f() - } - } -} - -public class CFRunLoopSemaphore : SemaphoreType { - var source: RunLoopSource? - var signaled: Bool - - private(set) public var value: Int - - /// Creates a new semaphore with the given initial value - /// See NSCondition and https://developer.apple.com/library/prerelease/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW13 - public required init(value: Int) { - self.value = value - self.signaled = false - self.source = RunLoopSource( { [unowned self] in - self.signaled = true - self.value += 1 - // On linux timeout not working in run loop - #if os(Linux) - CFRunLoopStop(CFRunLoopGetCurrent()) - #endif - }, priority: 2) - } - - /// Creates a new semaphore with initial value 0 - /// This kind of semaphores is useful to protect a critical section - public convenience required init() { - self.init(value: 0) - } - - public func wait() -> Bool { - return wait(nil) - } - - /// returns true on success (false if timeout expired) - /// if nil is passed - waits forever - public func wait(until:NSDate?) -> Bool { - let until = until.getOrElse(NSDate.distantFuture()) - - defer { - self.signaled = false - } - - var timedout:Bool = false - - while value <= 0 { - while !self.signaled && !timedout { - CoreFoundationRunLoop.runUntilOnce(CoreFoundationRunLoop.defaultMode, until: until) - timedout = until.timeIntervalSinceNow <= 0 - } - if timedout { - break - } - } - - if signaled { - value -= 1 - } - - return signaled - } - - /// Performs the signal operation on this semaphore - public func signal() -> Int { - source?.signal() - return value - } - - public func willUse() { - let loop:CoreFoundationRunLoop = CoreFoundationRunLoop.currentRunLoop() - loop.addSource(source!, mode: CoreFoundationRunLoop.defaultMode) - } - - public func didUse() { - let loop:CoreFoundationRunLoop = CoreFoundationRunLoop.currentRunLoop() - loop.removeSource(source!, mode: CoreFoundationRunLoop.defaultMode) - } -} - -import RunLoop -import Boilerplate - -extension RunnableRunLoopType { - func runWithConditionalDate(until:NSDate?) -> Bool { - if let until = until { - return self.run(Timeout(until: until)) - } else { - return self.run() - } - } -} - -class HashableAnyContainer : AnyContainer, Hashable { - let hashValue: Int = random() - - override init(_ item: T) { - super.init(item) - } -} - -func ==(lhs:HashableAnyContainer, rhs:HashableAnyContainer) -> Bool { - return lhs.hashValue == rhs.hashValue -} - -public class RunLoopSemaphore : SemaphoreType { - private var signals:[HashableAnyContainer] - private let lock:NSLock - private var value:Int - - public required convenience init() { - self.init(value: 0) - } - - public required init(value: Int) { - self.value = value - signals = Array() - lock = NSLock() - } - - public func wait() -> Bool { - return wait(nil) - } - - public func wait(until:NSDate?) -> Bool { - lock.lock() - value -= 1 - defer { - lock.unlock() - } - - if value >= 0 { - value += 1 - return true - } - - var signaled = false - var timedout = false - - let rl = RunLoop.current as! RunnableRunLoopType - - let signal = HashableAnyContainer { - rl.execute { - signaled = true - rl.stop() - } - } - - signals.append(signal) - - while value < 0 { - lock.unlock() - defer { - lock.lock() - } - while !signaled && !timedout { - timedout = rl.runWithConditionalDate(until) - } - - if timedout { - break - } - } - - let index = signals.indexOf { element in - element == signal - } - if let index = index { - signals.removeAtIndex(index) - } - - return signaled - } - - public func signal() -> Int { - lock.lock() - value += 1 - let signal:AnyContainer? = signals.isEmpty ? nil : signals.removeFirst() - lock.unlock() - signal?.content() - return 1 - } -} - -#if !os(Linux) || dispatch - public typealias LoopSemaphore = RunLoopSemaphore -#else - public typealias LoopSemaphore = CFRunLoopSemaphore -#endif diff --git a/ExecutionContext/PThreadExecutionContext.swift b/ExecutionContext/PThreadExecutionContext.swift deleted file mode 100644 index ef6659c..0000000 --- a/ExecutionContext/PThreadExecutionContext.swift +++ /dev/null @@ -1,193 +0,0 @@ -//===--- PThreadExecutionContext.swift ------------------------------------------------------===// -//Copyright (c) 2016 Daniel Leping (dileping) -// -//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. -//===----------------------------------------------------------------------===// - -////////////////////////////////////////////////////////////////////////// -//This file is a temporary solution, just until Dispatch will run on Mac// -////////////////////////////////////////////////////////////////////////// -//#if os(Linux) - - import Foundation - import Result - import Boilerplate - #if os(Linux) - import Glibc - #endif - - private func thread_proc(pm: UnsafeMutablePointer) -> UnsafeMutablePointer { - let pthread = Unmanaged.fromOpaque(COpaquePointer(pm)).takeRetainedValue() - pthread.task?() - return nil - } - - internal class PThreadKey { - private var key: pthread_key_t = 0 - init(destructionCallback: (@convention(c) UnsafeMutablePointer -> Void)! = nil) { - pthread_key_create(&key, destructionCallback) - } - deinit { - pthread_key_delete(key) - } - } - - internal class PThread { - let thread: UnsafeMutablePointer - let task:SafeTask? - - init(task:SafeTask? = nil) { - self.task = task - self.thread = UnsafeMutablePointer.alloc(1) - } - deinit { - self.thread.destroy() - self.thread.dealloc(1) - } - - func start() { - pthread_create(thread, nil, thread_proc, UnsafeMutablePointer(Unmanaged.passRetained(self).toOpaque())) - } - - static func getSpecific(key: PThreadKey) -> AnyObject? { - let val = pthread_getspecific(key.key) - if val == nil { - return nil - } - return Unmanaged.fromOpaque(COpaquePointer(val)).takeUnretainedValue() - } - - static func setSpecific(obj: AnyObject?, key: PThreadKey, retain: Bool = false) { - if retain { - let old = pthread_getspecific(key.key) - if old != nil { - Unmanaged.fromOpaque(COpaquePointer(old)).release() - } - } - if obj == nil { - pthread_setspecific(key.key, nil) - } else { - if retain { - pthread_setspecific(key.key, UnsafePointer(Unmanaged.passRetained(obj!).toOpaque())) - } else { - pthread_setspecific(key.key, UnsafePointer(Unmanaged.passUnretained(obj!).toOpaque())) - } - } - } - - } - - private class ParallelContext : ExecutionContextBase, ExecutionContextType { - func async(task:SafeTask) { - let thread = PThread(task: task) - thread.start() - } - - func async(after:Double, task:SafeTask) { - let thread = PThread(task: { - sleep(after) - task() - }) - thread.start() - } - - func sync(task:() throws -> ReturnType) throws -> ReturnType { - return try syncThroughAsync(task) - } - } - - // This class is workaround around retain cycle in pthread run loop creation. See below in init(). Stupid ARC :( - private class RunLoopHolder { - var loop: CoreFoundationRunLoop? = nil - } - - private class SerialContext : ExecutionContextBase, ExecutionContextType { - private let rl:CoreFoundationRunLoop - - override init() { - let holder = RunLoopHolder() - let sema = Semaphore() - sema.willUse() - defer { - sema.didUse() - } - - PThread(task: { [unowned holder] in - holder.loop = CoreFoundationRunLoop.currentRunLoop() - holder.loop!.startTaskQueue() - sema.signal() - CoreFoundationRunLoop.run() - }).start() - - sema.wait() - - self.rl = holder.loop! - } - - init(runLoop:CoreFoundationRunLoop) { - rl = runLoop - rl.startTaskQueue() - } - - deinit { - rl.stopTaskQueue() - } - - func async(task:SafeTask) { - rl.addTask(task) - } - - func async(after:Double, task:SafeTask) { - rl.addDelay(RunLoopDelay(task, delay: after), mode: CoreFoundationRunLoop.defaultMode) - } - - func sync(task:() throws -> ReturnType) throws -> ReturnType { - if rl.isCurrent() { - return try task() - } else { - return try syncThroughAsync(task) - } - } - } - - public class PThreadExecutionContext : ExecutionContextBase, ExecutionContextType, DefaultExecutionContextType { - let inner:ExecutionContextType - - init(inner:ExecutionContextType) { - self.inner = inner - } - - public required init(kind:ExecutionContextKind) { - switch kind { - case .Serial: inner = SerialContext() - case .Parallel: inner = ParallelContext() - } - } - - public func async(task:SafeTask) { - inner.async(task) - } - - public func sync(task:() throws -> ReturnType) throws -> ReturnType { - return try inner.sync(task) - } - - public func async(after:Double, task:SafeTask) { - inner.async(after, task: task) - } - - public static let main:ExecutionContextType = PThreadExecutionContext(inner: SerialContext(runLoop: CoreFoundationRunLoop.mainRunLoop())) - public static let global:ExecutionContextType = PThreadExecutionContext(kind: .Parallel) - } - -//#endif diff --git a/ExecutionContext/Result+Some.swift b/ExecutionContext/Result+Some.swift deleted file mode 100644 index a8942a6..0000000 --- a/ExecutionContext/Result+Some.swift +++ /dev/null @@ -1,60 +0,0 @@ -//===--- Result+Some.swift ------------------------------------------------------===// -//Copyright (c) 2016 Daniel Leping (dileping) -// -//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 Foundation -import Result - -public protocol AnyErrorType : ErrorType { - var error:ErrorType { - get - } -} - -struct AnyError : AnyErrorType { - private let e:ErrorType - - init(e:ErrorType) { - self.e = e - } - - var error:ErrorType { - get { - guard let anyError = e as? AnyError else { - return e - } - return anyError.error - } - } -} - -public extension Result where Error : AnyErrorType { - public func dematerializeAnyError() throws -> T { - switch self { - case let .Success(value): - return value - case let .Failure(error): - throw error.error - } - } -} - -func materialize(f: () throws -> T) -> Result { - do { - return .Success(try f()) - } catch let error { - return .Failure(AnyError(e: error)) - } -} \ No newline at end of file diff --git a/ExecutionContext/RunLoop.swift b/ExecutionContext/RunLoop.swift deleted file mode 100644 index 95213c7..0000000 --- a/ExecutionContext/RunLoop.swift +++ /dev/null @@ -1,421 +0,0 @@ -//===--- RunLoop.swift ------------------------------------------------------===// -//Copyright (c) 2016 Daniel Leping (dileping) -// -//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 Foundation -import CoreFoundation -import Boilerplate - -private extension NSString { - var cfString: CFString { return unsafeBitCast(self, CFString.self) } -} - -private class TaskQueueElement { - private let task : SafeTask - private let source: RunLoopSource - var next: TaskQueueElement? = nil - - init(_ task: SafeTask, runLoopSource: RunLoopSource) { - self.task = task - self.source = runLoopSource - } - - func run() { - task() - } -} - -private class TaskQueue { - private let lock = NSLock() - private var head:TaskQueueElement? = nil - private var tail:TaskQueueElement? = nil - - func enqueue(elem: TaskQueueElement) { - defer { - lock.unlock() - } - lock.lock() - if tail == nil { - head = elem - tail = elem - } else { - tail!.next = elem - tail = elem - } - } - - func dequeue() -> TaskQueueElement? { - defer { - lock.unlock() - } - lock.lock() - let elem = head - head = head?.next - if head == nil { - tail = nil - } - elem?.next = nil - return elem - } -} - -private class RunLoopCallbackInfo { - private let lock = NSLock() - private let task: SafeTask - private var runLoops: [CoreFoundationRunLoop] = [] - - init(_ task: SafeTask) { - self.task = task - } - - func run() { - task() - } - - func addRunLoop(rl: CoreFoundationRunLoop) { - defer { - lock.unlock() - } - lock.lock() - runLoops.append(rl) - } - - func removeRunLoop(rl: CoreFoundationRunLoop) { - defer { - lock.unlock() - } - lock.lock() - if let index = runLoops.indexOf(rl) { - runLoops.removeAtIndex(index) - } - } -} - -private func runLoopCallbackInfoRun(i: UnsafeMutablePointer) { - let info = Unmanaged.fromOpaque(COpaquePointer(i)).takeUnretainedValue() - info.run() -} - -private func runLoopCallbackInfoRetain(i: UnsafePointer) -> UnsafePointer { - Unmanaged.fromOpaque(COpaquePointer(i)).retain() - return i -} - -private func runLoopCallbackInfoRelease(i: UnsafePointer) { - Unmanaged.fromOpaque(COpaquePointer(i)).release() -} - -private protocol RunLoopCallback { - var info : RunLoopCallbackInfo { get } - var cfObject: AnyObject { get } -} - -class RunLoopSource : RunLoopCallback { - private let info : RunLoopCallbackInfo - private let priority : Int - private var _source: CFRunLoopSource! = nil - - private var cfObject : AnyObject { - get { - if _source == nil { - var context = CFRunLoopSourceContext( - version: 0, - info: UnsafeMutablePointer(Unmanaged.passUnretained(info).toOpaque()), - retain: runLoopCallbackInfoRetain, - release: runLoopCallbackInfoRelease, - copyDescription: nil, - equal: nil, - hash: nil, - schedule: nil, - cancel: nil, - perform: runLoopCallbackInfoRun - ) - _source = CFRunLoopSourceCreate(nil, -priority, &context) - } - return _source - } - } - - init(_ task: SafeTask, priority: Int = 0, runOnce: Bool = false) { - self.priority = priority - if runOnce { - var stopTask:SafeTask? - self.info = RunLoopCallbackInfo({ - task() - stopTask?() - }) - stopTask = { self.stop() } - } else { - self.info = RunLoopCallbackInfo(task) - } - - } - - deinit { - stop() - } - - func stop() { - if _source != nil && CFRunLoopSourceIsValid(_source) { - CFRunLoopSourceInvalidate(_source) - _source = nil - } - } - - func signal() { - if _source != nil { - CFRunLoopSourceSignal(_source) - info.lock.lock() - defer { - info.lock.unlock() - } - for loop in info.runLoops { - loop.wakeUp() - } - } - } -} - -class RunLoopTaskQueueSource : RunLoopSource { - private let queue = TaskQueue() - - init(priority: Int = 1) { - super.init({ [unowned queue] in - if let element = queue.dequeue() { - element.run() - element.source.signal() - } - }, priority: priority) - } - - func addTask(task: SafeTask) { - queue.enqueue(TaskQueueElement(task, runLoopSource: self)) - self.signal() - } -} - -private func timerRunCallback(timer: CFRunLoopTimer!, i: UnsafeMutablePointer) { - runLoopCallbackInfoRun(i) -} - -class RunLoopDelay : RunLoopCallback { - private let info : RunLoopCallbackInfo - private let delay: Double - private var _timer: CFRunLoopTimer! = nil - - private var cfObject : AnyObject { - get { - if _timer == nil { - var context = CFRunLoopTimerContext( - version: 0, - info: UnsafeMutablePointer(Unmanaged.passUnretained(info).toOpaque()), - retain: runLoopCallbackInfoRetain, - release: runLoopCallbackInfoRelease, - copyDescription: nil - ) - _timer = CFRunLoopTimerCreate(nil, CFAbsoluteTimeGetCurrent()+delay, -1, 0, 0, timerRunCallback, &context) - } - return _timer - } - } - - init(_ task: SafeTask, delay: Double) { - self.delay = delay - self.info = RunLoopCallbackInfo(task) - } -} - -private func runLoopTLRelease(rl : UnsafeMutablePointer) { - Unmanaged.fromOpaque(COpaquePointer(rl)).release() -} - -class CoreFoundationRunLoop { - private let cfRunLoop: CFRunLoop! - - private var taskQueueSource: RunLoopTaskQueueSource? = nil - private let taskQueueLock = NSLock() - - #if !os(Linux) - static let defaultMode:NSString = "kCFRunLoopDefaultMode" as NSString - #else - static let defaultMode:NSString = "kCFRunLoopDefaultMode".bridge() - #endif - - private static let threadKey = PThreadKey(destructionCallback: runLoopTLRelease) - - private static let threadLocalLock = NSLock() - private static let MainRunLoop = CoreFoundationRunLoop.createMainRunLoop() - - init(_ cfRunLoop: CFRunLoop) { - self.cfRunLoop = cfRunLoop - } - - convenience init(_ runLoop: AnyObject) { - self.init(unsafeBitCast(runLoop, CFRunLoop.self)) - } - - private static func createMainRunLoop() -> CoreFoundationRunLoop { - defer { - CoreFoundationRunLoop.threadLocalLock.unlock() - } - - CoreFoundationRunLoop.threadLocalLock.lock() - let runLoop = CoreFoundationRunLoop(CFRunLoopGetMain()) - if runLoop.isCurrent() { - PThread.setSpecific(runLoop, key: CoreFoundationRunLoop.threadKey, retain: true) - } else { - let sema = Semaphore() - sema.willUse() - defer { - sema.didUse() - } - runLoop.addTask({ - PThread.setSpecific(runLoop, key: CoreFoundationRunLoop.threadKey, retain: true) - sema.signal() - }) - sema.wait() - } - return runLoop - } - - static func currentRunLoop() -> CoreFoundationRunLoop { - defer { - CoreFoundationRunLoop.threadLocalLock.unlock() - } - CoreFoundationRunLoop.threadLocalLock.lock() - guard let loop = PThread.getSpecific(CoreFoundationRunLoop.threadKey) else { - let loop = CoreFoundationRunLoop(CFRunLoopGetCurrent()) - PThread.setSpecific(loop, key: CoreFoundationRunLoop.threadKey, retain: true) - return loop - } - return unsafeBitCast(loop, CoreFoundationRunLoop.self) - } - - static func mainRunLoop() -> CoreFoundationRunLoop { - return MainRunLoop - } - - func startTaskQueue(priority: Int = 1) { - defer { - taskQueueLock.unlock() - } - taskQueueLock.lock() - self.taskQueueSource = RunLoopTaskQueueSource() - - addSource(taskQueueSource!, mode: CoreFoundationRunLoop.defaultMode) - } - - func stopTaskQueue() { - defer { - taskQueueLock.unlock() - } - taskQueueLock.lock() - self.taskQueueSource = nil - } - - - func isCurrent() -> Bool { - return cfRunLoop === CFRunLoopGetCurrent() - } - - static func run() { - runInMode(CoreFoundationRunLoop.defaultMode) - } - - static func runUntil(mode: NSString, until:NSDate) { - CoreFoundationRunLoop.runWithTimeout(mode, timeout: until.timeIntervalSinceNow) - } - - static func runUntilOnce(mode: NSString, until:NSDate) { - CoreFoundationRunLoop.runWithOptions(mode, timeout: until.timeIntervalSinceNow, once: true) - } - - static func runWithOptions(mode: NSString, timeout:NSTimeInterval, once:Bool) { - #if !os(Linux) - //var result:CFRunLoopRunResult - //result = - CFRunLoopRunInMode(mode.cfString, timeout, once) - #else - //var result:Int32 - //result = - CFRunLoopRunInMode(mode.cfString, timeout, once) - //Int32(kCFRunLoopRunStopped) - #endif - } - - static func runWithTimeout(mode: NSString, timeout:NSTimeInterval) { - CoreFoundationRunLoop.runWithOptions(mode, timeout: timeout, once: false) - } - - static func runInMode(mode: NSString) { - CoreFoundationRunLoop.runWithTimeout(mode, timeout: Double.infinity) - } - - @noreturn static func runForever() { - while true { run() } - } - - func addSource(rls: RunLoopSource, mode: NSString) { - let crls = unsafeBitCast(rls.cfObject, CFRunLoopSource.self) - if CFRunLoopSourceIsValid(crls) { - CFRunLoopAddSource(cfRunLoop, crls, mode.cfString) - rls.info.addRunLoop(self) - wakeUp() - } - } - - func removeSource(rls: RunLoopSource, mode: NSString) { - let crls = unsafeBitCast(rls.cfObject, CFRunLoopSource.self) - if CFRunLoopSourceIsValid(crls) { - CFRunLoopRemoveSource(cfRunLoop, crls, mode.cfString) - rls.info.removeRunLoop(self) - wakeUp() - } - } - - func addDelay(rld: RunLoopDelay, mode: NSString) { - let crld = unsafeBitCast(rld.cfObject, CFRunLoopTimer.self) - if CFRunLoopTimerIsValid(crld) && (rld.info.runLoops.count == 0 || rld.info.runLoops[0] === self) { - CFRunLoopAddTimer(cfRunLoop, crld, mode.cfString) - rld.info.addRunLoop(self) - wakeUp() - } - } - - func addTask(task: SafeTask) { - defer { - taskQueueLock.unlock() - } - taskQueueLock.lock() - if let queue = taskQueueSource { - queue.addTask(task) - } else { - let source = RunLoopSource(task, priority: 0, runOnce: true) - addSource(source, mode: CoreFoundationRunLoop.defaultMode) - source.signal() - } - } - - func wakeUp() { - CFRunLoopWakeUp(cfRunLoop) - } -} - -extension CoreFoundationRunLoop : Equatable { -} - -func ==(lhs: CoreFoundationRunLoop, rhs: CoreFoundationRunLoop) -> Bool { - return lhs.cfRunLoop === rhs.cfRunLoop -} \ No newline at end of file diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift index b9ee412..ee98f57 100644 --- a/ExecutionContext/RunLoopExecutionContext.swift +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -19,36 +19,16 @@ import Result import Boilerplate import RunLoop -private func thread_proc(arg: UnsafeMutablePointer) -> UnsafeMutablePointer { - let task = Unmanaged>.fromOpaque(COpaquePointer(arg)).takeRetainedValue() - task.content() - return nil -} - -private func detach_pthread(task:SafeTask) throws { - var thread:pthread_t = pthread_t() - let unmanaged = Unmanaged.passRetained(AnyContainer(task)) - let arg = UnsafeMutablePointer(unmanaged.toOpaque()) - do { - try ccall(CError.self) { - pthread_create(&thread, nil, thread_proc, arg) - } - } catch { - unmanaged.release() - throw error - } -} - private class ParallelContext : ExecutionContextBase, ExecutionContextType { func runAsync(task:SafeTask) { do { - try detach_pthread { -/* if (!RunLoop.trySetFactory { + try Thread.detach { + if (!RunLoop.trySetFactory { return RunLoop() }) { print("unable to set run loop") exit(1) - }*/ + } guard let loop = RunLoop.current as? RunnableRunLoopType else { print("unable to run run loop") @@ -81,56 +61,56 @@ private class ParallelContext : ExecutionContextBase, ExecutionContextType { } } - func sync(task:() throws -> ReturnType) throws -> ReturnType { + func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try syncThroughAsync(task) } } private class SerialContext : ExecutionContextBase, ExecutionContextType { - private let rl:RunnableRunLoopType + private let loop:RunnableRunLoopType override init() { - let sema = Semaphore() + let sema = BlockingSemaphore() let loop = MutableAnyContainer(nil) //yeah, fail for now - try! detach_pthread { - loop.content = (RunLoop.current as! RunnableRunLoopType) + try! Thread.detach { + var _loop = (RunLoop.current as! RunnableRunLoopType) + loop.content = _loop + sema.signal() - (RunLoop.current as! RunnableRunLoopType).run() + _loop.protected = true + _loop.run() } sema.wait() - self.rl = loop.content! + self.loop = loop.content! } init(runLoop:RunLoopType) { - rl = runLoop as! RunnableRunLoopType + loop = runLoop as! RunnableRunLoopType } deinit { - let rl = self.rl + var rl = self.loop rl.execute { + rl.protected = false rl.stop() } } func async(task:SafeTask) { - rl.execute(task) + loop.execute(task) } func async(after:Double, task:SafeTask) { - rl.execute(Timeout(timeout: after), task: task) + loop.execute(Timeout(timeout: after), task: task) } - func sync(task:() throws -> ReturnType) throws -> ReturnType { - if rl.isEqualTo(RunLoop.current) { - return try task() - } else { - return try syncThroughAsync(task) - } + func sync(task:() throws -> ReturnType) rethrows -> ReturnType { + return try loop.sync(task) } } @@ -152,7 +132,7 @@ public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextTyp inner.async(task) } - public func sync(task:() throws -> ReturnType) throws -> ReturnType { + public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try inner.sync(task) } @@ -160,6 +140,6 @@ public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextTyp inner.async(after, task: task) } - public static let main:ExecutionContextType = PThreadExecutionContext(inner: SerialContext(runLoop: RunLoop.main)) - public static let global:ExecutionContextType = PThreadExecutionContext(kind: .Parallel) + public static let main:ExecutionContextType = RunLoopExecutionContext(inner: SerialContext(runLoop: RunLoop.main)) + public static let global:ExecutionContextType = RunLoopExecutionContext(kind: .Parallel) } \ No newline at end of file diff --git a/ExecutionContext/Semaphore.swift b/ExecutionContext/Semaphore.swift deleted file mode 100644 index e833349..0000000 --- a/ExecutionContext/Semaphore.swift +++ /dev/null @@ -1,115 +0,0 @@ -//===--- Semaphore.swift ------------------------------------------------------===// -//Copyright (c) 2016 Daniel Leping (dileping) -// -//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 Foundation - -private extension NSCondition { - func waitWithConditionalEnd(date:NSDate?) -> Bool { - guard let date = date else { - self.wait() - return true - } - return self.waitUntilDate(date) - } -} - -public protocol SemaphoreType { - init() - init(value: Int) - - func wait() -> Bool - func wait(until:NSDate?) -> Bool - func wait(timeout: Double?) -> Bool - - func signal() -> Int -} - -public extension SemaphoreType { - /// Performs the wait operation on this semaphore until the timeout - /// Returns true if the semaphore was signalled before the timeout occurred - /// or false if the timeout occurred. - public func wait(timeout: Double?) -> Bool { - let until = timeout.flatMap {$0 <= 0 ? nil : $0}.map{NSDate(timeIntervalSinceNow: $0)} - return wait(until) - } -} - -/// A wrapper around NSCondition -public class Semaphore : SemaphoreType { - - /// The underlying NSCondition - private(set) public var underlyingSemaphore: NSCondition - private(set) public var value: Int - - /// Creates a new semaphore with the given initial value - /// See NSCondition and https://developer.apple.com/library/prerelease/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW13 - public required init(value: Int) { - self.underlyingSemaphore = NSCondition() - self.value = value - } - - /// Creates a new semaphore with initial value 0 - /// This kind of semaphores is useful to protect a critical section - public convenience required init() { - self.init(value: 0) - } - - public func wait() -> Bool { - return wait(nil) - } - - /// returns true on success (false if timeout expired) - /// if nil is passed - waits forever - public func wait(until:NSDate?) -> Bool { - underlyingSemaphore.lock() - defer { - underlyingSemaphore.unlock() - } - - var signaled:Bool = true - while value <= 0 { - signaled = underlyingSemaphore.waitWithConditionalEnd(until) - if !signaled { - break - } - } - - if signaled { - value -= 1 - } - - return signaled - } - - /// Performs the signal operation on this semaphore - public func signal() -> Int { - underlyingSemaphore.lock() - defer { - underlyingSemaphore.unlock() - } - value += 1 - underlyingSemaphore.signal() - return value - } -} - -public extension SemaphoreType { - public func willUse() { - } - - public func didUse() { - } -} \ No newline at end of file diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index 0fcfc86..3b581d6 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -21,6 +21,9 @@ import XCTest import Glibc #endif +import RunLoop +import UV + class ExecutionContextTests: XCTestCase { //Tests does not create static variables. We need initialized main thread //let mainContext = DefaultExecutionContext.main @@ -99,16 +102,16 @@ class ExecutionContextTests: XCTestCase { afterTestAdvanced(context) } -/* func testMain() { + func testMain() { let context:ExecutionContextType = DefaultExecutionContext.main syncTest(context) asyncTest(context) afterTest(context) //afterTestAdvanced - no it will not work here - }*/ + } - func testCustomOnGlobal() { +/* func testCustomOnGlobal() { let context = executionContext(global.execute) syncTest(context) @@ -117,7 +120,7 @@ class ExecutionContextTests: XCTestCase { afterTestAdvanced(context) } -/* func testCustomOnMain() { + func testCustomOnMain() { let context = executionContext(main.execute) syncTest(context) @@ -136,25 +139,6 @@ class ExecutionContextTests: XCTestCase { afterTest(context) //afterTestAdvanced - no it will not work here } - - func testSemaphore() { - let sema = Semaphore(value: 1) - var n = 0 - for _ in [0...100] { - global.execute { - sema.willUse() - defer { - sema.didUse() - } - sema.wait() - XCTAssert(n == 0, "Should always be zero") - n += 1 - sleep(0.1) - n -= 1 - sema.signal() - } - } - } } #if os(Linux) From 22259e553fc787ac9623097cbc092c12c5eece3c Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Fri, 11 Mar 2016 22:15:16 +0200 Subject: [PATCH 04/28] new API --- ExecutionContext/CustomExecutionContext.swift | 22 ++++- .../DefaultExecutionContext.swift | 4 + .../DispatchExecutionContext.swift | 72 +++++++++------ ExecutionContext/ExecutionContext.swift | 48 ++++++---- .../ImmediateExecutionContext.swift | 26 +++++- .../RunLoopExecutionContext.swift | 91 +++++++++++++++---- .../ExecutionContextTests.swift | 16 ++-- 7 files changed, 202 insertions(+), 77 deletions(-) diff --git a/ExecutionContext/CustomExecutionContext.swift b/ExecutionContext/CustomExecutionContext.swift index 35fe6ee..d30c2b2 100644 --- a/ExecutionContext/CustomExecutionContext.swift +++ b/ExecutionContext/CustomExecutionContext.swift @@ -18,6 +18,7 @@ import Foundation import Boilerplate public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType { + let id = NSUUID() let executor:Executor public init(executor:Executor) { @@ -25,12 +26,20 @@ public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType } public func async(task:SafeTask) { - executor(task) + executor { + let context = currentContext.value + defer { + currentContext.value = context + } + currentContext.value = self + + task() + } } - public func async(after:Double, task:SafeTask) { + public func async(after:Timeout, task:SafeTask) { async { - sleep(after) + Thread.sleep(after) task() } } @@ -38,4 +47,11 @@ public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try syncThroughAsync(task) } + + public func isEqualTo(other: NonStrictEquatable) -> Bool { + guard let other = other as? CustomExecutionContext else { + return false + } + return id.isEqualTo(other.id) + } } \ No newline at end of file diff --git a/ExecutionContext/DefaultExecutionContext.swift b/ExecutionContext/DefaultExecutionContext.swift index cb7cd25..d719e25 100644 --- a/ExecutionContext/DefaultExecutionContext.swift +++ b/ExecutionContext/DefaultExecutionContext.swift @@ -36,4 +36,8 @@ public protocol DefaultExecutionContextType : ExecutionContextType { static var global:ExecutionContextType { get } + + /// unfortunately name main() is not allowed + @noreturn + static func mainProc() } \ No newline at end of file diff --git a/ExecutionContext/DispatchExecutionContext.swift b/ExecutionContext/DispatchExecutionContext.swift index cbde8ca..a6206de 100644 --- a/ExecutionContext/DispatchExecutionContext.swift +++ b/ExecutionContext/DispatchExecutionContext.swift @@ -20,57 +20,75 @@ import Dispatch import Result import Boilerplate + import RunLoop + + private extension ExecutionContextKind { + func createDispatchQueue(id:String) -> dispatch_queue_t! { + switch self { + case .Serial: + return dispatch_queue_create(id, DISPATCH_QUEUE_SERIAL) + case .Parallel: + return dispatch_queue_create(id, DISPATCH_QUEUE_CONCURRENT) + } + } + } public class DispatchExecutionContext : ExecutionContextBase, ExecutionContextType, DefaultExecutionContextType { - private let queue:dispatch_queue_t + private let loop:DispatchRunLoop - public required init(kind:ExecutionContextKind) { + public required convenience init(kind:ExecutionContextKind) { let id = NSUUID().UUIDString - switch kind { - case .Serial: queue = dispatch_queue_create(id, DISPATCH_QUEUE_SERIAL) - case .Parallel: queue = dispatch_queue_create(id, DISPATCH_QUEUE_CONCURRENT) - } + let queue = kind.createDispatchQueue(id) + self.init(queue: queue) } public init(queue:dispatch_queue_t) { - self.queue = queue + self.loop = DispatchRunLoop(queue: queue) + super.init() + loop.execute { + currentContext.value = self + } } public func async(task:SafeTask) { - dispatch_async(queue) { + loop.execute { + currentContext.value = self task() } } - public func async(after:Double, task:SafeTask) { - if after > 0 { - let time = dispatch_time(DISPATCH_TIME_NOW, Int64(after * NSTimeInterval(NSEC_PER_SEC))) - dispatch_after(time, queue) { - task() - } - } else { - async(task) + public func async(after:Timeout, task:SafeTask) { + loop.execute(after) { + currentContext.value = self + task() } } public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { - if dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(queue) { + return try loop.sync { + currentContext.value = self return try task() - } else { - return try { - var result:Result? - - dispatch_sync(queue) { - result = materializeAny(task) - } - - return try result!.dematerializeAny() - }() } } public static let main:ExecutionContextType = DispatchExecutionContext(queue: dispatch_get_main_queue()) public static let global:ExecutionContextType = DispatchExecutionContext(queue: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) + + @noreturn + public static func mainProc() { + if !Thread.isMain { + print("Main proc was called on non-main thread. Exiting") + exit(1) + } + dispatch_main() + } + + public func isEqualTo(other: NonStrictEquatable) -> Bool { + guard let other = other as? DispatchExecutionContext else { + return false + } + return loop.isEqualTo(other.loop) + } } #endif \ No newline at end of file diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 007e63f..b65fb55 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -45,21 +45,28 @@ public protocol TaskSchedulerType { func async(task:Task) func async(task:SafeTask) - //after is in seconds - func async(after:Double, task:Task) - func async(after:Double, task:SafeTask) + func async(after:Timeout, task:Task) + func async(after:Timeout, task:SafeTask) func sync(task:() throws -> ReturnType) rethrows -> ReturnType } -public protocol ExecutionContextType : TaskSchedulerType, ErrorHandlerRegistryType { +public protocol ExecutionContextType : TaskSchedulerType, ErrorHandlerRegistryType, NonStrictEquatable { func execute(task:SafeTask) + + static var current:ExecutionContextType {get} } public extension ExecutionContextType { - func execute(task:SafeTask) { + public func execute(task:SafeTask) { async(task) } + + public var isCurrent:Bool { + get { + return Self.current.isEqualTo(self) + } + } } import RunLoop @@ -124,7 +131,7 @@ public extension ErrorHandlerRegistryType where Self : TaskSchedulerType { } //after is in seconds - func async(after:Double, task:Task) { + public func async(after:Timeout, task:Task) { //specify explicitely, that it's safe task async(after) { () -> Void in do { @@ -151,18 +158,27 @@ public func executionContext(executor:Executor) -> ExecutionContextType { return CustomExecutionContext(executor: executor) } -public func sleep(timeout:Double) { +var currentContext = try! ThreadLocal() + +public extension ExecutionContextType { + public static var current:ExecutionContextType { + get { + if Thread.isMain { + return ExecutionContext.main + } + if currentContext.value == nil { + //TODO: think +// currentContext.value = RunLoopExecutionContext(inner: <#T##ExecutionContextType#>) + } + return currentContext.value! + } + } +} + +/*public func sleep(timeout:Double) { let sec = time_t(timeout) let nsec = Int((timeout - Double(sec)) * 1000 * 1000 * 1000)//nano seconds var time = timespec(tv_sec:sec, tv_nsec: nsec) nanosleep(&time, nil) -} - -@noreturn public func executionContextMain() { - #if !os(Linux) || dispatch - dispatch_main() - #else - RunLoop.runForever() - #endif -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/ExecutionContext/ImmediateExecutionContext.swift b/ExecutionContext/ImmediateExecutionContext.swift index 2fab0a5..b7b07e7 100644 --- a/ExecutionContext/ImmediateExecutionContext.swift +++ b/ExecutionContext/ImmediateExecutionContext.swift @@ -17,19 +17,35 @@ import Foundation import Boilerplate -public class ImmediateExecutionContext : ExecutionContextBase, ExecutionContextType { - public func async(task:SafeTask) { +class ImmediateExecutionContext : ExecutionContextBase, ExecutionContextType { + func async(task:SafeTask) { + let context = currentContext.value + defer { + currentContext.value = context + } + currentContext.value = self + task() } - public func async(after:Double, task:SafeTask) { + func async(after:Timeout, task:SafeTask) { async { - sleep(after) + Thread.sleep(after) task() } } - public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { + func sync(task:() throws -> ReturnType) rethrows -> ReturnType { + let context = currentContext.value + defer { + currentContext.value = context + } + currentContext.value = self + return try task() } + + func isEqualTo(other:NonStrictEquatable) -> Bool { + return other is ImmediateExecutionContext + } } \ No newline at end of file diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift index ee98f57..5dde751 100644 --- a/ExecutionContext/RunLoopExecutionContext.swift +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -20,15 +20,17 @@ import Boilerplate import RunLoop private class ParallelContext : ExecutionContextBase, ExecutionContextType { + let id = NSUUID() + func runAsync(task:SafeTask) { do { try Thread.detach { - if (!RunLoop.trySetFactory { +/* if (!RunLoop.trySetFactory { return RunLoop() }) { print("unable to set run loop") exit(1) - } + }*/ guard let loop = RunLoop.current as? RunnableRunLoopType else { print("unable to run run loop") @@ -55,15 +57,22 @@ private class ParallelContext : ExecutionContextBase, ExecutionContextType { runAsync(task) } - func async(after:Double, task:SafeTask) { + func async(after:Timeout, task:SafeTask) { runAsync { - RunLoop.current.execute(Timeout(timeout: after), task: task) + RunLoop.current.execute(after, task: task) } } func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try syncThroughAsync(task) } + + func isEqualTo(other: NonStrictEquatable) -> Bool { + guard let other = other as? ParallelContext else { + return false + } + return id.isEqualTo(other.id) + } } private class SerialContext : ExecutionContextBase, ExecutionContextType { @@ -94,10 +103,10 @@ private class SerialContext : ExecutionContextBase, ExecutionContextType { } deinit { - var rl = self.loop - rl.execute { - rl.protected = false - rl.stop() + var loop = self.loop + loop.execute { + loop.protected = false + loop.stop() } } @@ -105,13 +114,31 @@ private class SerialContext : ExecutionContextBase, ExecutionContextType { loop.execute(task) } - func async(after:Double, task:SafeTask) { - loop.execute(Timeout(timeout: after), task: task) + func async(after:Timeout, task:SafeTask) { + loop.execute(after, task: task) } func sync(task:() throws -> ReturnType) rethrows -> ReturnType { return try loop.sync(task) } + + func isEqualTo(other: NonStrictEquatable) -> Bool { + guard let other = other as? SerialContext else { + return false + } + return loop.isEqualTo(other.loop) + } +} + +private extension ExecutionContextKind { + func createInnerContext() -> ExecutionContextType { + switch self { + case .Serial: + return SerialContext() + case .Parallel: + return ParallelContext() + } + } } public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextType, DefaultExecutionContextType { @@ -121,25 +148,51 @@ public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextTyp self.inner = inner } - public required init(kind:ExecutionContextKind) { - switch kind { - case .Serial: inner = SerialContext() - case .Parallel: inner = ParallelContext() - } + public required convenience init(kind:ExecutionContextKind) { + self.init(inner: kind.createInnerContext()) } public func async(task:SafeTask) { - inner.async(task) + inner.async { + currentContext.value = self + task() + } + } + + public func async(after:Timeout, task:SafeTask) { + inner.async(after) { + currentContext.value = self + task() + } } public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { - return try inner.sync(task) + return try inner.sync { + currentContext.value = self + return try task() + } } - public func async(after:Double, task:SafeTask) { - inner.async(after, task: task) + public func isEqualTo(other: NonStrictEquatable) -> Bool { + guard let other = other as? RunLoopExecutionContext else { + return false + } + return inner.isEqualTo(other.inner) } public static let main:ExecutionContextType = RunLoopExecutionContext(inner: SerialContext(runLoop: RunLoop.main)) public static let global:ExecutionContextType = RunLoopExecutionContext(kind: .Parallel) + + @noreturn + public static func mainProc() { + if !Thread.isMain { + print("Main proc was called on non-main thread. Exiting") + exit(1) + } + var loop = (RunLoop.main as! RunnableRunLoopType) + loop.protected = true + while true { + loop.run() + } + } } \ No newline at end of file diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index 3b581d6..ebe03fe 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -21,14 +21,15 @@ import XCTest import Glibc #endif +import Boilerplate import RunLoop -import UV class ExecutionContextTests: XCTestCase { //Tests does not create static variables. We need initialized main thread //let mainContext = DefaultExecutionContext.main func syncTest(context:ExecutionContextType) { + let expectation = self.expectationWithDescription("OK SYNC") context.sync { @@ -39,10 +40,11 @@ class ExecutionContextTests: XCTestCase { } func asyncTest(context:ExecutionContextType) { + RunLoop.current let expectation = self.expectationWithDescription("OK ASYNC") context.async { - sleep(1.0) + Thread.sleep(1) expectation.fulfill() } @@ -66,11 +68,11 @@ class ExecutionContextTests: XCTestCase { ok = false } - sleep(2.0) + Thread.sleep(2.0) XCTAssert(ok) - sleep(2.0) + Thread.sleep(2.0) XCTAssertFalse(ok) } @@ -79,9 +81,9 @@ class ExecutionContextTests: XCTestCase { let context:ExecutionContextType = DefaultExecutionContext(kind: .Serial) syncTest(context) - asyncTest(context) - afterTest(context) - afterTestAdvanced(context) +// asyncTest(context) +// afterTest(context) +// afterTestAdvanced(context) } func testParallel() { From 93b2d17776ae29c8e9f61b798b245d7f4677c7e7 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Sat, 12 Mar 2016 17:17:29 +0200 Subject: [PATCH 05/28] regenerated project --- ExecutionContext.xcodeproj/project.pbxproj | 975 +++--------------- .../xcschemes/ExecutionContext-iOS.xcscheme | 99 -- .../xcschemes/ExecutionContext-tvOS.xcscheme | 99 -- .../ExecutionContext-watchOS.xcscheme | 80 -- ...OSX.xcscheme => ExecutionContext.xcscheme} | 22 +- ExecutionContext/Info.plist | 2 +- .../ExecutionContextTests.swift | 6 +- .../Info.plist | 0 Tests/LinuxMain.swift | 23 - 9 files changed, 174 insertions(+), 1132 deletions(-) delete mode 100644 ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme delete mode 100644 ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme delete mode 100644 ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme rename ExecutionContext.xcodeproj/xcshareddata/xcschemes/{ExecutionContext-OSX.xcscheme => ExecutionContext.xcscheme} (83%) rename {Tests/ExecutionContext => ExecutionContextTests}/ExecutionContextTests.swift (97%) rename {Tests/ExecutionContext => ExecutionContextTests}/Info.plist (100%) delete mode 100644 Tests/LinuxMain.swift diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index e2a3df0..a68b895 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -7,115 +7,49 @@ objects = { /* Begin PBXBuildFile section */ - 65246B4D1C8E1F6B00421D73 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B491C8E1F6B00421D73 /* Boilerplate.framework */; }; - 65246B4E1C8E1F6B00421D73 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4A1C8E1F6B00421D73 /* Result.framework */; }; - 65246B4F1C8E1F6B00421D73 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; }; - 65246B501C8E1F6B00421D73 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; }; - 65246B511C8E1F8500421D73 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B491C8E1F6B00421D73 /* Boilerplate.framework */; }; - 65246B531C8E1F8500421D73 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; }; - 65246B541C8E1F8500421D73 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; }; - 65246B561C8E1F9000421D73 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4A1C8E1F6B00421D73 /* Result.framework */; }; - 65246B571C8E1F9B00421D73 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B491C8E1F6B00421D73 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65246B581C8E1F9B00421D73 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4A1C8E1F6B00421D73 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65246B591C8E1F9B00421D73 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65246B5A1C8E1F9B00421D73 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65246B4C1C8E1F6B00421D73 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65246B5B1C8E1F9B00421D73 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E61C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 653FF6DF1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; - 653FF6E01C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; - 653FF6E11C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; - 653FF6E21C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */; }; - 659E80891C77450200DE85B1 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E807E1C77450200DE85B1 /* ExecutionContext.framework */; }; - 659E808E1C77450200DE85B1 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; - 659E809E1C77457E00DE85B1 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; - 659E809F1C77457E00DE85B1 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 659E80A01C77457E00DE85B1 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; - 659E80A11C77457E00DE85B1 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 659E80CA1C78A47800DE85B1 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80C01C78A47800DE85B1 /* ExecutionContext.framework */; }; - 659E80D71C78A4AB00DE85B1 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; - 659E80D81C78A4AF00DE85B1 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; - 659E80D91C78A4B200DE85B1 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 659E80DB1C78A4B800DE85B1 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 659E80DD1C78A4F000DE85B1 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; - 659E81121C78A71F00DE85B1 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E31C78A70700DE85B1 /* Result.framework */; }; - 659E81131C78A72C00DE85B1 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E61C78A70700DE85B1 /* Result.framework */; }; - 65E646DD1C79949C0036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; - 65E646DE1C7994A00036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; - 65E646DF1C7994A10036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; - 65E646E01C7994A20036D028 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */; }; - 65FB86921C78A8D30005CD1B /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80E31C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65FB86A21C78AA400005CD1B /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65FB86981C78AA400005CD1B /* ExecutionContext.framework */; }; - 65FB86AF1C78AADB0005CD1B /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; - 65FB86B01C78AAE00005CD1B /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; - 65FB86B11C78AAE50005CD1B /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 65FB86B31C78AAE50005CD1B /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 65FB86B51C78AAEC0005CD1B /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */; }; - 65FB86B61C78AB290005CD1B /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80EB1C78A70700DE85B1 /* Result.framework */; }; - 65FB86B81C78AB4E0005CD1B /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80EB1C78A70700DE85B1 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65FB86C61C78AC8B0005CD1B /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */; }; - 65FB86C71C78AC8B0005CD1B /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */; }; - 65FB86C81C78AC8B0005CD1B /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */; }; - 65FB86CA1C78AC8B0005CD1B /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */; }; - 65FB86CC1C78ACAE0005CD1B /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E80F01C78A70700DE85B1 /* Result.framework */; }; + 65D637891C943764000F5548 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D6377E1C943764000F5548 /* ExecutionContext.framework */; }; + 65D6379E1C9437BB000F5548 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */; }; + 65D6379F1C9437BB000F5548 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */; }; + 65D637A01C9437BB000F5548 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */; }; + 65D637A11C9437BB000F5548 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */; }; + 65D637A21C9437BB000F5548 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; + 65D637A31C9437BB000F5548 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; + 65D637A51C9437F4000F5548 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */; }; + 65D637B01C94383C000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637A81C94383C000F5548 /* Boilerplate.framework */; }; + 65D637B21C94383C000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AA1C94383C000F5548 /* Result.framework */; }; + 65D637B41C94383C000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AC1C94383C000F5548 /* RunLoop.framework */; }; + 65D637B61C94383C000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AE1C94383C000F5548 /* UV.framework */; }; + 65D637B81C94386C000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637A81C94383C000F5548 /* Boilerplate.framework */; }; + 65D637B91C94386C000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AA1C94383C000F5548 /* Result.framework */; }; + 65D637BA1C94386C000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AC1C94383C000F5548 /* RunLoop.framework */; }; + 65D637BB1C94386C000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AE1C94383C000F5548 /* UV.framework */; }; + 65D637BD1C943882000F5548 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637A81C94383C000F5548 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637BE1C943882000F5548 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AA1C94383C000F5548 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637BF1C943882000F5548 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AC1C94383C000F5548 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637C01C943882000F5548 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AE1C94383C000F5548 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 659E808A1C77450200DE85B1 /* PBXContainerItemProxy */ = { + 65D6378A1C943764000F5548 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 659E80751C77450200DE85B1 /* Project object */; + containerPortal = 65D637751C943763000F5548 /* Project object */; proxyType = 1; - remoteGlobalIDString = 659E807D1C77450200DE85B1; - remoteInfo = ExecutionContext; - }; - 659E80CB1C78A47800DE85B1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 659E80751C77450200DE85B1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 659E80BF1C78A47800DE85B1; - remoteInfo = ExecutionContext; - }; - 65FB86A31C78AA400005CD1B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 659E80751C77450200DE85B1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 65FB86971C78AA400005CD1B; + remoteGlobalIDString = 65D6377D1C943763000F5548; remoteInfo = ExecutionContext; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 659E80A81C7746BA00DE85B1 /* Copy Frameworks */ = { + 65D637BC1C943872000F5548 /* Copy Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( - 65246B571C8E1F9B00421D73 /* Boilerplate.framework in Copy Frameworks */, - 65246B581C8E1F9B00421D73 /* Result.framework in Copy Frameworks */, - 65246B591C8E1F9B00421D73 /* RunLoop.framework in Copy Frameworks */, - 65246B5A1C8E1F9B00421D73 /* UV.framework in Copy Frameworks */, - 65246B5B1C8E1F9B00421D73 /* Result.framework in Copy Frameworks */, - ); - name = "Copy Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86911C78A8C00005CD1B /* Copy Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 65FB86921C78A8D30005CD1B /* Result.framework in Copy Frameworks */, - ); - name = "Copy Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86B71C78AB3C0005CD1B /* Copy Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 65FB86B81C78AB4E0005CD1B /* Result.framework in Copy Frameworks */, + 65D637BD1C943882000F5548 /* Boilerplate.framework in Copy Frameworks */, + 65D637BE1C943882000F5548 /* Result.framework in Copy Frameworks */, + 65D637BF1C943882000F5548 /* RunLoop.framework in Copy Frameworks */, + 65D637C01C943882000F5548 /* UV.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -123,246 +57,124 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 65246B491C8E1F6B00421D73 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; - 65246B4A1C8E1F6B00421D73 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; - 65246B4C1C8E1F6B00421D73 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; - 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; - 659E807E1C77450200DE85B1 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 659E80831C77450200DE85B1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 659E80881C77450200DE85B1 /* ExecutionContextTests-OSX.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-OSX.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = ""; }; - 659E808F1C77450200DE85B1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultExecutionContext.swift; sourceTree = ""; }; - 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchExecutionContext.swift; sourceTree = ""; }; - 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContext.swift; sourceTree = ""; }; - 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateExecutionContext.swift; sourceTree = ""; }; - 659E80C01C78A47800DE85B1 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 659E80C91C78A47800DE85B1 /* ExecutionContextTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 659E80DF1C78A70700DE85B1 /* 5DAA48E3-5755-35D2-AB25-E1F30299A0F7.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "5DAA48E3-5755-35D2-AB25-E1F30299A0F7.bcsymbolmap"; sourceTree = ""; }; - 659E80E01C78A70700DE85B1 /* 790F29BC-8E9F-3D46-B492-07898513A87F.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "790F29BC-8E9F-3D46-B492-07898513A87F.bcsymbolmap"; sourceTree = ""; }; - 659E80E11C78A70700DE85B1 /* 9C700391-4B46-36F8-B936-005B49EBCAFB.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "9C700391-4B46-36F8-B936-005B49EBCAFB.bcsymbolmap"; sourceTree = ""; }; - 659E80E21C78A70700DE85B1 /* B143BCB0-79DF-31AA-AC9C-7ED9E261D87D.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "B143BCB0-79DF-31AA-AC9C-7ED9E261D87D.bcsymbolmap"; sourceTree = ""; }; - 659E80E31C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 659E80E41C78A70700DE85B1 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; - 659E80E61C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 659E80E91C78A70700DE85B1 /* B664D9B2-6E95-32DB-AE17-189723115AE7.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "B664D9B2-6E95-32DB-AE17-189723115AE7.bcsymbolmap"; sourceTree = ""; }; - 659E80EA1C78A70700DE85B1 /* EFEDA4F1-6B1F-3501-98EF-3133DB0026EA.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "EFEDA4F1-6B1F-3501-98EF-3133DB0026EA.bcsymbolmap"; sourceTree = ""; }; - 659E80EB1C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 659E80EC1C78A70700DE85B1 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; - 659E80EE1C78A70700DE85B1 /* 14121FE4-824C-3F41-BB65-EFAE120D2446.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "14121FE4-824C-3F41-BB65-EFAE120D2446.bcsymbolmap"; sourceTree = ""; }; - 659E80EF1C78A70700DE85B1 /* B2361319-6010-3366-BA4B-B28167D21368.bcsymbolmap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "B2361319-6010-3366-BA4B-B28167D21368.bcsymbolmap"; sourceTree = ""; }; - 659E80F01C78A70700DE85B1 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 659E80F11C78A70700DE85B1 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; - 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomExecutionContext.swift; sourceTree = ""; }; - 65FB86981C78AA400005CD1B /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 65FB86A11C78AA400005CD1B /* ExecutionContextTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 65FB86BE1C78AC260005CD1B /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65D6377E1C943764000F5548 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65D637831C943764000F5548 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 65D637881C943764000F5548 /* ExecutionContextTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExecutionContextTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 65D6378F1C943764000F5548 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomExecutionContext.swift; sourceTree = ""; }; + 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultExecutionContext.swift; sourceTree = ""; }; + 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchExecutionContext.swift; sourceTree = ""; }; + 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContext.swift; sourceTree = ""; }; + 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateExecutionContext.swift; sourceTree = ""; }; + 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; + 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = ""; }; + 65D637A81C94383C000F5548 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 65D637A91C94383C000F5548 /* Boilerplate.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Boilerplate.framework.dSYM; sourceTree = ""; }; + 65D637AA1C94383C000F5548 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 65D637AB1C94383C000F5548 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; + 65D637AC1C94383C000F5548 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; + 65D637AD1C94383C000F5548 /* RunLoop.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = RunLoop.framework.dSYM; sourceTree = ""; }; + 65D637AE1C94383C000F5548 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; + 65D637AF1C94383C000F5548 /* UV.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = UV.framework.dSYM; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 659E807A1C77450200DE85B1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 65246B4F1C8E1F6B00421D73 /* RunLoop.framework in Frameworks */, - 65246B4E1C8E1F6B00421D73 /* Result.framework in Frameworks */, - 65246B4D1C8E1F6B00421D73 /* Boilerplate.framework in Frameworks */, - 659E81131C78A72C00DE85B1 /* Result.framework in Frameworks */, - 65246B501C8E1F6B00421D73 /* UV.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80851C77450200DE85B1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 659E80891C77450200DE85B1 /* ExecutionContext.framework in Frameworks */, - 65246B511C8E1F8500421D73 /* Boilerplate.framework in Frameworks */, - 65246B531C8E1F8500421D73 /* RunLoop.framework in Frameworks */, - 65246B561C8E1F9000421D73 /* Result.framework in Frameworks */, - 65246B541C8E1F8500421D73 /* UV.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80BC1C78A47800DE85B1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 659E81121C78A71F00DE85B1 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80C61C78A47800DE85B1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 659E80CA1C78A47800DE85B1 /* ExecutionContext.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86941C78AA400005CD1B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 65FB86B61C78AB290005CD1B /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB869E1C78AA400005CD1B /* Frameworks */ = { + 65D6377A1C943763000F5548 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 65FB86A21C78AA400005CD1B /* ExecutionContext.framework in Frameworks */, + 65D637B41C94383C000F5548 /* RunLoop.framework in Frameworks */, + 65D637B01C94383C000F5548 /* Boilerplate.framework in Frameworks */, + 65D637B21C94383C000F5548 /* Result.framework in Frameworks */, + 65D637B61C94383C000F5548 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 65FB86BA1C78AC260005CD1B /* Frameworks */ = { + 65D637851C943764000F5548 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 65FB86CC1C78ACAE0005CD1B /* Result.framework in Frameworks */, + 65D637891C943764000F5548 /* ExecutionContext.framework in Frameworks */, + 65D637B81C94386C000F5548 /* Boilerplate.framework in Frameworks */, + 65D637B91C94386C000F5548 /* Result.framework in Frameworks */, + 65D637BA1C94386C000F5548 /* RunLoop.framework in Frameworks */, + 65D637BB1C94386C000F5548 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 659E80741C77450200DE85B1 = { + 65D637741C943763000F5548 = { isa = PBXGroup; children = ( - 659E80801C77450200DE85B1 /* ExecutionContext */, - 659E808C1C77450200DE85B1 /* ExecutionContextTests */, - 659E807F1C77450200DE85B1 /* Products */, - 659E80A61C77467600DE85B1 /* Frameworks */, + 65D637801C943764000F5548 /* ExecutionContext */, + 65D6378C1C943764000F5548 /* ExecutionContextTests */, + 65D637A61C94383C000F5548 /* Frameworks */, + 65D6377F1C943764000F5548 /* Products */, ); sourceTree = ""; }; - 659E807F1C77450200DE85B1 /* Products */ = { + 65D6377F1C943764000F5548 /* Products */ = { isa = PBXGroup; children = ( - 659E807E1C77450200DE85B1 /* ExecutionContext.framework */, - 659E80881C77450200DE85B1 /* ExecutionContextTests-OSX.xctest */, - 659E80C01C78A47800DE85B1 /* ExecutionContext.framework */, - 659E80C91C78A47800DE85B1 /* ExecutionContextTests-iOS.xctest */, - 65FB86981C78AA400005CD1B /* ExecutionContext.framework */, - 65FB86A11C78AA400005CD1B /* ExecutionContextTests-tvOS.xctest */, - 65FB86BE1C78AC260005CD1B /* ExecutionContext.framework */, + 65D6377E1C943764000F5548 /* ExecutionContext.framework */, + 65D637881C943764000F5548 /* ExecutionContextTests.xctest */, ); name = Products; sourceTree = ""; }; - 659E80801C77450200DE85B1 /* ExecutionContext */ = { + 65D637801C943764000F5548 /* ExecutionContext */ = { isa = PBXGroup; children = ( - 659E809A1C77457E00DE85B1 /* ExecutionContext.swift */, - 659E80981C77457E00DE85B1 /* DefaultExecutionContext.swift */, - 659E80991C77457E00DE85B1 /* DispatchExecutionContext.swift */, - 653FF6DE1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift */, - 659E809B1C77457E00DE85B1 /* ImmediateExecutionContext.swift */, - 65E646DC1C79949C0036D028 /* CustomExecutionContext.swift */, - 659E80831C77450200DE85B1 /* Info.plist */, + 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */, + 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */, + 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */, + 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */, + 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */, + 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */, + 65D637831C943764000F5548 /* Info.plist */, ); path = ExecutionContext; sourceTree = ""; }; - 659E808C1C77450200DE85B1 /* ExecutionContextTests */ = { + 65D6378C1C943764000F5548 /* ExecutionContextTests */ = { isa = PBXGroup; children = ( - 659E808D1C77450200DE85B1 /* ExecutionContextTests.swift */, - 659E808F1C77450200DE85B1 /* Info.plist */, + 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */, + 65D6378F1C943764000F5548 /* Info.plist */, ); - name = ExecutionContextTests; - path = Tests/ExecutionContext; + path = ExecutionContextTests; sourceTree = ""; }; - 659E80A61C77467600DE85B1 /* Frameworks */ = { + 65D637A61C94383C000F5548 /* Frameworks */ = { isa = PBXGroup; children = ( - 659E80DE1C78A70700DE85B1 /* iOS */, - 659E80E51C78A70700DE85B1 /* Mac */, - 659E80E81C78A70700DE85B1 /* tvOS */, - 659E80ED1C78A70700DE85B1 /* watchOS */, + 65D637A71C94383C000F5548 /* Mac */, ); name = Frameworks; + path = Carthage/Build; sourceTree = ""; }; - 659E80DE1C78A70700DE85B1 /* iOS */ = { + 65D637A71C94383C000F5548 /* Mac */ = { isa = PBXGroup; children = ( - 659E80DF1C78A70700DE85B1 /* 5DAA48E3-5755-35D2-AB25-E1F30299A0F7.bcsymbolmap */, - 659E80E01C78A70700DE85B1 /* 790F29BC-8E9F-3D46-B492-07898513A87F.bcsymbolmap */, - 659E80E11C78A70700DE85B1 /* 9C700391-4B46-36F8-B936-005B49EBCAFB.bcsymbolmap */, - 659E80E21C78A70700DE85B1 /* B143BCB0-79DF-31AA-AC9C-7ED9E261D87D.bcsymbolmap */, - 659E80E31C78A70700DE85B1 /* Result.framework */, - 659E80E41C78A70700DE85B1 /* Result.framework.dSYM */, - ); - name = iOS; - path = Carthage/Build/iOS; - sourceTree = ""; - }; - 659E80E51C78A70700DE85B1 /* Mac */ = { - isa = PBXGroup; - children = ( - 65246B491C8E1F6B00421D73 /* Boilerplate.framework */, - 65246B4A1C8E1F6B00421D73 /* Result.framework */, - 65246B4B1C8E1F6B00421D73 /* RunLoop.framework */, - 65246B4C1C8E1F6B00421D73 /* UV.framework */, - 659E80E61C78A70700DE85B1 /* Result.framework */, - ); - name = Mac; - path = Carthage/Build/Mac; - sourceTree = ""; - }; - 659E80E81C78A70700DE85B1 /* tvOS */ = { - isa = PBXGroup; - children = ( - 659E80E91C78A70700DE85B1 /* B664D9B2-6E95-32DB-AE17-189723115AE7.bcsymbolmap */, - 659E80EA1C78A70700DE85B1 /* EFEDA4F1-6B1F-3501-98EF-3133DB0026EA.bcsymbolmap */, - 659E80EB1C78A70700DE85B1 /* Result.framework */, - 659E80EC1C78A70700DE85B1 /* Result.framework.dSYM */, - ); - name = tvOS; - path = Carthage/Build/tvOS; - sourceTree = ""; - }; - 659E80ED1C78A70700DE85B1 /* watchOS */ = { - isa = PBXGroup; - children = ( - 659E80EE1C78A70700DE85B1 /* 14121FE4-824C-3F41-BB65-EFAE120D2446.bcsymbolmap */, - 659E80EF1C78A70700DE85B1 /* B2361319-6010-3366-BA4B-B28167D21368.bcsymbolmap */, - 659E80F01C78A70700DE85B1 /* Result.framework */, - 659E80F11C78A70700DE85B1 /* Result.framework.dSYM */, - ); - name = watchOS; - path = Carthage/Build/watchOS; + 65D637A81C94383C000F5548 /* Boilerplate.framework */, + 65D637A91C94383C000F5548 /* Boilerplate.framework.dSYM */, + 65D637AA1C94383C000F5548 /* Result.framework */, + 65D637AB1C94383C000F5548 /* Result.framework.dSYM */, + 65D637AC1C94383C000F5548 /* RunLoop.framework */, + 65D637AD1C94383C000F5548 /* RunLoop.framework.dSYM */, + 65D637AE1C94383C000F5548 /* UV.framework */, + 65D637AF1C94383C000F5548 /* UV.framework.dSYM */, + ); + path = Mac; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 659E807B1C77450200DE85B1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80BD1C78A47800DE85B1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86951C78AA400005CD1B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86BB1C78AC260005CD1B /* Headers */ = { + 65D6377B1C943763000F5548 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( @@ -372,235 +184,88 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 659E807D1C77450200DE85B1 /* ExecutionContext-OSX */ = { + 65D6377D1C943763000F5548 /* ExecutionContext */ = { isa = PBXNativeTarget; - buildConfigurationList = 659E80921C77450200DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContext-OSX" */; + buildConfigurationList = 65D637921C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContext" */; buildPhases = ( - 659E80791C77450200DE85B1 /* Sources */, - 659E807A1C77450200DE85B1 /* Frameworks */, - 659E807B1C77450200DE85B1 /* Headers */, - 659E807C1C77450200DE85B1 /* Resources */, + 65D637791C943763000F5548 /* Sources */, + 65D6377A1C943763000F5548 /* Frameworks */, + 65D6377B1C943763000F5548 /* Headers */, + 65D6377C1C943763000F5548 /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = "ExecutionContext-OSX"; + name = ExecutionContext; productName = ExecutionContext; - productReference = 659E807E1C77450200DE85B1 /* ExecutionContext.framework */; + productReference = 65D6377E1C943764000F5548 /* ExecutionContext.framework */; productType = "com.apple.product-type.framework"; }; - 659E80871C77450200DE85B1 /* ExecutionContextTests-OSX */ = { + 65D637871C943764000F5548 /* ExecutionContextTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 659E80951C77450200DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-OSX" */; + buildConfigurationList = 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests" */; buildPhases = ( - 659E80841C77450200DE85B1 /* Sources */, - 659E80851C77450200DE85B1 /* Frameworks */, - 659E80861C77450200DE85B1 /* Resources */, - 659E80A81C7746BA00DE85B1 /* Copy Frameworks */, + 65D637841C943764000F5548 /* Sources */, + 65D637851C943764000F5548 /* Frameworks */, + 65D637861C943764000F5548 /* Resources */, + 65D637BC1C943872000F5548 /* Copy Frameworks */, ); buildRules = ( ); dependencies = ( - 659E808B1C77450200DE85B1 /* PBXTargetDependency */, - ); - name = "ExecutionContextTests-OSX"; - productName = ExecutionContextTests; - productReference = 659E80881C77450200DE85B1 /* ExecutionContextTests-OSX.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 659E80BF1C78A47800DE85B1 /* ExecutionContext-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 659E80D11C78A47800DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContext-iOS" */; - buildPhases = ( - 659E80BB1C78A47800DE85B1 /* Sources */, - 659E80BC1C78A47800DE85B1 /* Frameworks */, - 659E80BD1C78A47800DE85B1 /* Headers */, - 659E80BE1C78A47800DE85B1 /* Resources */, + 65D6378B1C943764000F5548 /* PBXTargetDependency */, ); - buildRules = ( - ); - dependencies = ( - ); - name = "ExecutionContext-iOS"; - productName = ExecutionContext; - productReference = 659E80C01C78A47800DE85B1 /* ExecutionContext.framework */; - productType = "com.apple.product-type.framework"; - }; - 659E80C81C78A47800DE85B1 /* ExecutionContextTests-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 659E80D41C78A47800DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-iOS" */; - buildPhases = ( - 659E80C51C78A47800DE85B1 /* Sources */, - 659E80C61C78A47800DE85B1 /* Frameworks */, - 659E80C71C78A47800DE85B1 /* Resources */, - 65FB86911C78A8C00005CD1B /* Copy Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 659E80CC1C78A47800DE85B1 /* PBXTargetDependency */, - ); - name = "ExecutionContextTests-iOS"; - productName = ExecutionContextTests; - productReference = 659E80C91C78A47800DE85B1 /* ExecutionContextTests-iOS.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 65FB86971C78AA400005CD1B /* ExecutionContext-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 65FB86A91C78AA400005CD1B /* Build configuration list for PBXNativeTarget "ExecutionContext-tvOS" */; - buildPhases = ( - 65FB86931C78AA400005CD1B /* Sources */, - 65FB86941C78AA400005CD1B /* Frameworks */, - 65FB86951C78AA400005CD1B /* Headers */, - 65FB86961C78AA400005CD1B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ExecutionContext-tvOS"; - productName = ExecutionContext; - productReference = 65FB86981C78AA400005CD1B /* ExecutionContext.framework */; - productType = "com.apple.product-type.framework"; - }; - 65FB86A01C78AA400005CD1B /* ExecutionContextTests-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 65FB86AC1C78AA400005CD1B /* Build configuration list for PBXNativeTarget "ExecutionContextTests-tvOS" */; - buildPhases = ( - 65FB869D1C78AA400005CD1B /* Sources */, - 65FB869E1C78AA400005CD1B /* Frameworks */, - 65FB869F1C78AA400005CD1B /* Resources */, - 65FB86B71C78AB3C0005CD1B /* Copy Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 65FB86A41C78AA400005CD1B /* PBXTargetDependency */, - ); - name = "ExecutionContextTests-tvOS"; + name = ExecutionContextTests; productName = ExecutionContextTests; - productReference = 65FB86A11C78AA400005CD1B /* ExecutionContextTests-tvOS.xctest */; + productReference = 65D637881C943764000F5548 /* ExecutionContextTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - 65FB86BD1C78AC260005CD1B /* ExecutionContext-watchOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 65FB86C31C78AC260005CD1B /* Build configuration list for PBXNativeTarget "ExecutionContext-watchOS" */; - buildPhases = ( - 65FB86B91C78AC260005CD1B /* Sources */, - 65FB86BA1C78AC260005CD1B /* Frameworks */, - 65FB86BB1C78AC260005CD1B /* Headers */, - 65FB86BC1C78AC260005CD1B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ExecutionContext-watchOS"; - productName = ExecutionContext; - productReference = 65FB86BE1C78AC260005CD1B /* ExecutionContext.framework */; - productType = "com.apple.product-type.framework"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 659E80751C77450200DE85B1 /* Project object */ = { + 65D637751C943763000F5548 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; LastUpgradeCheck = 0720; ORGANIZATIONNAME = "Crossroad Labs, LTD."; TargetAttributes = { - 659E807D1C77450200DE85B1 = { - CreatedOnToolsVersion = 7.2.1; - }; - 659E80871C77450200DE85B1 = { + 65D6377D1C943763000F5548 = { CreatedOnToolsVersion = 7.2.1; }; - 659E80BF1C78A47800DE85B1 = { - CreatedOnToolsVersion = 7.2.1; - }; - 659E80C81C78A47800DE85B1 = { - CreatedOnToolsVersion = 7.2.1; - }; - 65FB86971C78AA400005CD1B = { - CreatedOnToolsVersion = 7.2.1; - }; - 65FB86A01C78AA400005CD1B = { - CreatedOnToolsVersion = 7.2.1; - }; - 65FB86BD1C78AC260005CD1B = { + 65D637871C943764000F5548 = { CreatedOnToolsVersion = 7.2.1; }; }; }; - buildConfigurationList = 659E80781C77450200DE85B1 /* Build configuration list for PBXProject "ExecutionContext" */; + buildConfigurationList = 65D637781C943763000F5548 /* Build configuration list for PBXProject "ExecutionContext" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); - mainGroup = 659E80741C77450200DE85B1; - productRefGroup = 659E807F1C77450200DE85B1 /* Products */; + mainGroup = 65D637741C943763000F5548; + productRefGroup = 65D6377F1C943764000F5548 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 659E807D1C77450200DE85B1 /* ExecutionContext-OSX */, - 659E80871C77450200DE85B1 /* ExecutionContextTests-OSX */, - 659E80BF1C78A47800DE85B1 /* ExecutionContext-iOS */, - 659E80C81C78A47800DE85B1 /* ExecutionContextTests-iOS */, - 65FB86971C78AA400005CD1B /* ExecutionContext-tvOS */, - 65FB86A01C78AA400005CD1B /* ExecutionContextTests-tvOS */, - 65FB86BD1C78AC260005CD1B /* ExecutionContext-watchOS */, + 65D6377D1C943763000F5548 /* ExecutionContext */, + 65D637871C943764000F5548 /* ExecutionContextTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 659E807C1C77450200DE85B1 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80861C77450200DE85B1 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80BE1C78A47800DE85B1 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80C71C78A47800DE85B1 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86961C78AA400005CD1B /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB869F1C78AA400005CD1B /* Resources */ = { + 65D6377C1C943763000F5548 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 65FB86BC1C78AC260005CD1B /* Resources */ = { + 65D637861C943764000F5548 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -610,104 +275,39 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 659E80791C77450200DE85B1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 659E809F1C77457E00DE85B1 /* DispatchExecutionContext.swift in Sources */, - 659E80A01C77457E00DE85B1 /* ExecutionContext.swift in Sources */, - 65E646DD1C79949C0036D028 /* CustomExecutionContext.swift in Sources */, - 659E80A11C77457E00DE85B1 /* ImmediateExecutionContext.swift in Sources */, - 659E809E1C77457E00DE85B1 /* DefaultExecutionContext.swift in Sources */, - 653FF6DF1C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80841C77450200DE85B1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 659E808E1C77450200DE85B1 /* ExecutionContextTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 659E80BB1C78A47800DE85B1 /* Sources */ = { + 65D637791C943763000F5548 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 659E80D81C78A4AF00DE85B1 /* DefaultExecutionContext.swift in Sources */, - 65E646DE1C7994A00036D028 /* CustomExecutionContext.swift in Sources */, - 659E80DB1C78A4B800DE85B1 /* ImmediateExecutionContext.swift in Sources */, - 659E80D71C78A4AB00DE85B1 /* ExecutionContext.swift in Sources */, - 653FF6E01C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, - 659E80D91C78A4B200DE85B1 /* DispatchExecutionContext.swift in Sources */, + 65D637A31C9437BB000F5548 /* RunLoopExecutionContext.swift in Sources */, + 65D6379F1C9437BB000F5548 /* DefaultExecutionContext.swift in Sources */, + 65D6379E1C9437BB000F5548 /* CustomExecutionContext.swift in Sources */, + 65D637A21C9437BB000F5548 /* ImmediateExecutionContext.swift in Sources */, + 65D637A11C9437BB000F5548 /* ExecutionContext.swift in Sources */, + 65D637A01C9437BB000F5548 /* DispatchExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 659E80C51C78A47800DE85B1 /* Sources */ = { + 65D637841C943764000F5548 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 659E80DD1C78A4F000DE85B1 /* ExecutionContextTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86931C78AA400005CD1B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 65FB86B01C78AAE00005CD1B /* DefaultExecutionContext.swift in Sources */, - 65E646DF1C7994A10036D028 /* CustomExecutionContext.swift in Sources */, - 65FB86B31C78AAE50005CD1B /* ImmediateExecutionContext.swift in Sources */, - 65FB86AF1C78AADB0005CD1B /* ExecutionContext.swift in Sources */, - 653FF6E11C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, - 65FB86B11C78AAE50005CD1B /* DispatchExecutionContext.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB869D1C78AA400005CD1B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 65FB86B51C78AAEC0005CD1B /* ExecutionContextTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 65FB86B91C78AC260005CD1B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 65FB86C71C78AC8B0005CD1B /* DefaultExecutionContext.swift in Sources */, - 65E646E01C7994A20036D028 /* CustomExecutionContext.swift in Sources */, - 65FB86CA1C78AC8B0005CD1B /* ImmediateExecutionContext.swift in Sources */, - 65FB86C61C78AC8B0005CD1B /* ExecutionContext.swift in Sources */, - 653FF6E21C8EF8D900A3BF90 /* RunLoopExecutionContext.swift in Sources */, - 65FB86C81C78AC8B0005CD1B /* DispatchExecutionContext.swift in Sources */, + 65D637A51C9437F4000F5548 /* ExecutionContextTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 659E808B1C77450200DE85B1 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 659E807D1C77450200DE85B1 /* ExecutionContext-OSX */; - targetProxy = 659E808A1C77450200DE85B1 /* PBXContainerItemProxy */; - }; - 659E80CC1C78A47800DE85B1 /* PBXTargetDependency */ = { + 65D6378B1C943764000F5548 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 659E80BF1C78A47800DE85B1 /* ExecutionContext-iOS */; - targetProxy = 659E80CB1C78A47800DE85B1 /* PBXContainerItemProxy */; - }; - 65FB86A41C78AA400005CD1B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 65FB86971C78AA400005CD1B /* ExecutionContext-tvOS */; - targetProxy = 65FB86A31C78AA400005CD1B /* PBXContainerItemProxy */; + target = 65D6377D1C943763000F5548 /* ExecutionContext */; + targetProxy = 65D6378A1C943764000F5548 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 659E80901C77450200DE85B1 /* Debug */ = { + 65D637901C943764000F5548 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -744,6 +344,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /usr/local/include; + LIBRARY_SEARCH_PATHS = /usr/local/lib; MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -754,7 +356,7 @@ }; name = Debug; }; - 659E80911C77450200DE85B1 /* Release */ = { + 65D637911C943764000F5548 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -785,6 +387,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /usr/local/include; + LIBRARY_SEARCH_PATHS = /usr/local/lib; MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; @@ -793,7 +397,7 @@ }; name = Release; }; - 659E80931C77450200DE85B1 /* Debug */ = { + 65D637931C943764000F5548 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; @@ -805,25 +409,19 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", - "$(PROJECT_DIR)/Carthage/Build/iOS", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - "$(PROJECT_DIR)/Carthage/Build/watchOS", ); FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = ExecutionContext/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; + PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Carthage/Checkouts"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - 659E80941C77450200DE85B1 /* Release */ = { + 65D637941C943764000F5548 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; @@ -835,334 +433,79 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", - "$(PROJECT_DIR)/Carthage/Build/iOS", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - "$(PROJECT_DIR)/Carthage/Build/watchOS", ); FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = ExecutionContext/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; + PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Carthage/Checkouts"; }; name = Release; }; - 659E80961C77450200DE85B1 /* Debug */ = { + 65D637961C943764000F5548 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", ); - INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; + INFOPLIST_FILE = ExecutionContextTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - 659E80971C77450200DE85B1 /* Release */ = { + 65D637971C943764000F5548 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", ); - INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; + INFOPLIST_FILE = ExecutionContextTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - LIBRARY_SEARCH_PATHS = /usr/local/lib; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 659E80D21C78A47800DE85B1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - "$(PROJECT_DIR)/Carthage/Build/Mac", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - "$(PROJECT_DIR)/Carthage/Build/watchOS", - ); - INFOPLIST_FILE = ExecutionContext/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 659E80D31C78A47800DE85B1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - "$(PROJECT_DIR)/Carthage/Build/Mac", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - "$(PROJECT_DIR)/Carthage/Build/watchOS", - ); - INFOPLIST_FILE = ExecutionContext/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 659E80D51C78A47800DE85B1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 659E80D61C78A47800DE85B1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 65FB86AA1C78AA400005CD1B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - ); - INFOPLIST_FILE = ExecutionContext/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.1; - }; - name = Debug; - }; - 65FB86AB1C78AA400005CD1B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - ); - INFOPLIST_FILE = ExecutionContext/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.1; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 65FB86AD1C78AA400005CD1B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; - }; - name = Debug; - }; - 65FB86AE1C78AA400005CD1B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 65FB86C41C78AC260005CD1B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/watchOS", - ); - INFOPLIST_FILE = ExecutionContext/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; - SDKROOT = watchos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Debug; - }; - 65FB86C51C78AC260005CD1B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/watchOS", - ); - INFOPLIST_FILE = ExecutionContext/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(PROJECT_NAME)"; - SDKROOT = watchos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 4; - VALIDATE_PRODUCT = YES; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 659E80781C77450200DE85B1 /* Build configuration list for PBXProject "ExecutionContext" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 659E80901C77450200DE85B1 /* Debug */, - 659E80911C77450200DE85B1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 659E80921C77450200DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContext-OSX" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 659E80931C77450200DE85B1 /* Debug */, - 659E80941C77450200DE85B1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 659E80951C77450200DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-OSX" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 659E80961C77450200DE85B1 /* Debug */, - 659E80971C77450200DE85B1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 659E80D11C78A47800DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContext-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 659E80D21C78A47800DE85B1 /* Debug */, - 659E80D31C78A47800DE85B1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 659E80D41C78A47800DE85B1 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 659E80D51C78A47800DE85B1 /* Debug */, - 659E80D61C78A47800DE85B1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 65FB86A91C78AA400005CD1B /* Build configuration list for PBXNativeTarget "ExecutionContext-tvOS" */ = { + 65D637781C943763000F5548 /* Build configuration list for PBXProject "ExecutionContext" */ = { isa = XCConfigurationList; buildConfigurations = ( - 65FB86AA1C78AA400005CD1B /* Debug */, - 65FB86AB1C78AA400005CD1B /* Release */, + 65D637901C943764000F5548 /* Debug */, + 65D637911C943764000F5548 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 65FB86AC1C78AA400005CD1B /* Build configuration list for PBXNativeTarget "ExecutionContextTests-tvOS" */ = { + 65D637921C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContext" */ = { isa = XCConfigurationList; buildConfigurations = ( - 65FB86AD1C78AA400005CD1B /* Debug */, - 65FB86AE1C78AA400005CD1B /* Release */, + 65D637931C943764000F5548 /* Debug */, + 65D637941C943764000F5548 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; }; - 65FB86C31C78AC260005CD1B /* Build configuration list for PBXNativeTarget "ExecutionContext-watchOS" */ = { + 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 65FB86C41C78AC260005CD1B /* Debug */, - 65FB86C51C78AC260005CD1B /* Release */, + 65D637961C943764000F5548 /* Debug */, + 65D637971C943764000F5548 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 659E80751C77450200DE85B1 /* Project object */; + rootObject = 65D637751C943763000F5548 /* Project object */; } diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme deleted file mode 100644 index d4b24c5..0000000 --- a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme deleted file mode 100644 index 2084557..0000000 --- a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme deleted file mode 100644 index 03f818b..0000000 --- a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-OSX.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext.xcscheme similarity index 83% rename from ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-OSX.xcscheme rename to ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext.xcscheme index 9e8b053..3b3d3f9 100644 --- a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-OSX.xcscheme +++ b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext.xcscheme @@ -14,9 +14,9 @@ buildForAnalyzing = "YES"> @@ -32,9 +32,9 @@ skipped = "NO"> @@ -42,9 +42,9 @@ @@ -64,9 +64,9 @@ @@ -82,9 +82,9 @@ diff --git a/ExecutionContext/Info.plist b/ExecutionContext/Info.plist index 883633a..41b8b8d 100644 --- a/ExecutionContext/Info.plist +++ b/ExecutionContext/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.1 + 0.2 CFBundleSignature ???? CFBundleVersion diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/ExecutionContextTests/ExecutionContextTests.swift similarity index 97% rename from Tests/ExecutionContext/ExecutionContextTests.swift rename to ExecutionContextTests/ExecutionContextTests.swift index ebe03fe..71cfc39 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/ExecutionContextTests/ExecutionContextTests.swift @@ -81,9 +81,9 @@ class ExecutionContextTests: XCTestCase { let context:ExecutionContextType = DefaultExecutionContext(kind: .Serial) syncTest(context) -// asyncTest(context) -// afterTest(context) -// afterTestAdvanced(context) + asyncTest(context) + afterTest(context) + afterTestAdvanced(context) } func testParallel() { diff --git a/Tests/ExecutionContext/Info.plist b/ExecutionContextTests/Info.plist similarity index 100% rename from Tests/ExecutionContext/Info.plist rename to ExecutionContextTests/Info.plist diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift deleted file mode 100644 index 6217a12..0000000 --- a/Tests/LinuxMain.swift +++ /dev/null @@ -1,23 +0,0 @@ -//===--- LinuxMain.swift ---------------------------------------------------===// -//Copyright (c) 2016 Daniel Leping (dileping) -// -//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 XCTest - -@testable import ExecutionContexttest - -XCTMain([ - ExecutionContextTests(), -]) From 2d61414e075247a48f5b6c8c2260b23a5bdd80e6 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Sat, 12 Mar 2016 17:37:20 +0200 Subject: [PATCH 06/28] Some optimisations --- ExecutionContext.xcodeproj/project.pbxproj | 12 +++--------- ExecutionContext/DefaultExecutionContext.swift | 16 +++++++++++++--- ExecutionContext/DispatchExecutionContext.swift | 4 ++++ ExecutionContext/ExecutionContext.swift | 14 +++++--------- ExecutionContext/RunLoopExecutionContext.swift | 3 +++ .../ExecutionContextTests.swift | 6 +++--- 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index a68b895..92354a9 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -69,13 +69,9 @@ 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = ""; }; 65D637A81C94383C000F5548 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; - 65D637A91C94383C000F5548 /* Boilerplate.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Boilerplate.framework.dSYM; sourceTree = ""; }; 65D637AA1C94383C000F5548 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 65D637AB1C94383C000F5548 /* Result.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = Result.framework.dSYM; sourceTree = ""; }; 65D637AC1C94383C000F5548 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; - 65D637AD1C94383C000F5548 /* RunLoop.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = RunLoop.framework.dSYM; sourceTree = ""; }; 65D637AE1C94383C000F5548 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; - 65D637AF1C94383C000F5548 /* UV.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = UV.framework.dSYM; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -127,10 +123,10 @@ 65D637801C943764000F5548 /* ExecutionContext */ = { isa = PBXGroup; children = ( + 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */, 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */, 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */, 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */, - 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */, 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */, 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */, 65D637831C943764000F5548 /* Info.plist */, @@ -160,13 +156,9 @@ isa = PBXGroup; children = ( 65D637A81C94383C000F5548 /* Boilerplate.framework */, - 65D637A91C94383C000F5548 /* Boilerplate.framework.dSYM */, 65D637AA1C94383C000F5548 /* Result.framework */, - 65D637AB1C94383C000F5548 /* Result.framework.dSYM */, 65D637AC1C94383C000F5548 /* RunLoop.framework */, - 65D637AD1C94383C000F5548 /* RunLoop.framework.dSYM */, 65D637AE1C94383C000F5548 /* UV.framework */, - 65D637AF1C94383C000F5548 /* UV.framework.dSYM */, ); path = Mac; sourceTree = ""; @@ -496,6 +488,7 @@ 65D637941C943764000F5548 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests" */ = { isa = XCConfigurationList; @@ -504,6 +497,7 @@ 65D637971C943764000F5548 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/ExecutionContext/DefaultExecutionContext.swift b/ExecutionContext/DefaultExecutionContext.swift index d719e25..c720f94 100644 --- a/ExecutionContext/DefaultExecutionContext.swift +++ b/ExecutionContext/DefaultExecutionContext.swift @@ -16,13 +16,23 @@ import Foundation -#if dispatch +#if !os(Linux) || dispatch - public typealias DefaultExecutionContext = RunLoopExecutionContext + #if nouv + public typealias DefaultExecutionContext = DispatchExecutionContext + #else + public typealias DefaultExecutionContext = RunLoopExecutionContext + #endif #else - public typealias DefaultExecutionContext = RunLoopExecutionContext + #if nouv + private func error() { + let error = "You can not use 'nouv' key' without dispatch support" + } + #else + public typealias DefaultExecutionContext = RunLoopExecutionContext + #endif #endif diff --git a/ExecutionContext/DispatchExecutionContext.swift b/ExecutionContext/DispatchExecutionContext.swift index a6206de..1fd4097 100644 --- a/ExecutionContext/DispatchExecutionContext.swift +++ b/ExecutionContext/DispatchExecutionContext.swift @@ -65,6 +65,10 @@ } public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { + if isCurrent { + return try task() + } + return try loop.sync { currentContext.value = self return try task() diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index b65fb55..325d334 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -73,6 +73,10 @@ import RunLoop extension ExecutionContextType { func syncThroughAsync(task:() throws -> ReturnType) rethrows -> ReturnType { + if isCurrent { + return try task() + } + return try { var result:Result? @@ -173,12 +177,4 @@ public extension ExecutionContextType { return currentContext.value! } } -} - -/*public func sleep(timeout:Double) { - let sec = time_t(timeout) - let nsec = Int((timeout - Double(sec)) * 1000 * 1000 * 1000)//nano seconds - var time = timespec(tv_sec:sec, tv_nsec: nsec) - - nanosleep(&time, nil) -}*/ \ No newline at end of file +} \ No newline at end of file diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift index 5dde751..3449ffe 100644 --- a/ExecutionContext/RunLoopExecutionContext.swift +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -167,6 +167,9 @@ public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextTyp } public func sync(task:() throws -> ReturnType) rethrows -> ReturnType { + if self.isCurrent { + return try task() + } return try inner.sync { currentContext.value = self return try task() diff --git a/ExecutionContextTests/ExecutionContextTests.swift b/ExecutionContextTests/ExecutionContextTests.swift index 71cfc39..12b9559 100644 --- a/ExecutionContextTests/ExecutionContextTests.swift +++ b/ExecutionContextTests/ExecutionContextTests.swift @@ -113,7 +113,7 @@ class ExecutionContextTests: XCTestCase { //afterTestAdvanced - no it will not work here } -/* func testCustomOnGlobal() { + func testCustomOnGlobal() { let context = executionContext(global.execute) syncTest(context) @@ -125,11 +125,11 @@ class ExecutionContextTests: XCTestCase { func testCustomOnMain() { let context = executionContext(main.execute) - syncTest(context) +// syncTest(context) asyncTest(context) afterTest(context) //afterTestAdvanced - no it will not work here - }*/ + } func testCustomSimple() { let context = executionContext { task in From 3cd830eb968b6b7e70c73a08c7a08ee661dda402 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Sat, 12 Mar 2016 17:40:51 +0200 Subject: [PATCH 07/28] project fixes --- ExecutionContext.xcodeproj/project.pbxproj | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index 92354a9..c216ff6 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -15,18 +15,18 @@ 65D637A21C9437BB000F5548 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; 65D637A31C9437BB000F5548 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; 65D637A51C9437F4000F5548 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */; }; - 65D637B01C94383C000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637A81C94383C000F5548 /* Boilerplate.framework */; }; - 65D637B21C94383C000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AA1C94383C000F5548 /* Result.framework */; }; - 65D637B41C94383C000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AC1C94383C000F5548 /* RunLoop.framework */; }; - 65D637B61C94383C000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AE1C94383C000F5548 /* UV.framework */; }; - 65D637B81C94386C000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637A81C94383C000F5548 /* Boilerplate.framework */; }; - 65D637B91C94386C000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AA1C94383C000F5548 /* Result.framework */; }; - 65D637BA1C94386C000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AC1C94383C000F5548 /* RunLoop.framework */; }; - 65D637BB1C94386C000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AE1C94383C000F5548 /* UV.framework */; }; - 65D637BD1C943882000F5548 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637A81C94383C000F5548 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637BE1C943882000F5548 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AA1C94383C000F5548 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637BF1C943882000F5548 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AC1C94383C000F5548 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637C01C943882000F5548 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637AE1C94383C000F5548 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637CD1C946F9E000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C11C946F7C000F5548 /* Boilerplate.framework */; }; + 65D637CE1C946F9E000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C21C946F7C000F5548 /* Result.framework */; }; + 65D637CF1C946F9E000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C31C946F7C000F5548 /* RunLoop.framework */; }; + 65D637D01C946F9E000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C41C946F7C000F5548 /* UV.framework */; }; + 65D637D11C946FA5000F5548 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C11C946F7C000F5548 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637D21C946FA5000F5548 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C21C946F7C000F5548 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637D31C946FA5000F5548 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C31C946F7C000F5548 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637D41C946FA5000F5548 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C41C946F7C000F5548 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 65D637D51C946FC2000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C11C946F7C000F5548 /* Boilerplate.framework */; }; + 65D637D61C946FC2000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C21C946F7C000F5548 /* Result.framework */; }; + 65D637D71C946FC2000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C31C946F7C000F5548 /* RunLoop.framework */; }; + 65D637D81C946FC2000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C41C946F7C000F5548 /* UV.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -46,10 +46,10 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 65D637BD1C943882000F5548 /* Boilerplate.framework in Copy Frameworks */, - 65D637BE1C943882000F5548 /* Result.framework in Copy Frameworks */, - 65D637BF1C943882000F5548 /* RunLoop.framework in Copy Frameworks */, - 65D637C01C943882000F5548 /* UV.framework in Copy Frameworks */, + 65D637D11C946FA5000F5548 /* Boilerplate.framework in Copy Frameworks */, + 65D637D21C946FA5000F5548 /* Result.framework in Copy Frameworks */, + 65D637D31C946FA5000F5548 /* RunLoop.framework in Copy Frameworks */, + 65D637D41C946FA5000F5548 /* UV.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -68,10 +68,10 @@ 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateExecutionContext.swift; sourceTree = ""; }; 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = ""; }; - 65D637A81C94383C000F5548 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; - 65D637AA1C94383C000F5548 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 65D637AC1C94383C000F5548 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; - 65D637AE1C94383C000F5548 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; + 65D637C11C946F7C000F5548 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 65D637C21C946F7C000F5548 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 65D637C31C946F7C000F5548 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; + 65D637C41C946F7C000F5548 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -79,10 +79,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 65D637B41C94383C000F5548 /* RunLoop.framework in Frameworks */, - 65D637B01C94383C000F5548 /* Boilerplate.framework in Frameworks */, - 65D637B21C94383C000F5548 /* Result.framework in Frameworks */, - 65D637B61C94383C000F5548 /* UV.framework in Frameworks */, + 65D637D51C946FC2000F5548 /* Boilerplate.framework in Frameworks */, + 65D637D61C946FC2000F5548 /* Result.framework in Frameworks */, + 65D637D71C946FC2000F5548 /* RunLoop.framework in Frameworks */, + 65D637D81C946FC2000F5548 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -91,10 +91,10 @@ buildActionMask = 2147483647; files = ( 65D637891C943764000F5548 /* ExecutionContext.framework in Frameworks */, - 65D637B81C94386C000F5548 /* Boilerplate.framework in Frameworks */, - 65D637B91C94386C000F5548 /* Result.framework in Frameworks */, - 65D637BA1C94386C000F5548 /* RunLoop.framework in Frameworks */, - 65D637BB1C94386C000F5548 /* UV.framework in Frameworks */, + 65D637CD1C946F9E000F5548 /* Boilerplate.framework in Frameworks */, + 65D637CE1C946F9E000F5548 /* Result.framework in Frameworks */, + 65D637CF1C946F9E000F5548 /* RunLoop.framework in Frameworks */, + 65D637D01C946F9E000F5548 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -155,10 +155,10 @@ 65D637A71C94383C000F5548 /* Mac */ = { isa = PBXGroup; children = ( - 65D637A81C94383C000F5548 /* Boilerplate.framework */, - 65D637AA1C94383C000F5548 /* Result.framework */, - 65D637AC1C94383C000F5548 /* RunLoop.framework */, - 65D637AE1C94383C000F5548 /* UV.framework */, + 65D637C11C946F7C000F5548 /* Boilerplate.framework */, + 65D637C21C946F7C000F5548 /* Result.framework */, + 65D637C31C946F7C000F5548 /* RunLoop.framework */, + 65D637C41C946F7C000F5548 /* UV.framework */, ); path = Mac; sourceTree = ""; From 396f09313fa8ed38164e1f10daad8a5c41992250 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Mon, 11 Apr 2016 15:36:29 +0300 Subject: [PATCH 08/28] correct dependencies --- Cartfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cartfile b/Cartfile index 5aa2c05..9e0a2c6 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "crossroadlabs/Result" ~> 1.0 -github "crossroadlabs/RunLoop" "feature-relay-2" +github "crossroadlabs/Result" ~> 2.0 +github "crossroadlabs/RunLoop" "master" From 56f871b876fcde73610cdcce7072b8e339255166 Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 13:30:26 +0300 Subject: [PATCH 09/28] Linux, project structure, Cartfile, small fixes --- Cartfile | 3 +- Cartfile.private | 1 + ExecutionContext.xcodeproj/project.pbxproj | 397 +++++++++++++++--- ...xcscheme => ExecutionContext-OSX.xcscheme} | 12 +- .../DispatchExecutionContext.swift | 4 +- .../RunLoopExecutionContext.swift | 1 - Package.swift | 13 +- .../ExecutionContextTests.swift | 44 +- .../ExecutionContext}/Info.plist | 0 Tests/LinuxMain.swift | 7 + 10 files changed, 395 insertions(+), 87 deletions(-) create mode 100644 Cartfile.private rename ExecutionContext.xcodeproj/xcshareddata/xcschemes/{ExecutionContext.xcscheme => ExecutionContext-OSX.xcscheme} (91%) rename {ExecutionContextTests => Tests/ExecutionContext}/ExecutionContextTests.swift (80%) rename {ExecutionContextTests => Tests/ExecutionContext}/Info.plist (100%) create mode 100644 Tests/LinuxMain.swift diff --git a/Cartfile b/Cartfile index 9e0a2c6..5fb2263 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,3 @@ -github "crossroadlabs/Result" ~> 2.0 +github "antitypical/Result" ~> 2.0 +github "crossroadlabs/Boilerplate" ~> 0.1 github "crossroadlabs/RunLoop" "master" diff --git a/Cartfile.private b/Cartfile.private new file mode 100644 index 0000000..b9072c0 --- /dev/null +++ b/Cartfile.private @@ -0,0 +1 @@ +github "crossroadlabs/XCTest3" ~> 0.1 diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index c216ff6..71faf80 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -15,18 +15,41 @@ 65D637A21C9437BB000F5548 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; 65D637A31C9437BB000F5548 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; 65D637A51C9437F4000F5548 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */; }; - 65D637CD1C946F9E000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C11C946F7C000F5548 /* Boilerplate.framework */; }; - 65D637CE1C946F9E000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C21C946F7C000F5548 /* Result.framework */; }; - 65D637CF1C946F9E000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C31C946F7C000F5548 /* RunLoop.framework */; }; - 65D637D01C946F9E000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C41C946F7C000F5548 /* UV.framework */; }; - 65D637D11C946FA5000F5548 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C11C946F7C000F5548 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637D21C946FA5000F5548 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C21C946F7C000F5548 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637D31C946FA5000F5548 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C31C946F7C000F5548 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637D41C946FA5000F5548 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C41C946F7C000F5548 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 65D637D51C946FC2000F5548 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C11C946F7C000F5548 /* Boilerplate.framework */; }; - 65D637D61C946FC2000F5548 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C21C946F7C000F5548 /* Result.framework */; }; - 65D637D71C946FC2000F5548 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C31C946F7C000F5548 /* RunLoop.framework */; }; - 65D637D81C946FC2000F5548 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D637C41C946F7C000F5548 /* UV.framework */; }; + 92E4091A1CBC32F2001ED069 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409101CBC32F2001ED069 /* ExecutionContext.framework */; }; + 92E409271CBC3369001ED069 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */; }; + 92E409281CBC336D001ED069 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */; }; + 92E409291CBC3371001ED069 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */; }; + 92E4092A1CBC3374001ED069 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */; }; + 92E4092B1CBC3378001ED069 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; + 92E4092C1CBC337B001ED069 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; + 92E409361CBC3427001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */; }; + 92E409371CBC3427001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092F1CBC33F9001ED069 /* Foundation3.framework */; }; + 92E409381CBC3427001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409301CBC33F9001ED069 /* Result.framework */; }; + 92E4093A1CBC3428001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */; }; + 92E4093B1CBC3428001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092F1CBC33F9001ED069 /* Foundation3.framework */; }; + 92E4093C1CBC3428001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409301CBC33F9001ED069 /* Result.framework */; }; + 92E4093D1CBC3428001ED069 /* XCTest3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409311CBC33F9001ED069 /* XCTest3.framework */; }; + 92E409441CBC344D001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4093E1CBC344D001ED069 /* Boilerplate.framework */; }; + 92E409451CBC344D001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4093F1CBC344D001ED069 /* Foundation3.framework */; }; + 92E409461CBC344D001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409401CBC344D001ED069 /* Result.framework */; }; + 92E409471CBC344D001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409411CBC344D001ED069 /* RunLoop.framework */; }; + 92E409481CBC344D001ED069 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409421CBC344D001ED069 /* UV.framework */; }; + 92E4094A1CBC3455001ED069 /* XCTest3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409431CBC344D001ED069 /* XCTest3.framework */; }; + 92E4094B1CBC345A001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4093E1CBC344D001ED069 /* Boilerplate.framework */; }; + 92E4094C1CBC345A001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4093F1CBC344D001ED069 /* Foundation3.framework */; }; + 92E4094D1CBC345A001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409401CBC344D001ED069 /* Result.framework */; }; + 92E4094E1CBC345A001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409411CBC344D001ED069 /* RunLoop.framework */; }; + 92E4094F1CBC345A001ED069 /* UV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409421CBC344D001ED069 /* UV.framework */; }; + 92E409501CBC3474001ED069 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4093E1CBC344D001ED069 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409511CBC3474001ED069 /* Foundation3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4093F1CBC344D001ED069 /* Foundation3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409521CBC3474001ED069 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409401CBC344D001ED069 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409531CBC3474001ED069 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409411CBC344D001ED069 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409541CBC3474001ED069 /* UV.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409421CBC344D001ED069 /* UV.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409551CBC3474001ED069 /* XCTest3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409431CBC344D001ED069 /* XCTest3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409571CBC3495001ED069 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409581CBC3495001ED069 /* Foundation3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092F1CBC33F9001ED069 /* Foundation3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409591CBC3495001ED069 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409301CBC33F9001ED069 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E4095A1CBC3495001ED069 /* XCTest3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409311CBC33F9001ED069 /* XCTest3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -37,6 +60,13 @@ remoteGlobalIDString = 65D6377D1C943763000F5548; remoteInfo = ExecutionContext; }; + 92E4091B1CBC32F2001ED069 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65D637751C943763000F5548 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 92E4090F1CBC32F2001ED069; + remoteInfo = "ExecutionContext-iOS"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -46,10 +76,26 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 65D637D11C946FA5000F5548 /* Boilerplate.framework in Copy Frameworks */, - 65D637D21C946FA5000F5548 /* Result.framework in Copy Frameworks */, - 65D637D31C946FA5000F5548 /* RunLoop.framework in Copy Frameworks */, - 65D637D41C946FA5000F5548 /* UV.framework in Copy Frameworks */, + 92E409501CBC3474001ED069 /* Boilerplate.framework in Copy Frameworks */, + 92E409511CBC3474001ED069 /* Foundation3.framework in Copy Frameworks */, + 92E409521CBC3474001ED069 /* Result.framework in Copy Frameworks */, + 92E409531CBC3474001ED069 /* RunLoop.framework in Copy Frameworks */, + 92E409541CBC3474001ED069 /* UV.framework in Copy Frameworks */, + 92E409551CBC3474001ED069 /* XCTest3.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409561CBC3485001ED069 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 92E409571CBC3495001ED069 /* Boilerplate.framework in Copy Frameworks */, + 92E409581CBC3495001ED069 /* Foundation3.framework in Copy Frameworks */, + 92E409591CBC3495001ED069 /* Result.framework in Copy Frameworks */, + 92E4095A1CBC3495001ED069 /* XCTest3.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -59,7 +105,7 @@ /* Begin PBXFileReference section */ 65D6377E1C943764000F5548 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 65D637831C943764000F5548 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 65D637881C943764000F5548 /* ExecutionContextTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExecutionContextTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 65D637881C943764000F5548 /* ExecutionContextTests-OSX.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-OSX.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 65D6378F1C943764000F5548 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomExecutionContext.swift; sourceTree = ""; }; 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultExecutionContext.swift; sourceTree = ""; }; @@ -68,10 +114,18 @@ 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateExecutionContext.swift; sourceTree = ""; }; 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = ""; }; - 65D637C11C946F7C000F5548 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; - 65D637C21C946F7C000F5548 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - 65D637C31C946F7C000F5548 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; - 65D637C41C946F7C000F5548 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; + 92E409101CBC32F2001ED069 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 92E4092F1CBC33F9001ED069 /* Foundation3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Foundation3.framework; sourceTree = ""; }; + 92E409301CBC33F9001ED069 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 92E409311CBC33F9001ED069 /* XCTest3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XCTest3.framework; sourceTree = ""; }; + 92E4093E1CBC344D001ED069 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 92E4093F1CBC344D001ED069 /* Foundation3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Foundation3.framework; sourceTree = ""; }; + 92E409401CBC344D001ED069 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 92E409411CBC344D001ED069 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; + 92E409421CBC344D001ED069 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; + 92E409431CBC344D001ED069 /* XCTest3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XCTest3.framework; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -79,10 +133,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 65D637D51C946FC2000F5548 /* Boilerplate.framework in Frameworks */, - 65D637D61C946FC2000F5548 /* Result.framework in Frameworks */, - 65D637D71C946FC2000F5548 /* RunLoop.framework in Frameworks */, - 65D637D81C946FC2000F5548 /* UV.framework in Frameworks */, + 92E409471CBC344D001ED069 /* RunLoop.framework in Frameworks */, + 92E409461CBC344D001ED069 /* Result.framework in Frameworks */, + 92E409441CBC344D001ED069 /* Boilerplate.framework in Frameworks */, + 92E409451CBC344D001ED069 /* Foundation3.framework in Frameworks */, + 92E409481CBC344D001ED069 /* UV.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -90,11 +145,35 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 92E4094F1CBC345A001ED069 /* UV.framework in Frameworks */, + 92E4094E1CBC345A001ED069 /* RunLoop.framework in Frameworks */, 65D637891C943764000F5548 /* ExecutionContext.framework in Frameworks */, - 65D637CD1C946F9E000F5548 /* Boilerplate.framework in Frameworks */, - 65D637CE1C946F9E000F5548 /* Result.framework in Frameworks */, - 65D637CF1C946F9E000F5548 /* RunLoop.framework in Frameworks */, - 65D637D01C946F9E000F5548 /* UV.framework in Frameworks */, + 92E4094B1CBC345A001ED069 /* Boilerplate.framework in Frameworks */, + 92E4094D1CBC345A001ED069 /* Result.framework in Frameworks */, + 92E4094A1CBC3455001ED069 /* XCTest3.framework in Frameworks */, + 92E4094C1CBC345A001ED069 /* Foundation3.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E4090C1CBC32F2001ED069 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E409381CBC3427001ED069 /* Result.framework in Frameworks */, + 92E409361CBC3427001ED069 /* Boilerplate.framework in Frameworks */, + 92E409371CBC3427001ED069 /* Foundation3.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409161CBC32F2001ED069 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E4093B1CBC3428001ED069 /* Foundation3.framework in Frameworks */, + 92E4093D1CBC3428001ED069 /* XCTest3.framework in Frameworks */, + 92E4093A1CBC3428001ED069 /* Boilerplate.framework in Frameworks */, + 92E4091A1CBC32F2001ED069 /* ExecutionContext.framework in Frameworks */, + 92E4093C1CBC3428001ED069 /* Result.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -115,7 +194,9 @@ isa = PBXGroup; children = ( 65D6377E1C943764000F5548 /* ExecutionContext.framework */, - 65D637881C943764000F5548 /* ExecutionContextTests.xctest */, + 65D637881C943764000F5548 /* ExecutionContextTests-OSX.xctest */, + 92E409101CBC32F2001ED069 /* ExecutionContext.framework */, + 92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */, ); name = Products; sourceTree = ""; @@ -140,12 +221,14 @@ 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */, 65D6378F1C943764000F5548 /* Info.plist */, ); - path = ExecutionContextTests; + name = ExecutionContextTests; + path = Tests/ExecutionContext; sourceTree = ""; }; 65D637A61C94383C000F5548 /* Frameworks */ = { isa = PBXGroup; children = ( + 92E4092D1CBC33DC001ED069 /* iOS */, 65D637A71C94383C000F5548 /* Mac */, ); name = Frameworks; @@ -155,14 +238,27 @@ 65D637A71C94383C000F5548 /* Mac */ = { isa = PBXGroup; children = ( - 65D637C11C946F7C000F5548 /* Boilerplate.framework */, - 65D637C21C946F7C000F5548 /* Result.framework */, - 65D637C31C946F7C000F5548 /* RunLoop.framework */, - 65D637C41C946F7C000F5548 /* UV.framework */, + 92E4093E1CBC344D001ED069 /* Boilerplate.framework */, + 92E4093F1CBC344D001ED069 /* Foundation3.framework */, + 92E409401CBC344D001ED069 /* Result.framework */, + 92E409411CBC344D001ED069 /* RunLoop.framework */, + 92E409421CBC344D001ED069 /* UV.framework */, + 92E409431CBC344D001ED069 /* XCTest3.framework */, ); path = Mac; sourceTree = ""; }; + 92E4092D1CBC33DC001ED069 /* iOS */ = { + isa = PBXGroup; + children = ( + 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */, + 92E4092F1CBC33F9001ED069 /* Foundation3.framework */, + 92E409301CBC33F9001ED069 /* Result.framework */, + 92E409311CBC33F9001ED069 /* XCTest3.framework */, + ); + path = iOS; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -173,12 +269,19 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 92E4090D1CBC32F2001ED069 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 65D6377D1C943763000F5548 /* ExecutionContext */ = { + 65D6377D1C943763000F5548 /* ExecutionContext-OSX */ = { isa = PBXNativeTarget; - buildConfigurationList = 65D637921C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContext" */; + buildConfigurationList = 65D637921C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContext-OSX" */; buildPhases = ( 65D637791C943763000F5548 /* Sources */, 65D6377A1C943763000F5548 /* Frameworks */, @@ -189,14 +292,14 @@ ); dependencies = ( ); - name = ExecutionContext; + name = "ExecutionContext-OSX"; productName = ExecutionContext; productReference = 65D6377E1C943764000F5548 /* ExecutionContext.framework */; productType = "com.apple.product-type.framework"; }; - 65D637871C943764000F5548 /* ExecutionContextTests */ = { + 65D637871C943764000F5548 /* ExecutionContextTests-OSX */ = { isa = PBXNativeTarget; - buildConfigurationList = 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests" */; + buildConfigurationList = 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-OSX" */; buildPhases = ( 65D637841C943764000F5548 /* Sources */, 65D637851C943764000F5548 /* Frameworks */, @@ -208,9 +311,46 @@ dependencies = ( 65D6378B1C943764000F5548 /* PBXTargetDependency */, ); - name = ExecutionContextTests; + name = "ExecutionContextTests-OSX"; productName = ExecutionContextTests; - productReference = 65D637881C943764000F5548 /* ExecutionContextTests.xctest */; + productReference = 65D637881C943764000F5548 /* ExecutionContextTests-OSX.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 92E4090F1CBC32F2001ED069 /* ExecutionContext-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 92E409211CBC32F2001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-iOS" */; + buildPhases = ( + 92E4090B1CBC32F2001ED069 /* Sources */, + 92E4090C1CBC32F2001ED069 /* Frameworks */, + 92E4090D1CBC32F2001ED069 /* Headers */, + 92E4090E1CBC32F2001ED069 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ExecutionContext-iOS"; + productName = "ExecutionContext-iOS"; + productReference = 92E409101CBC32F2001ED069 /* ExecutionContext.framework */; + productType = "com.apple.product-type.framework"; + }; + 92E409181CBC32F2001ED069 /* ExecutionContextTests-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 92E409241CBC32F2001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-iOS" */; + buildPhases = ( + 92E409151CBC32F2001ED069 /* Sources */, + 92E409161CBC32F2001ED069 /* Frameworks */, + 92E409171CBC32F2001ED069 /* Resources */, + 92E409561CBC3485001ED069 /* Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 92E4091C1CBC32F2001ED069 /* PBXTargetDependency */, + ); + name = "ExecutionContextTests-iOS"; + productName = "ExecutionContext-iOSTests"; + productReference = 92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -219,7 +359,7 @@ 65D637751C943763000F5548 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0720; + LastSwiftUpdateCheck = 0730; LastUpgradeCheck = 0720; ORGANIZATIONNAME = "Crossroad Labs, LTD."; TargetAttributes = { @@ -229,6 +369,12 @@ 65D637871C943764000F5548 = { CreatedOnToolsVersion = 7.2.1; }; + 92E4090F1CBC32F2001ED069 = { + CreatedOnToolsVersion = 7.3; + }; + 92E409181CBC32F2001ED069 = { + CreatedOnToolsVersion = 7.3; + }; }; }; buildConfigurationList = 65D637781C943763000F5548 /* Build configuration list for PBXProject "ExecutionContext" */; @@ -243,8 +389,10 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 65D6377D1C943763000F5548 /* ExecutionContext */, - 65D637871C943764000F5548 /* ExecutionContextTests */, + 65D6377D1C943763000F5548 /* ExecutionContext-OSX */, + 65D637871C943764000F5548 /* ExecutionContextTests-OSX */, + 92E4090F1CBC32F2001ED069 /* ExecutionContext-iOS */, + 92E409181CBC32F2001ED069 /* ExecutionContextTests-iOS */, ); }; /* End PBXProject section */ @@ -264,6 +412,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 92E4090E1CBC32F2001ED069 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409171CBC32F2001ED069 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -288,14 +450,39 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 92E4090B1CBC32F2001ED069 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E4092C1CBC337B001ED069 /* RunLoopExecutionContext.swift in Sources */, + 92E409271CBC3369001ED069 /* ExecutionContext.swift in Sources */, + 92E409291CBC3371001ED069 /* DefaultExecutionContext.swift in Sources */, + 92E4092B1CBC3378001ED069 /* ImmediateExecutionContext.swift in Sources */, + 92E4092A1CBC3374001ED069 /* DispatchExecutionContext.swift in Sources */, + 92E409281CBC336D001ED069 /* CustomExecutionContext.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409151CBC32F2001ED069 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 65D6378B1C943764000F5548 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 65D6377D1C943763000F5548 /* ExecutionContext */; + target = 65D6377D1C943763000F5548 /* ExecutionContext-OSX */; targetProxy = 65D6378A1C943764000F5548 /* PBXContainerItemProxy */; }; + 92E4091C1CBC32F2001ED069 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 92E4090F1CBC32F2001ED069 /* ExecutionContext-iOS */; + targetProxy = 92E4091B1CBC32F2001ED069 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -401,13 +588,14 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); FRAMEWORK_VERSION = A; INFOPLIST_FILE = ExecutionContext/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; @@ -425,13 +613,14 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); FRAMEWORK_VERSION = A; INFOPLIST_FILE = ExecutionContext/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; }; name = Release; @@ -445,7 +634,7 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", ); - INFOPLIST_FILE = ExecutionContextTests/Info.plist; + INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -462,13 +651,101 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", ); - INFOPLIST_FILE = ExecutionContextTests/Info.plist; + INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; + 92E409221CBC32F2001ED069 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = ExecutionContext/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; + PRODUCT_NAME = "$(PROJECT_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 92E409231CBC32F2001ED069 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = ExecutionContext/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; + PRODUCT_NAME = "$(PROJECT_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 92E409251CBC32F2001ED069 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "xyz.crossroadlabs.ExecutionContextTests-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 92E409261CBC32F2001ED069 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "xyz.crossroadlabs.ExecutionContextTests-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -481,7 +758,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 65D637921C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContext" */ = { + 65D637921C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContext-OSX" */ = { isa = XCConfigurationList; buildConfigurations = ( 65D637931C943764000F5548 /* Debug */, @@ -490,7 +767,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests" */ = { + 65D637951C943764000F5548 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-OSX" */ = { isa = XCConfigurationList; buildConfigurations = ( 65D637961C943764000F5548 /* Debug */, @@ -499,6 +776,22 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 92E409211CBC32F2001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 92E409221CBC32F2001ED069 /* Debug */, + 92E409231CBC32F2001ED069 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 92E409241CBC32F2001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 92E409251CBC32F2001ED069 /* Debug */, + 92E409261CBC32F2001ED069 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; /* End XCConfigurationList section */ }; rootObject = 65D637751C943763000F5548 /* Project object */; diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-OSX.xcscheme similarity index 91% rename from ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext.xcscheme rename to ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-OSX.xcscheme index 3b3d3f9..6b71ed9 100644 --- a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext.xcscheme +++ b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-OSX.xcscheme @@ -16,7 +16,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "65D6377D1C943763000F5548" BuildableName = "ExecutionContext.framework" - BlueprintName = "ExecutionContext" + BlueprintName = "ExecutionContext-OSX" ReferencedContainer = "container:ExecutionContext.xcodeproj"> @@ -33,8 +33,8 @@ @@ -44,7 +44,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "65D6377D1C943763000F5548" BuildableName = "ExecutionContext.framework" - BlueprintName = "ExecutionContext" + BlueprintName = "ExecutionContext-OSX" ReferencedContainer = "container:ExecutionContext.xcodeproj"> @@ -66,7 +66,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "65D6377D1C943763000F5548" BuildableName = "ExecutionContext.framework" - BlueprintName = "ExecutionContext" + BlueprintName = "ExecutionContext-OSX" ReferencedContainer = "container:ExecutionContext.xcodeproj"> @@ -84,7 +84,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "65D6377D1C943763000F5548" BuildableName = "ExecutionContext.framework" - BlueprintName = "ExecutionContext" + BlueprintName = "ExecutionContext-OSX" ReferencedContainer = "container:ExecutionContext.xcodeproj"> diff --git a/ExecutionContext/DispatchExecutionContext.swift b/ExecutionContext/DispatchExecutionContext.swift index 1fd4097..1c799f2 100644 --- a/ExecutionContext/DispatchExecutionContext.swift +++ b/ExecutionContext/DispatchExecutionContext.swift @@ -17,8 +17,8 @@ #if !os(Linux) || dispatch import Foundation + import Foundation3 import Dispatch - import Result import Boilerplate import RunLoop @@ -37,7 +37,7 @@ private let loop:DispatchRunLoop public required convenience init(kind:ExecutionContextKind) { - let id = NSUUID().UUIDString + let id = NSUUID().uuidString let queue = kind.createDispatchQueue(id) self.init(queue: queue) } diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift index 3449ffe..2df6b0d 100644 --- a/ExecutionContext/RunLoopExecutionContext.swift +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -15,7 +15,6 @@ //===----------------------------------------------------------------------===// import Foundation -import Result import Boilerplate import RunLoop diff --git a/Package.swift b/Package.swift index a81e482..efea85d 100644 --- a/Package.swift +++ b/Package.swift @@ -18,10 +18,11 @@ import PackageDescription let package = Package( name: "ExecutionContext", - targets: [ - Target( - name: "ExecutionContext" - ), - ], - dependencies: [.Package(url: "https://github.com/crossroadlabs/Result.git", majorVersion: 1)] + targets: [Target(name: "ExecutionContext")], + dependencies: [ + .Package(url: "https://github.com/antitypical/Result.git", majorVersion: 2), + .Package(url: "https://github.com/crossroadlabs/Boilerplate.git", majorVersion: 0, minor: 1), + .Package(url: "https://github.com/crossroadlabs/XCTest3.git", majorVersion: 0, minor: 1), + .Package(url: "https://github.com/crossroadlabs/RunLoop.git", majorVersion: 0, minor: 1), + ] ) diff --git a/ExecutionContextTests/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift similarity index 80% rename from ExecutionContextTests/ExecutionContextTests.swift rename to Tests/ExecutionContext/ExecutionContextTests.swift index 12b9559..54c9de9 100644 --- a/ExecutionContextTests/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -17,6 +17,10 @@ import XCTest @testable import ExecutionContext +#if !os(tvOS) + import XCTest3 +#endif + #if os(Linux) import Glibc #endif @@ -24,41 +28,42 @@ import XCTest import Boilerplate import RunLoop +#if !os(tvOS) class ExecutionContextTests: XCTestCase { //Tests does not create static variables. We need initialized main thread //let mainContext = DefaultExecutionContext.main func syncTest(context:ExecutionContextType) { - let expectation = self.expectationWithDescription("OK SYNC") + let expectation = self.expectation(withDescription: "OK SYNC") context.sync { expectation.fulfill() } - self.waitForExpectationsWithTimeout(0, handler: nil) + self.waitForExpectations(withTimeout: 0, handler: nil) } func asyncTest(context:ExecutionContextType) { RunLoop.current - let expectation = self.expectationWithDescription("OK ASYNC") + let expectation = self.expectation(withDescription: "OK ASYNC") context.async { Thread.sleep(1) expectation.fulfill() } - self.waitForExpectationsWithTimeout(2, handler: nil) + self.waitForExpectations(withTimeout: 2, handler: nil) } func afterTest(context:ExecutionContextType) { - let expectation = self.expectationWithDescription("OK AFTER") + let expectation = self.expectation(withDescription: "OK AFTER") context.async(0.5) { expectation.fulfill() } - self.waitForExpectationsWithTimeout(3, handler: nil) + self.waitForExpectations(withTimeout: 3, handler: nil) } func afterTestAdvanced(context:ExecutionContextType) { @@ -142,19 +147,20 @@ class ExecutionContextTests: XCTestCase { //afterTestAdvanced - no it will not work here } } +#endif #if os(Linux) -extension ExecutionContextTests : XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { - return [ - ("testSerial", testSerial), - ("testParallel", testParallel), - ("testGlobal", testGlobal), - ("testMain", testMain), - ("testCustomOnGlobal", testCustomOnGlobal), - ("testCustomOnMain", testCustomOnMain), - ("testCustomSimple", testCustomSimple) - ] - } +extension ExecutionContextTests { + static var allTests : [(String, ExecutionContextTests -> () throws -> Void)] { + return [ + ("testSerial", testSerial), + ("testParallel", testParallel), + ("testGlobal", testGlobal), + ("testMain", testMain), + ("testCustomOnGlobal", testCustomOnGlobal), + ("testCustomOnMain", testCustomOnMain), + ("testCustomSimple", testCustomSimple), + ] + } } -#endif \ No newline at end of file +#endif diff --git a/ExecutionContextTests/Info.plist b/Tests/ExecutionContext/Info.plist similarity index 100% rename from ExecutionContextTests/Info.plist rename to Tests/ExecutionContext/Info.plist diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..4783876 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +@testable import ExecutionContextTestSuite + +XCTMain([ + testCase(ExecutionContextTests.allTests), +]) \ No newline at end of file From 8e26345bc981edbb058e5736c00c5817e7544e7a Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 14:32:41 +0300 Subject: [PATCH 10/28] Fixed project settings for all platforms --- ExecutionContext.xcodeproj/project.pbxproj | 435 ++++++++++++++++++ .../xcschemes/ExecutionContext-iOS.xcscheme | 99 ++++ .../xcschemes/ExecutionContext-tvOS.xcscheme | 99 ++++ .../ExecutionContext-watchOS.xcscheme | 80 ++++ ExecutionContext/CustomExecutionContext.swift | 3 +- .../RunLoopExecutionContext.swift | 2 +- 6 files changed, 716 insertions(+), 2 deletions(-) create mode 100644 ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme create mode 100644 ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme create mode 100644 ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index 71faf80..184c0fb 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -50,6 +50,40 @@ 92E409581CBC3495001ED069 /* Foundation3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E4092F1CBC33F9001ED069 /* Foundation3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 92E409591CBC3495001ED069 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409301CBC33F9001ED069 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 92E4095A1CBC3495001ED069 /* XCTest3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409311CBC33F9001ED069 /* XCTest3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E409F01CC10545001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409EE1CC10541001ED069 /* RunLoop.framework */; }; + 92E409F11CC10546001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409EE1CC10541001ED069 /* RunLoop.framework */; }; + 92E409F21CC10552001ED069 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409EE1CC10541001ED069 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E40A021CC10677001ED069 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409F81CC10677001ED069 /* ExecutionContext.framework */; }; + 92E40A0F1CC10713001ED069 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */; }; + 92E40A101CC10713001ED069 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */; }; + 92E40A111CC10713001ED069 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */; }; + 92E40A121CC10713001ED069 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */; }; + 92E40A131CC10713001ED069 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; + 92E40A141CC10713001ED069 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; + 92E40A151CC10717001ED069 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */; }; + 92E40A161CC10718001ED069 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */; }; + 92E40A1C1CC10761001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A181CC10761001ED069 /* Boilerplate.framework */; }; + 92E40A1D1CC10761001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A181CC10761001ED069 /* Boilerplate.framework */; }; + 92E40A1E1CC10761001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A191CC10761001ED069 /* Foundation3.framework */; }; + 92E40A1F1CC10761001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A191CC10761001ED069 /* Foundation3.framework */; }; + 92E40A201CC10761001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A1A1CC10761001ED069 /* Result.framework */; }; + 92E40A211CC10761001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A1A1CC10761001ED069 /* Result.framework */; }; + 92E40A221CC10761001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A1B1CC10761001ED069 /* RunLoop.framework */; }; + 92E40A231CC10761001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A1B1CC10761001ED069 /* RunLoop.framework */; }; + 92E40A251CC1079D001ED069 /* Boilerplate.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A181CC10761001ED069 /* Boilerplate.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E40A261CC1079D001ED069 /* Foundation3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A191CC10761001ED069 /* Foundation3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E40A271CC1079D001ED069 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A1A1CC10761001ED069 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E40A281CC1079D001ED069 /* RunLoop.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A1B1CC10761001ED069 /* RunLoop.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 92E40A361CC10816001ED069 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */; }; + 92E40A371CC10816001ED069 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */; }; + 92E40A381CC10816001ED069 /* DefaultExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637991C9437BB000F5548 /* DefaultExecutionContext.swift */; }; + 92E40A391CC10816001ED069 /* DispatchExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */; }; + 92E40A3A1CC10816001ED069 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; + 92E40A3B1CC10816001ED069 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; + 92E40A411CC10895001ED069 /* Boilerplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A3D1CC10895001ED069 /* Boilerplate.framework */; }; + 92E40A421CC10895001ED069 /* Foundation3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A3E1CC10895001ED069 /* Foundation3.framework */; }; + 92E40A431CC10895001ED069 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A3F1CC10895001ED069 /* Result.framework */; }; + 92E40A441CC10895001ED069 /* RunLoop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E40A401CC10895001ED069 /* RunLoop.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -67,6 +101,13 @@ remoteGlobalIDString = 92E4090F1CBC32F2001ED069; remoteInfo = "ExecutionContext-iOS"; }; + 92E40A031CC10677001ED069 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65D637751C943763000F5548 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 92E409F71CC10677001ED069; + remoteInfo = ExecutionContext; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -95,11 +136,26 @@ 92E409571CBC3495001ED069 /* Boilerplate.framework in Copy Frameworks */, 92E409581CBC3495001ED069 /* Foundation3.framework in Copy Frameworks */, 92E409591CBC3495001ED069 /* Result.framework in Copy Frameworks */, + 92E409F21CC10552001ED069 /* RunLoop.framework in Copy Frameworks */, 92E4095A1CBC3495001ED069 /* XCTest3.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; + 92E40A241CC1078D001ED069 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 92E40A251CC1079D001ED069 /* Boilerplate.framework in Copy Frameworks */, + 92E40A261CC1079D001ED069 /* Foundation3.framework in Copy Frameworks */, + 92E40A271CC1079D001ED069 /* Result.framework in Copy Frameworks */, + 92E40A281CC1079D001ED069 /* RunLoop.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -126,6 +182,18 @@ 92E409411CBC344D001ED069 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; 92E409421CBC344D001ED069 /* UV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UV.framework; sourceTree = ""; }; 92E409431CBC344D001ED069 /* XCTest3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XCTest3.framework; sourceTree = ""; }; + 92E409EE1CC10541001ED069 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; + 92E409F81CC10677001ED069 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 92E40A011CC10677001ED069 /* ExecutionContextTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 92E40A181CC10761001ED069 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 92E40A191CC10761001ED069 /* Foundation3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Foundation3.framework; sourceTree = ""; }; + 92E40A1A1CC10761001ED069 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 92E40A1B1CC10761001ED069 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; + 92E40A2E1CC107D0001ED069 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 92E40A3D1CC10895001ED069 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; + 92E40A3E1CC10895001ED069 /* Foundation3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Foundation3.framework; sourceTree = ""; }; + 92E40A3F1CC10895001ED069 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; + 92E40A401CC10895001ED069 /* RunLoop.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RunLoop.framework; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -159,6 +227,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 92E409F01CC10545001ED069 /* RunLoop.framework in Frameworks */, 92E409381CBC3427001ED069 /* Result.framework in Frameworks */, 92E409361CBC3427001ED069 /* Boilerplate.framework in Frameworks */, 92E409371CBC3427001ED069 /* Foundation3.framework in Frameworks */, @@ -169,6 +238,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 92E409F11CC10546001ED069 /* RunLoop.framework in Frameworks */, 92E4093B1CBC3428001ED069 /* Foundation3.framework in Frameworks */, 92E4093D1CBC3428001ED069 /* XCTest3.framework in Frameworks */, 92E4093A1CBC3428001ED069 /* Boilerplate.framework in Frameworks */, @@ -177,6 +247,40 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 92E409F41CC10677001ED069 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E40A221CC10761001ED069 /* RunLoop.framework in Frameworks */, + 92E40A201CC10761001ED069 /* Result.framework in Frameworks */, + 92E40A1C1CC10761001ED069 /* Boilerplate.framework in Frameworks */, + 92E40A1E1CC10761001ED069 /* Foundation3.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409FE1CC10677001ED069 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E40A1F1CC10761001ED069 /* Foundation3.framework in Frameworks */, + 92E40A1D1CC10761001ED069 /* Boilerplate.framework in Frameworks */, + 92E40A231CC10761001ED069 /* RunLoop.framework in Frameworks */, + 92E40A021CC10677001ED069 /* ExecutionContext.framework in Frameworks */, + 92E40A211CC10761001ED069 /* Result.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E40A2A1CC107D0001ED069 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E40A441CC10895001ED069 /* RunLoop.framework in Frameworks */, + 92E40A431CC10895001ED069 /* Result.framework in Frameworks */, + 92E40A411CC10895001ED069 /* Boilerplate.framework in Frameworks */, + 92E40A421CC10895001ED069 /* Foundation3.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -197,6 +301,9 @@ 65D637881C943764000F5548 /* ExecutionContextTests-OSX.xctest */, 92E409101CBC32F2001ED069 /* ExecutionContext.framework */, 92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */, + 92E409F81CC10677001ED069 /* ExecutionContext.framework */, + 92E40A011CC10677001ED069 /* ExecutionContextTests-tvOS.xctest */, + 92E40A2E1CC107D0001ED069 /* ExecutionContext.framework */, ); name = Products; sourceTree = ""; @@ -228,6 +335,8 @@ 65D637A61C94383C000F5548 /* Frameworks */ = { isa = PBXGroup; children = ( + 92E40A3C1CC10875001ED069 /* watchOS */, + 92E40A171CC10740001ED069 /* tvOS */, 92E4092D1CBC33DC001ED069 /* iOS */, 65D637A71C94383C000F5548 /* Mac */, ); @@ -251,6 +360,7 @@ 92E4092D1CBC33DC001ED069 /* iOS */ = { isa = PBXGroup; children = ( + 92E409EE1CC10541001ED069 /* RunLoop.framework */, 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */, 92E4092F1CBC33F9001ED069 /* Foundation3.framework */, 92E409301CBC33F9001ED069 /* Result.framework */, @@ -259,6 +369,28 @@ path = iOS; sourceTree = ""; }; + 92E40A171CC10740001ED069 /* tvOS */ = { + isa = PBXGroup; + children = ( + 92E40A181CC10761001ED069 /* Boilerplate.framework */, + 92E40A191CC10761001ED069 /* Foundation3.framework */, + 92E40A1A1CC10761001ED069 /* Result.framework */, + 92E40A1B1CC10761001ED069 /* RunLoop.framework */, + ); + path = tvOS; + sourceTree = ""; + }; + 92E40A3C1CC10875001ED069 /* watchOS */ = { + isa = PBXGroup; + children = ( + 92E40A3D1CC10895001ED069 /* Boilerplate.framework */, + 92E40A3E1CC10895001ED069 /* Foundation3.framework */, + 92E40A3F1CC10895001ED069 /* Result.framework */, + 92E40A401CC10895001ED069 /* RunLoop.framework */, + ); + path = watchOS; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -276,6 +408,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 92E409F51CC10677001ED069 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E40A2B1CC107D0001ED069 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -353,6 +499,61 @@ productReference = 92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 92E409F71CC10677001ED069 /* ExecutionContext-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 92E40A091CC10677001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-tvOS" */; + buildPhases = ( + 92E409F31CC10677001ED069 /* Sources */, + 92E409F41CC10677001ED069 /* Frameworks */, + 92E409F51CC10677001ED069 /* Headers */, + 92E409F61CC10677001ED069 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ExecutionContext-tvOS"; + productName = ExecutionContext; + productReference = 92E409F81CC10677001ED069 /* ExecutionContext.framework */; + productType = "com.apple.product-type.framework"; + }; + 92E40A001CC10677001ED069 /* ExecutionContextTests-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 92E40A0C1CC10677001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-tvOS" */; + buildPhases = ( + 92E409FD1CC10677001ED069 /* Sources */, + 92E409FE1CC10677001ED069 /* Frameworks */, + 92E409FF1CC10677001ED069 /* Resources */, + 92E40A241CC1078D001ED069 /* Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 92E40A041CC10677001ED069 /* PBXTargetDependency */, + ); + name = "ExecutionContextTests-tvOS"; + productName = ExecutionContextTests; + productReference = 92E40A011CC10677001ED069 /* ExecutionContextTests-tvOS.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 92E40A2D1CC107D0001ED069 /* ExecutionContext-watchOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 92E40A331CC107D0001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-watchOS" */; + buildPhases = ( + 92E40A291CC107D0001ED069 /* Sources */, + 92E40A2A1CC107D0001ED069 /* Frameworks */, + 92E40A2B1CC107D0001ED069 /* Headers */, + 92E40A2C1CC107D0001ED069 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ExecutionContext-watchOS"; + productName = ExecutionContext; + productReference = 92E40A2E1CC107D0001ED069 /* ExecutionContext.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -375,6 +576,15 @@ 92E409181CBC32F2001ED069 = { CreatedOnToolsVersion = 7.3; }; + 92E409F71CC10677001ED069 = { + CreatedOnToolsVersion = 7.3; + }; + 92E40A001CC10677001ED069 = { + CreatedOnToolsVersion = 7.3; + }; + 92E40A2D1CC107D0001ED069 = { + CreatedOnToolsVersion = 7.3; + }; }; }; buildConfigurationList = 65D637781C943763000F5548 /* Build configuration list for PBXProject "ExecutionContext" */; @@ -393,6 +603,9 @@ 65D637871C943764000F5548 /* ExecutionContextTests-OSX */, 92E4090F1CBC32F2001ED069 /* ExecutionContext-iOS */, 92E409181CBC32F2001ED069 /* ExecutionContextTests-iOS */, + 92E409F71CC10677001ED069 /* ExecutionContext-tvOS */, + 92E40A001CC10677001ED069 /* ExecutionContextTests-tvOS */, + 92E40A2D1CC107D0001ED069 /* ExecutionContext-watchOS */, ); }; /* End PBXProject section */ @@ -426,6 +639,27 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 92E409F61CC10677001ED069 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409FF1CC10677001ED069 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E40A2C1CC107D0001ED069 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -467,6 +701,41 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 92E40A151CC10717001ED069 /* ExecutionContextTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409F31CC10677001ED069 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E40A141CC10713001ED069 /* RunLoopExecutionContext.swift in Sources */, + 92E40A0F1CC10713001ED069 /* ExecutionContext.swift in Sources */, + 92E40A111CC10713001ED069 /* DefaultExecutionContext.swift in Sources */, + 92E40A131CC10713001ED069 /* ImmediateExecutionContext.swift in Sources */, + 92E40A121CC10713001ED069 /* DispatchExecutionContext.swift in Sources */, + 92E40A101CC10713001ED069 /* CustomExecutionContext.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E409FD1CC10677001ED069 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E40A161CC10718001ED069 /* ExecutionContextTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E40A291CC107D0001ED069 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 92E40A3B1CC10816001ED069 /* RunLoopExecutionContext.swift in Sources */, + 92E40A361CC10816001ED069 /* ExecutionContext.swift in Sources */, + 92E40A381CC10816001ED069 /* DefaultExecutionContext.swift in Sources */, + 92E40A3A1CC10816001ED069 /* ImmediateExecutionContext.swift in Sources */, + 92E40A391CC10816001ED069 /* DispatchExecutionContext.swift in Sources */, + 92E40A371CC10816001ED069 /* CustomExecutionContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -483,6 +752,11 @@ target = 92E4090F1CBC32F2001ED069 /* ExecutionContext-iOS */; targetProxy = 92E4091B1CBC32F2001ED069 /* PBXContainerItemProxy */; }; + 92E40A041CC10677001ED069 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 92E409F71CC10677001ED069 /* ExecutionContext-tvOS */; + targetProxy = 92E40A031CC10677001ED069 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -746,6 +1020,141 @@ }; name = Release; }; + 92E40A0A1CC10677001ED069 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = ExecutionContext/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; + PRODUCT_NAME = "$(PROJECT_NAME)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + 92E40A0B1CC10677001ED069 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = ExecutionContext/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; + PRODUCT_NAME = "$(PROJECT_NAME)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 92E40A0D1CC10677001ED069 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Debug; + }; + 92E40A0E1CC10677001ED069 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = Tests/ExecutionContext/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContextTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.2; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 92E40A341CC107D0001ED069 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_NONNULL = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/watchOS", + ); + INFOPLIST_FILE = ExecutionContext/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; + PRODUCT_NAME = "$(PROJECT_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 92E40A351CC107D0001ED069 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_NONNULL = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/watchOS", + ); + INFOPLIST_FILE = ExecutionContext/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext; + PRODUCT_NAME = "$(PROJECT_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + VALIDATE_PRODUCT = YES; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -783,6 +1192,7 @@ 92E409231CBC32F2001ED069 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 92E409241CBC32F2001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-iOS" */ = { isa = XCConfigurationList; @@ -791,6 +1201,31 @@ 92E409261CBC32F2001ED069 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 92E40A091CC10677001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 92E40A0A1CC10677001ED069 /* Debug */, + 92E40A0B1CC10677001ED069 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 92E40A0C1CC10677001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 92E40A0D1CC10677001ED069 /* Debug */, + 92E40A0E1CC10677001ED069 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 92E40A331CC107D0001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-watchOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 92E40A341CC107D0001ED069 /* Debug */, + 92E40A351CC107D0001ED069 /* Release */, + ); + defaultConfigurationIsVisible = 0; }; /* End XCConfigurationList section */ }; diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme new file mode 100644 index 0000000..4c41adb --- /dev/null +++ b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-iOS.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme new file mode 100644 index 0000000..4b961b5 --- /dev/null +++ b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-tvOS.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme new file mode 100644 index 0000000..aee5d98 --- /dev/null +++ b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ExecutionContext/CustomExecutionContext.swift b/ExecutionContext/CustomExecutionContext.swift index d30c2b2..7485708 100644 --- a/ExecutionContext/CustomExecutionContext.swift +++ b/ExecutionContext/CustomExecutionContext.swift @@ -15,6 +15,7 @@ //===----------------------------------------------------------------------===// import Foundation +import Foundation3 import Boilerplate public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType { @@ -52,6 +53,6 @@ public class CustomExecutionContext : ExecutionContextBase, ExecutionContextType guard let other = other as? CustomExecutionContext else { return false } - return id.isEqualTo(other.id) + return id.isEqual(other.id) } } \ No newline at end of file diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift index 2df6b0d..5b91a22 100644 --- a/ExecutionContext/RunLoopExecutionContext.swift +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -70,7 +70,7 @@ private class ParallelContext : ExecutionContextBase, ExecutionContextType { guard let other = other as? ParallelContext else { return false } - return id.isEqualTo(other.id) + return id.isEqual(other.id) } } From d04723bd8aa37c61ca6b1878609a5839bfca7cbd Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 14:45:02 +0300 Subject: [PATCH 11/28] Swift 3.0 fixes --- ExecutionContext/ExecutionContext.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 325d334..89b5929 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -27,9 +27,9 @@ import Boilerplate #endif // return true if error successfully handled, false otherwise -public typealias ErrorHandler = (e:ErrorType) throws -> Bool +public typealias ErrorHandler = (e:ErrorProtocol) throws -> Bool -private func stockErrorHandler(e:ErrorType) throws -> Bool { +private func stockErrorHandler(e:ErrorProtocol) throws -> Bool { let errorName = Mirror(reflecting: e).description print(errorName, " was thrown but not handled") return true @@ -110,7 +110,7 @@ public class ExecutionContextBase : ErrorHandlerRegistryType { } public extension ErrorHandlerRegistryType where Self : TaskSchedulerType { - func handleError(e:ErrorType) { + func handleError(e:ErrorProtocol) { for handler in errorHandlers { do { if try handler(e: e) { From d5b1f8f6a42b99c3e844707ff591feb1725b7bd1 Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 14:46:26 +0300 Subject: [PATCH 12/28] Swift 3.0 array fix --- ExecutionContext/ExecutionContext.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 89b5929..95841ca 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -105,7 +105,7 @@ public class ExecutionContextBase : ErrorHandlerRegistryType { public func registerErrorHandler(handler:ErrorHandler) { //keep last one as it's stock - errorHandlers.insert(handler, atIndex: errorHandlers.endIndex.advancedBy(-1)) + errorHandlers.insert(handler, at: errorHandlers.endIndex.advancedBy(-1)) } } From 1a2d98158584de68d93111fe7b9c6e739db5665c Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 14:47:27 +0300 Subject: [PATCH 13/28] endIndex fix --- ExecutionContext/ExecutionContext.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 95841ca..9d77e08 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -105,7 +105,7 @@ public class ExecutionContextBase : ErrorHandlerRegistryType { public func registerErrorHandler(handler:ErrorHandler) { //keep last one as it's stock - errorHandlers.insert(handler, at: errorHandlers.endIndex.advancedBy(-1)) + errorHandlers.insert(handler, at: errorHandlers.endIndex.advanced(by: -1)) } } From cfc45fe33dac13192f0404fe54526015bba41073 Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 16:43:39 +0300 Subject: [PATCH 14/28] Fixed travis.yml --- .travis.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 807919f..35783ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,17 +4,17 @@ env: matrix: include: - script: - - xctool test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-OSX - - xctool test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' - - xctool test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 1080p' - - xctool build -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-watchOS -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch - 42mm' + - xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-OSX + - xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' + - xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 1080p' + - xcodebuild build -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-watchOS -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch - 42mm' os: osx - osx_image: xcode7.2 + osx_image: xcode7.3 language: objective-c before_install: - brew update - brew outdated carthage || brew upgrade carthage - - brew outdated xctool || brew upgrade xctool + # - brew outdated xctool || brew upgrade xctool before_script: # bootstrap the dependencies for the project # you can remove if you don't have dependencies @@ -33,7 +33,7 @@ matrix: repo: crossroadlabs/ExecutionContext tags: true - script: - - ./build + - ./build test sudo: required dist: trusty language: generic @@ -41,10 +41,14 @@ matrix: # install original swift distribution - wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import - - cd .. - - export SWIFT_VERSION="swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a" + - export SWIFT_VERSION="swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a" - wget https://swift.org/builds/development/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz - tar xzf $SWIFT_VERSION-ubuntu14.04.tar.gz - export PATH="${PWD}/${SWIFT_VERSION}-ubuntu14.04/usr/bin:${PATH}" + # libuv v1 + - sudo add-apt-repository ppa:swiftexpress/swiftexpress --yes + - sudo apt-get update + - sudo apt-get install libuv1-dev # get back home - cd $MODULE_NAME # get crossroad build script From 75d08ca9685cd8aa6d79e2b11bde32d21d0e3a52 Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 16:51:19 +0300 Subject: [PATCH 15/28] travis libuv on osx --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 35783ee..ad2664f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ matrix: before_install: - brew update - brew outdated carthage || brew upgrade carthage + - brew outdated libuv || brew upgrade libuv # - brew outdated xctool || brew upgrade xctool before_script: # bootstrap the dependencies for the project From defc64f308421791f6adcce04b2d4acba34510ea Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Fri, 15 Apr 2016 16:55:39 +0300 Subject: [PATCH 16/28] travis lib fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ad2664f..9b846e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: before_install: - brew update - brew outdated carthage || brew upgrade carthage - - brew outdated libuv || brew upgrade libuv + - brew install libuv # - brew outdated xctool || brew upgrade xctool before_script: # bootstrap the dependencies for the project From 2956398a5818dcfc71b6fe8202af765f02c0e8f6 Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Tue, 19 Apr 2016 17:56:15 +0300 Subject: [PATCH 17/28] dispatch build and test on travis --- .travis.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9b846e5..4fd6ba0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,8 @@ matrix: tags: true - script: - ./build test + - ./build clean + - ./build test -Xcc -fblocks -Xswiftc -Ddispatch sudo: required dist: trusty language: generic @@ -45,7 +47,18 @@ matrix: - export SWIFT_VERSION="swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a" - wget https://swift.org/builds/development/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz - tar xzf $SWIFT_VERSION-ubuntu14.04.tar.gz - - export PATH="${PWD}/${SWIFT_VERSION}-ubuntu14.04/usr/bin:${PATH}" + - export SWIFT_ROOT_DIR="${PWD}/${SWIFT_VERSION}-ubuntu14.04" + - export PATH="${SWIFT_ROOT_DIR}/usr/bin:${PATH}" + # dispatch build + - sudo apt-get install clang autoconf libtool pkg-config systemtap-sdt-dev libblocksruntime-dev libkqueue-dev libpthread-workqueue-dev libbsd-dev git make + - git clone -b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch.git + - cd swift-corelibs-libdispatch + - git submodule init + - git submodule update + - sh ./autogen.sh + - ./configure --with-swift-toolchain="${SWIFT_ROOT_DIR}/usr" --prefix="${SWIFT_ROOT_DIR}/usr" + - make && make install + - cd .. # libuv v1 - sudo add-apt-repository ppa:swiftexpress/swiftexpress --yes - sudo apt-get update From 4d5e8a0a40a7395289ff548e9da5b678aa53aa3c Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Tue, 19 Apr 2016 18:02:58 +0300 Subject: [PATCH 18/28] Linux test fix --- Tests/ExecutionContext/ExecutionContextTests.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index 54c9de9..fddaeb0 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -116,6 +116,12 @@ class ExecutionContextTests: XCTestCase { asyncTest(context) afterTest(context) //afterTestAdvanced - no it will not work here + + //We need run loop on Linux + #if os(Linux) + (RunLoop.main as! RunnableRunLoopType).run() + #endif + } func testCustomOnGlobal() { From cd875602d2061421506110b778b1ea9031e848e8 Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Tue, 19 Apr 2016 18:08:09 +0300 Subject: [PATCH 19/28] Better linux run --- .../xcschemes/ExecutionContext-watchOS.xcscheme | 6 +++--- Tests/ExecutionContext/ExecutionContextTests.swift | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme index aee5d98..fe10d29 100644 --- a/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme +++ b/ExecutionContext.xcodeproj/xcshareddata/xcschemes/ExecutionContext-watchOS.xcscheme @@ -15,7 +15,7 @@ @@ -46,7 +46,7 @@ @@ -64,7 +64,7 @@ diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index fddaeb0..38cad11 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -119,7 +119,7 @@ class ExecutionContextTests: XCTestCase { //We need run loop on Linux #if os(Linux) - (RunLoop.main as! RunnableRunLoopType).run() + (RunLoop.main as! RunnableRunLoopType).run(.In(timeout: 2)) #endif } @@ -140,6 +140,11 @@ class ExecutionContextTests: XCTestCase { asyncTest(context) afterTest(context) //afterTestAdvanced - no it will not work here + + //We need run loop on Linux + #if os(Linux) + (RunLoop.main as! RunnableRunLoopType).run(.In(timeout: 2)) + #endif } func testCustomSimple() { From 5246b46f4e9c7c87a057bf539274e46a8144463c Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Tue, 19 Apr 2016 18:20:53 +0300 Subject: [PATCH 20/28] Better linux tests --- .../ExecutionContextTests.swift | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index 38cad11..bede220 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -44,8 +44,7 @@ class ExecutionContextTests: XCTestCase { self.waitForExpectations(withTimeout: 0, handler: nil) } - func asyncTest(context:ExecutionContextType) { - RunLoop.current + func asyncTest(context:ExecutionContextType, runRunLoop: Bool = false) { let expectation = self.expectation(withDescription: "OK ASYNC") context.async { @@ -53,31 +52,47 @@ class ExecutionContextTests: XCTestCase { expectation.fulfill() } + if runRunLoop { + (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 2)) + } + self.waitForExpectations(withTimeout: 2, handler: nil) } - func afterTest(context:ExecutionContextType) { + func afterTest(context:ExecutionContextType, runRunLoop: Bool = false) { let expectation = self.expectation(withDescription: "OK AFTER") context.async(0.5) { expectation.fulfill() } + if runRunLoop { + (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 2)) + } + self.waitForExpectations(withTimeout: 3, handler: nil) } - func afterTestAdvanced(context:ExecutionContextType) { + func afterTestAdvanced(context:ExecutionContextType, runRunLoop: Bool = false) { var ok = true context.async(3) { ok = false } - Thread.sleep(2.0) + if runRunLoop { + (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 2)) + } else { + Thread.sleep(2.0) + } XCTAssert(ok) - Thread.sleep(2.0) + if runRunLoop { + (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 2)) + } else { + Thread.sleep(2.0) + } XCTAssertFalse(ok) } @@ -111,17 +126,18 @@ class ExecutionContextTests: XCTestCase { func testMain() { let context:ExecutionContextType = DefaultExecutionContext.main - - syncTest(context) - asyncTest(context) - afterTest(context) - //afterTestAdvanced - no it will not work here - - //We need run loop on Linux #if os(Linux) - (RunLoop.main as! RunnableRunLoopType).run(.In(timeout: 2)) + let runRunLoop = true + #else + let runRunLoop = false #endif + #if !os(Linux) + syncTest(context) + #endif + asyncTest(context, runRunLoop: runRunLoop) + afterTest(context, runRunLoop: runRunLoop) + //afterTestAdvanced - no it will not work here } func testCustomOnGlobal() { @@ -135,16 +151,16 @@ class ExecutionContextTests: XCTestCase { func testCustomOnMain() { let context = executionContext(main.execute) + #if os(Linux) + let runRunLoop = true + #else + let runRunLoop = false + #endif // syncTest(context) - asyncTest(context) - afterTest(context) + asyncTest(context, runRunLoop: runRunLoop) + afterTest(context, runRunLoop: runRunLoop) //afterTestAdvanced - no it will not work here - - //We need run loop on Linux - #if os(Linux) - (RunLoop.main as! RunnableRunLoopType).run(.In(timeout: 2)) - #endif } func testCustomSimple() { From 275d8c7f2cb8975cef1180ed473d05f96e46b57e Mon Sep 17 00:00:00 2001 From: Yehor Popovych Date: Tue, 19 Apr 2016 18:42:46 +0300 Subject: [PATCH 21/28] Attempt to fix main thread tests --- Tests/ExecutionContext/ExecutionContextTests.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index bede220..810f606 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -48,7 +48,11 @@ class ExecutionContextTests: XCTestCase { let expectation = self.expectation(withDescription: "OK ASYNC") context.async { - Thread.sleep(1) + if runRunLoop { + (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 1)) + } else { + Thread.sleep(1) + } expectation.fulfill() } @@ -67,7 +71,7 @@ class ExecutionContextTests: XCTestCase { } if runRunLoop { - (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 2)) + (RunLoop.current as! RunnableRunLoopType).run(.In(timeout: 3)) } self.waitForExpectations(withTimeout: 3, handler: nil) From 230fbada98a87f573ec551943bc1e909ff6d5067 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Wed, 4 May 2016 08:16:15 +0300 Subject: [PATCH 22/28] Added tenant protocol --- ExecutionContext.xcodeproj/project.pbxproj | 13 +++++++++++ ExecutionContext/ExecutionContextTenant.swift | 23 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 ExecutionContext/ExecutionContextTenant.swift diff --git a/ExecutionContext.xcodeproj/project.pbxproj b/ExecutionContext.xcodeproj/project.pbxproj index 184c0fb..c18f10a 100644 --- a/ExecutionContext.xcodeproj/project.pbxproj +++ b/ExecutionContext.xcodeproj/project.pbxproj @@ -15,6 +15,10 @@ 65D637A21C9437BB000F5548 /* ImmediateExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */; }; 65D637A31C9437BB000F5548 /* RunLoopExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */; }; 65D637A51C9437F4000F5548 /* ExecutionContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */; }; + 65FD8EC01CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */; }; + 65FD8EC11CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */; }; + 65FD8EC21CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */; }; + 65FD8EC31CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */; }; 92E4091A1CBC32F2001ED069 /* ExecutionContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92E409101CBC32F2001ED069 /* ExecutionContext.framework */; }; 92E409271CBC3369001ED069 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6379B1C9437BB000F5548 /* ExecutionContext.swift */; }; 92E409281CBC336D001ED069 /* CustomExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D637981C9437BB000F5548 /* CustomExecutionContext.swift */; }; @@ -170,6 +174,7 @@ 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateExecutionContext.swift; sourceTree = ""; }; 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = ""; }; 65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = ""; }; + 65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTenant.swift; sourceTree = ""; }; 92E409101CBC32F2001ED069 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 92E4092E1CBC33F9001ED069 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = ""; }; @@ -317,6 +322,7 @@ 65D6379A1C9437BB000F5548 /* DispatchExecutionContext.swift */, 65D6379C1C9437BB000F5548 /* ImmediateExecutionContext.swift */, 65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */, + 65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */, 65D637831C943764000F5548 /* Info.plist */, ); path = ExecutionContext; @@ -668,6 +674,7 @@ buildActionMask = 2147483647; files = ( 65D637A31C9437BB000F5548 /* RunLoopExecutionContext.swift in Sources */, + 65FD8EC01CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */, 65D6379F1C9437BB000F5548 /* DefaultExecutionContext.swift in Sources */, 65D6379E1C9437BB000F5548 /* CustomExecutionContext.swift in Sources */, 65D637A21C9437BB000F5548 /* ImmediateExecutionContext.swift in Sources */, @@ -689,6 +696,7 @@ buildActionMask = 2147483647; files = ( 92E4092C1CBC337B001ED069 /* RunLoopExecutionContext.swift in Sources */, + 65FD8EC11CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */, 92E409271CBC3369001ED069 /* ExecutionContext.swift in Sources */, 92E409291CBC3371001ED069 /* DefaultExecutionContext.swift in Sources */, 92E4092B1CBC3378001ED069 /* ImmediateExecutionContext.swift in Sources */, @@ -710,6 +718,7 @@ buildActionMask = 2147483647; files = ( 92E40A141CC10713001ED069 /* RunLoopExecutionContext.swift in Sources */, + 65FD8EC21CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */, 92E40A0F1CC10713001ED069 /* ExecutionContext.swift in Sources */, 92E40A111CC10713001ED069 /* DefaultExecutionContext.swift in Sources */, 92E40A131CC10713001ED069 /* ImmediateExecutionContext.swift in Sources */, @@ -731,6 +740,7 @@ buildActionMask = 2147483647; files = ( 92E40A3B1CC10816001ED069 /* RunLoopExecutionContext.swift in Sources */, + 65FD8EC31CD9BC340046D5D6 /* ExecutionContextTenant.swift in Sources */, 92E40A361CC10816001ED069 /* ExecutionContext.swift in Sources */, 92E40A381CC10816001ED069 /* DefaultExecutionContext.swift in Sources */, 92E40A3A1CC10816001ED069 /* ImmediateExecutionContext.swift in Sources */, @@ -1210,6 +1220,7 @@ 92E40A0B1CC10677001ED069 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 92E40A0C1CC10677001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContextTests-tvOS" */ = { isa = XCConfigurationList; @@ -1218,6 +1229,7 @@ 92E40A0E1CC10677001ED069 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 92E40A331CC107D0001ED069 /* Build configuration list for PBXNativeTarget "ExecutionContext-watchOS" */ = { isa = XCConfigurationList; @@ -1226,6 +1238,7 @@ 92E40A351CC107D0001ED069 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/ExecutionContext/ExecutionContextTenant.swift b/ExecutionContext/ExecutionContextTenant.swift new file mode 100644 index 0000000..f4d0d82 --- /dev/null +++ b/ExecutionContext/ExecutionContextTenant.swift @@ -0,0 +1,23 @@ +//===--- ExecutionContextTenant.swift ------------------------------------------------------===// +//Copyright (c) 2016 Daniel Leping (dileping) +// +//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. +//===----------------------------------------------------------------------===// + +public protocol ExecutionContextTenantProtocol { + var context:ExecutionContextType {get} +} + +public protocol MovableExecutionContextTenantProtocol : ExecutionContextTenantProtocol { + func settleIn(context:ExecutionContextType) -> Self +} \ No newline at end of file From f2b77e90c927e3522273e12064203eca333f7179 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Wed, 4 May 2016 08:57:17 +0300 Subject: [PATCH 23/28] better movable protocol --- ExecutionContext/ExecutionContextTenant.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ExecutionContext/ExecutionContextTenant.swift b/ExecutionContext/ExecutionContextTenant.swift index f4d0d82..c5895c7 100644 --- a/ExecutionContext/ExecutionContextTenant.swift +++ b/ExecutionContext/ExecutionContextTenant.swift @@ -19,5 +19,7 @@ public protocol ExecutionContextTenantProtocol { } public protocol MovableExecutionContextTenantProtocol : ExecutionContextTenantProtocol { - func settleIn(context:ExecutionContextType) -> Self + associatedtype SettledTenant + + func settleIn(context:ExecutionContextType) -> SettledTenant } \ No newline at end of file From ed1e558e3e41ae0114036109e988dd88c4eb7498 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Wed, 4 May 2016 16:28:20 +0300 Subject: [PATCH 24/28] immediate if current --- ExecutionContext/ExecutionContext.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index 9d77e08..a3fa2f0 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -177,4 +177,16 @@ public extension ExecutionContextType { return currentContext.value! } } +} + +public extension ExecutionContextType { + //if context is current - executes immediately. Schedules to the context otherwise + public func immediateIfCurrent(task:SafeTask) { + //can avoid first check but is here for optimization + if immediate.isEqualTo(self) || isCurrent { + task() + } else { + execute(task) + } + } } \ No newline at end of file From 92f2a7ab3a24d60f738b1be2ec5392aa6563d3b1 Mon Sep 17 00:00:00 2001 From: Daniel Leping Date: Wed, 4 May 2016 16:52:20 +0300 Subject: [PATCH 25/28] 3.0 style enums --- ExecutionContext/DispatchExecutionContext.swift | 4 ++-- ExecutionContext/ExecutionContext.swift | 4 ++-- ExecutionContext/RunLoopExecutionContext.swift | 6 +++--- Tests/ExecutionContext/ExecutionContextTests.swift | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ExecutionContext/DispatchExecutionContext.swift b/ExecutionContext/DispatchExecutionContext.swift index 1c799f2..2229189 100644 --- a/ExecutionContext/DispatchExecutionContext.swift +++ b/ExecutionContext/DispatchExecutionContext.swift @@ -25,9 +25,9 @@ private extension ExecutionContextKind { func createDispatchQueue(id:String) -> dispatch_queue_t! { switch self { - case .Serial: + case .serial: return dispatch_queue_create(id, DISPATCH_QUEUE_SERIAL) - case .Parallel: + case .parallel: return dispatch_queue_create(id, DISPATCH_QUEUE_CONCURRENT) } } diff --git a/ExecutionContext/ExecutionContext.swift b/ExecutionContext/ExecutionContext.swift index a3fa2f0..bb699bf 100644 --- a/ExecutionContext/ExecutionContext.swift +++ b/ExecutionContext/ExecutionContext.swift @@ -148,8 +148,8 @@ public extension ErrorHandlerRegistryType where Self : TaskSchedulerType { } public enum ExecutionContextKind { - case Serial - case Parallel + case serial + case parallel } public typealias ExecutionContext = DefaultExecutionContext diff --git a/ExecutionContext/RunLoopExecutionContext.swift b/ExecutionContext/RunLoopExecutionContext.swift index 5b91a22..1e8defd 100644 --- a/ExecutionContext/RunLoopExecutionContext.swift +++ b/ExecutionContext/RunLoopExecutionContext.swift @@ -132,9 +132,9 @@ private class SerialContext : ExecutionContextBase, ExecutionContextType { private extension ExecutionContextKind { func createInnerContext() -> ExecutionContextType { switch self { - case .Serial: + case .serial: return SerialContext() - case .Parallel: + case .parallel: return ParallelContext() } } @@ -183,7 +183,7 @@ public class RunLoopExecutionContext : ExecutionContextBase, ExecutionContextTyp } public static let main:ExecutionContextType = RunLoopExecutionContext(inner: SerialContext(runLoop: RunLoop.main)) - public static let global:ExecutionContextType = RunLoopExecutionContext(kind: .Parallel) + public static let global:ExecutionContextType = RunLoopExecutionContext(kind: .parallel) @noreturn public static func mainProc() { diff --git a/Tests/ExecutionContext/ExecutionContextTests.swift b/Tests/ExecutionContext/ExecutionContextTests.swift index 810f606..ea4874c 100644 --- a/Tests/ExecutionContext/ExecutionContextTests.swift +++ b/Tests/ExecutionContext/ExecutionContextTests.swift @@ -102,7 +102,7 @@ class ExecutionContextTests: XCTestCase { } func testSerial() { - let context:ExecutionContextType = DefaultExecutionContext(kind: .Serial) + let context:ExecutionContextType = DefaultExecutionContext(kind: .serial) syncTest(context) asyncTest(context) @@ -111,7 +111,7 @@ class ExecutionContextTests: XCTestCase { } func testParallel() { - let context:ExecutionContextType = DefaultExecutionContext(kind: .Parallel) + let context:ExecutionContextType = DefaultExecutionContext(kind: .parallel) syncTest(context) asyncTest(context) From 1a70e35c9601e78bf656dde234f82781aaf5c9b8 Mon Sep 17 00:00:00 2001 From: RuslaYupyn Date: Mon, 11 Jul 2016 14:01:24 +0300 Subject: [PATCH 26/28] added podspec --- ExecutionContext.podspec | 26 ++++++++++++++++++++++++++ Podfile | 1 + 2 files changed, 27 insertions(+) create mode 100644 ExecutionContext.podspec create mode 100644 Podfile diff --git a/ExecutionContext.podspec b/ExecutionContext.podspec new file mode 100644 index 0000000..c8096e4 --- /dev/null +++ b/ExecutionContext.podspec @@ -0,0 +1,26 @@ +Pod::Spec.new do |s| + s.name = "ExecutionContext" + s.version = "0.4.0" + s.license = { :type => "Apache 2", :file => "LICENSE" } + s.summary = "Execution context: object oriented, cross platform, user friendly replacement of Dispatch" + s.homepage = "https://github.com/reactive-swift/ExecutionContext" + s.social_media_url = "https://github.com/reactive-swift/ExecutionContext" + s.authors = { "Daniel Leping" => "daniel@crossroadlabs.xyz" } + + s.source = { :git => "https://github.com/reactive-swift/ExecutionContext.git", :tag => "#{s.version}" } + + s.ios.deployment_target = "8.0" + s.osx.deployment_target = "10.10" + s.watchos.deployment_target = "2.0" + s.tvos.deployment_target = "9.0" + + s.source_files = "ExecutionContext/*.swift" + + s.dependency 'Result', '~> 2.0' + s.dependency 'Boilerplate', '~> 0.1' + + c.dependency 'RunLoop', '~> 0.1.1' + + s.requires_arc = true + +end diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..1239ebe --- /dev/null +++ b/Podfile @@ -0,0 +1 @@ +pod 'RunLoop', :git => 'git@github.com:necrowman/TestPodspecs.git', :branch => 'master' \ No newline at end of file From 0114366112e5a40b01c585e5f6b2efe5b85d133f Mon Sep 17 00:00:00 2001 From: RuslaYupyn Date: Mon, 11 Jul 2016 14:42:46 +0300 Subject: [PATCH 27/28] fixed podspec; --- ExecutionContext.podspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ExecutionContext.podspec b/ExecutionContext.podspec index c8096e4..e87c2e2 100644 --- a/ExecutionContext.podspec +++ b/ExecutionContext.podspec @@ -18,8 +18,7 @@ Pod::Spec.new do |s| s.dependency 'Result', '~> 2.0' s.dependency 'Boilerplate', '~> 0.1' - - c.dependency 'RunLoop', '~> 0.1.1' + s.dependency 'RunLoop', '~> 0.1.1' s.requires_arc = true From caeb39e0995db762233372c4be45d8e5bb95c86f Mon Sep 17 00:00:00 2001 From: RuslaYupyn Date: Tue, 12 Jul 2016 15:35:23 +0300 Subject: [PATCH 28/28] updated podspec --- ExecutionContext.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExecutionContext.podspec b/ExecutionContext.podspec index e87c2e2..5e687ba 100644 --- a/ExecutionContext.podspec +++ b/ExecutionContext.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| s.social_media_url = "https://github.com/reactive-swift/ExecutionContext" s.authors = { "Daniel Leping" => "daniel@crossroadlabs.xyz" } - s.source = { :git => "https://github.com/reactive-swift/ExecutionContext.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/reactive-swift/ExecutionContext.git", :tag => "#{s.version}", :branch => 'develop' } s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.10"