Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
132f608
First draft of Dispatcher conversion
GarthSnyder Jun 18, 2018
b4e39b5
Put back map(on: nil)
GarthSnyder Jun 18, 2018
8cd0121
Rename async() method args to forestall ambiguity; compiles
GarthSnyder Jun 18, 2018
18baef6
Working on Dispatcher tests
GarthSnyder Jun 20, 2018
1ac7e21
Make Dispatcher arguments nonoptional
GarthSnyder Jun 20, 2018
88b7937
Finish tests
GarthSnyder Jun 20, 2018
3516511
Generalize DispatchQueues to Dispatcher-protocol objects
GarthSnyder Jun 20, 2018
7c7835a
Port Thenable.tap and Guarantee.get to Dispatcher objects
GarthSnyder Aug 8, 2018
2cc021a
Travis-test Linux Swift 3 compatibility only with latest compiler
GarthSnyder Aug 9, 2018
70b0551
Use existing v7 Travis config file
GarthSnyder Dec 2, 2018
f8b0ead
First draft of Dispatcher conversion
GarthSnyder Jun 18, 2018
4ba57ed
Put back map(on: nil)
GarthSnyder Jun 18, 2018
262b4dd
Rename async() method args to forestall ambiguity; compiles
GarthSnyder Jun 18, 2018
044fe78
Working on Dispatcher tests
GarthSnyder Jun 20, 2018
0a027c8
Make Dispatcher arguments nonoptional
GarthSnyder Jun 20, 2018
855476a
Finish tests
GarthSnyder Jun 20, 2018
9e17e7d
Generalize DispatchQueues to Dispatcher-protocol objects
GarthSnyder Jun 20, 2018
686a1e6
Port Thenable.tap and Guarantee.get to Dispatcher objects
GarthSnyder Aug 8, 2018
d1a38a5
Fixed bug where pendingPromiseDeallocated event was incorrectly repor…
neallester Dec 14, 2018
0e90203
Update ObjectiveC.md
mxcl Dec 14, 2018
84f35e5
Add explicit import for Dispatch in tests (needed for Travis builds)
GarthSnyder Dec 15, 2018
1136163
Travis-build all branches in Travis TRAVIS_BRANCHES env variable
GarthSnyder Dec 16, 2018
8ae5bfa
v7 Travis: Swift 3 only on latest compiler, sync Linux test/build
GarthSnyder Dec 16, 2018
4689415
Save artifacts (env must define ARTIFACTS_* for KEY, SECRET, REGION, …
GarthSnyder Dec 16, 2018
f877a39
Disable artifact collection by default
GarthSnyder Dec 18, 2018
2c45b0b
Merge branch 'dispatch-v7' into dispatch
GarthSnyder Dec 18, 2018
68763cf
Revert commits 0e902 and d1a38; these were rebased in from master
GarthSnyder Dec 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 75 additions & 74 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,39 @@
addons:
# To enable build artifact collection on S3, change "artifacts_disabled" below to "artifacts".
# Then define ARTIFACTS_KEY, ARTIFACTS_SECRET, ARTIFACTS_REGION, and ARTIFACTS_BUCKET in the
# Travis environment. If you enable artifacts here but do not define the configuration
# parameters, some jobs will fail.
artifacts_disabled:
paths:
# Collect build directory contents and logs if configured to do so in the environment,
# but skip the Promises/A+ products because there are a lot. Also omit some larger binaries.
- $(find /var/folders -name '*carthage-xcodebuild*' -print 2>/dev/null | tr "\n" ":")
- $(if [ `git ls-files -o | grep build.js | wc -l` -eq 0 ]; then git ls-files -o | grep -v x86_64- | tr "\n" ":" ; fi)
stages:
- name: lint
if: branch = master OR branch =~ ^\d+\.\d+\.\d+$
if: branch = master OR branch =~ ^\d+\.\d+\.\d+$ OR branch =~ concat("^(",env(TRAVIS_BRANCHES),")$")
- name: compile
if: branch = master OR branch =~ ^\d+\.\d+\.\d+$
if: branch = master OR branch =~ ^\d+\.\d+\.\d+$ OR branch =~ concat("^(",env(TRAVIS_BRANCHES),")$")
- name: test
if: branch = master OR branch =~ ^\d+\.\d+\.\d+$
if: branch = master OR branch =~ ^\d+\.\d+\.\d+$ OR branch =~ concat("^(",env(TRAVIS_BRANCHES),")$")
- name: deploy
if: branch =~ ^\d+\.\d+\.\d+$

jobs:
include:
- &carthage
stage: compile
osx_image: xcode8.3
name: Carthage / Xcode 8.3
os: osx
language: objective-c
script: carthage build --no-skip-current --configuration Release
- <<: *carthage
osx_image: xcode9.2
name: Carthage / Xcode 9.2
- <<: *carthage
osx_image: xcode9.4
name: Carthage / Xcode 9.4
- <<: *carthage
osx_image: xcode10.1
name: Carthage / Xcode 10.0

# Lint stage
- &pod
stage: lint
osx_image: xcode8.3
env: SWIFT=3.1
name: pod lib lint --swift-version=3.1
osx_image: xcode10.1
env: SWIFT=3.4
name: pod lib lint --swift-version=3.4
os: osx
cache: cocoapods
language: objective-c
before_install: mv .github/PromiseKit.podspec .
install: gem install cocoapods --prerelease --version 1.6.0.beta.2
script: pod lib lint --subspec=PromiseKit/CorePromise --fail-fast --swift-version=$SWIFT
- <<: *pod
osx_image: xcode9.2
env: SWIFT=3.2
name: pod lib lint --swift-version=3.2
- <<: *pod
osx_image: xcode9.4
env: SWIFT=3.3
name: pod lib lint --swift-version=3.3
- <<: *pod
osx_image: xcode10.1
env: SWIFT=3.4
name: pod lib lint --swift-version=3.4
- <<: *pod
osx_image: xcode9.2
env: SWIFT=4.0
Expand All @@ -62,10 +47,25 @@ jobs:
env: SWIFT=4.2
name: pod lib lint --swift-version=4.2

# Compile stage - Carthage macOS builds
- &carthage
stage: compile
osx_image: xcode10.1
name: Carthage / Xcode 10.1 (Swift 3.4)
env: SWIFT_VERSION=3.4
os: osx
language: objective-c
script: carthage build --no-skip-current --configuration Release
- <<: *carthage
osx_image: xcode10.1
env: SWIFT_VERSION=4.2
name: Carthage / Xcode 10.1 (Swift 4.2)

# Compile and test stages - Linux builds
- &linux
stage: compile
env: SWIFT_BUILD_VERSION=3 SWIFT_VERSION=4.0.3
name: Linux / Swift 3.2
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.2.1
name: Linux / Swift 4.2 (compile)
os: linux
dist: trusty
sudo: required
Expand All @@ -74,29 +74,50 @@ jobs:
install: swift build -Xswiftc -swift-version -Xswiftc $SWIFT_BUILD_VERSION
script: "true"
- <<: *linux
env: SWIFT_BUILD_VERSION=3 SWIFT_VERSION=4.1.2
name: Linux / Swift 3.3
name: Linux / Swift 4.2 (test)
stage: test
script: swift test -Xswiftc -swift-version -Xswiftc $SWIFT_BUILD_VERSION
- <<: *linux
env: SWIFT_BUILD_VERSION=3 SWIFT_VERSION=4.2.1
name: Linux / Swift 3.4
name: Linux / Swift 4.1 (compile)
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.1.2
- <<: *linux
stage: test
name: Linux / Swift 4.1 (test)
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.1.2
script: swift test -Xswiftc -swift-version -Xswiftc $SWIFT_BUILD_VERSION
- <<: *linux
name: Linux / Swift 4.0 (compile)
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.0.3
name: Linux / Swift 4.0
- <<: *linux
stage: test
script: swift test -Xswiftc -swift-version -Xswiftc 4
name: Linux / Swift 4.0 (test)
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.0.3
script: swift test -Xswiftc -swift-version -Xswiftc $SWIFT_BUILD_VERSION
- <<: *linux
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.1.2
name: Linux / Swift 4.1
name: Linux / Swift 3 on tools 4.2.1 (compile)
env: SWIFT_BUILD_VERSION=3 SWIFT_VERSION=4.2.1
- <<: *linux
env: SWIFT_BUILD_VERSION=4 SWIFT_VERSION=4.2.1
name: Linux / Swift 4.2
stage: test
script: swift test -Xswiftc -swift-version -Xswiftc 4
name: Linux / Swift 3 on tools 4.2.1 (test)
env: SWIFT_BUILD_VERSION=3 SWIFT_VERSION=4.2.1
script: swift test -Xswiftc -swift-version -Xswiftc $SWIFT_BUILD_VERSION

# Compile stage - SwiftPM builds
- &swiftpm
stage: compile
name: SwiftPM / macOS / Xcode 9.4
os: osx
osx_image: xcode9.4
script: swift build
- <<: *swiftpm
osx_image: xcode10.1
name: SwiftPM / macOS / Xcode 10.1

# Test stage - macOS, iOS, and tvOS
- &test
stage: test
osx_image: xcode8.3
name: macOS / Xcode 8.3
osx_image: xcode10.1
name: macOS / Xcode 10.1 (Swift 3)
os: osx
language: objective-c
env: DST='platform=OS X,arch=x86_64'
Expand All @@ -110,31 +131,20 @@ jobs:
after_success:
bash <(curl -s https://codecov.io/bash)
- <<: *test
name: macOS / Xcode 9.2
osx_image: xcode9.2
script:
xcodebuild -scheme PromiseKit -destination="$DST" -enableCodeCoverage YES SWIFT_VERSION=4 test | xcpretty
- <<: *test
name: macOS / Xcode 9.4
osx_image: xcode9.4
script:
xcodebuild -scheme PromiseKit -destination="$DST" -enableCodeCoverage YES SWIFT_VERSION=4 test | xcpretty
- <<: *test
name: macOS / Xcode 10.0
name: macOS / Xcode 10.1 (Swift 4)
osx_image: xcode10.1
script:
xcodebuild -scheme PromiseKit -destination="$DST" -enableCodeCoverage YES SWIFT_VERSION=4 test | xcpretty

- <<: *test
name: iOS / Xcode 10.0
name: iOS / Xcode 10.1
osx_image: xcode10.1
env: DST='OS=12.0,name=iPhone SE'

- <<: *test
name: tvOS / Xcode 10.0
name: tvOS / Xcode 10.1
env: DST='OS=12.0,name=Apple TV'
osx_image: xcode10.1

# Test stage - Promises/A+
- stage: test
name: Promises/A+ (via WebKit JavaScript Bridge)
language: objective-c
Expand All @@ -155,16 +165,7 @@ jobs:
- Tests/JS-A+/build
- Tests/JS-A+/node_modules

- &swiftpm
stage: compile
name: SwiftPM / macOS / Xcode 9.4
os: osx
osx_image: xcode9.4
script: swift build
- <<: *swiftpm
osx_image: xcode10.1
name: SwiftPM / macOS / Xcode 10.0

# Deployment stage
- stage: deploy
script: |
set -eo pipefail
Expand Down
8 changes: 8 additions & 0 deletions PromiseKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
63CF6D80203CD19200EC8927 /* ThenableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CF6D7F203CD19200EC8927 /* ThenableTests.swift */; };
63D9B2EF203385FD0075C00B /* race.m in Sources */ = {isa = PBXBuildFile; fileRef = 63D9B2EE203385FD0075C00B /* race.m */; };
63D9B2F120338D5D0075C00B /* Deprecations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D9B2F020338D5D0075C00B /* Deprecations.swift */; };
BB2524DE20D729A60010F7B0 /* Dispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2524DD20D729A60010F7B0 /* Dispatcher.swift */; };
BB4AF7C520D820700008333D /* DispatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4AF7C320D819360008333D /* DispatcherTests.swift */; };
C013F7382048E3B6006B57B1 /* MockNodeEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F7372048E3B6006B57B1 /* MockNodeEnvironment.swift */; };
C013F73A2049076A006B57B1 /* JSPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F7392049076A006B57B1 /* JSPromise.swift */; };
C013F73C20494291006B57B1 /* JSAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F73B20494291006B57B1 /* JSAdapter.swift */; };
Expand Down Expand Up @@ -223,6 +225,8 @@
63CF6D7F203CD19200EC8927 /* ThenableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThenableTests.swift; sourceTree = "<group>"; };
63D9B2EE203385FD0075C00B /* race.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = race.m; path = Sources/race.m; sourceTree = "<group>"; };
63D9B2F020338D5D0075C00B /* Deprecations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Deprecations.swift; path = Sources/Deprecations.swift; sourceTree = "<group>"; };
BB2524DD20D729A60010F7B0 /* Dispatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Dispatcher.swift; path = Sources/Dispatcher.swift; sourceTree = "<group>"; };
BB4AF7C320D819360008333D /* DispatcherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatcherTests.swift; sourceTree = "<group>"; };
C013F7372048E3B6006B57B1 /* MockNodeEnvironment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MockNodeEnvironment.swift; path = "Tests/JS-A+/MockNodeEnvironment.swift"; sourceTree = "<group>"; };
C013F7392049076A006B57B1 /* JSPromise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = JSPromise.swift; path = "Tests/JS-A+/JSPromise.swift"; sourceTree = "<group>"; };
C013F73B20494291006B57B1 /* JSAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = JSAdapter.swift; path = "Tests/JS-A+/JSAdapter.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -352,6 +356,7 @@
635D640D1D59635300BC0AF5 /* ZalgoTests.swift */,
639BF755203DF02C00FA577B /* Utilities.swift */,
085B96B121A6358900E5E22F /* LoggingTests.swift */,
BB4AF7C320D819360008333D /* DispatcherTests.swift */,
);
name = Core;
path = Tests/CorePromise;
Expand Down Expand Up @@ -443,6 +448,7 @@
63B18AEB1F2D205C00B79E37 /* CustomStringConvertible.swift */,
63D9B2F020338D5D0075C00B /* Deprecations.swift */,
085B96BE21A9B37C00E5E22F /* LogEvent.swift */,
BB2524DD20D729A60010F7B0 /* Dispatcher.swift */,
);
name = Sources.swift;
sourceTree = "<group>";
Expand Down Expand Up @@ -677,6 +683,7 @@
635D64221D59635300BC0AF5 /* ZalgoTests.swift in Sources */,
635D64271D59635300BC0AF5 /* RaceTests.swift in Sources */,
632FBBE51F33B338008F8FBB /* CatchableTests.swift in Sources */,
BB4AF7C520D820700008333D /* DispatcherTests.swift in Sources */,
63CF6D80203CD19200EC8927 /* ThenableTests.swift in Sources */,
635D642B1D59635300BC0AF5 /* StressTests.swift in Sources */,
630A805A203CEF6800D25F23 /* WhenTests.m in Sources */,
Expand Down Expand Up @@ -750,6 +757,7 @@
085B96BF21A9B37C00E5E22F /* LogEvent.swift in Sources */,
6330B5E11F2E991200D60528 /* Configuration.swift in Sources */,
63B912AA1F1D7B1300D49110 /* firstly.swift in Sources */,
BB2524DE20D729A60010F7B0 /* Dispatcher.swift in Sources */,
636A29211F1C1716001229C2 /* Thenable.swift in Sources */,
632FBBE31F33B273008F8FBB /* Catchable.swift in Sources */,
63B0AC851D595E6300FA21D9 /* dispatch_promise.m in Sources */,
Expand Down
17 changes: 0 additions & 17 deletions Sources/Box.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,3 @@ final class EmptyBox<T>: Box<T> {
}
}
}


extension Optional where Wrapped: DispatchQueue {
@inline(__always)
func async(flags: DispatchWorkItemFlags?, _ body: @escaping() -> Void) {
switch self {
case .none:
body()
case .some(let q):
if let flags = flags {
q.async(flags: flags, execute: body)
} else {
q.async(execute: body)
}
}
}
}
Loading