Skip to content

Commit

Permalink
Support Swift 4; Test all configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Aug 26, 2017
1 parent bf07108 commit a56c183
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 22 deletions.
60 changes: 48 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,57 @@
os: osx
language: objective-c
osx_image: xcode8.3
env:
- PLATFORM=Mac
- PLATFORM=iOS NAME='iPhone SE'
- PLATFORM=tvOS NAME='Apple TV 1080p'
matrix:
include:
- osx_image: xcode8.2
env: PLAT=macOS SWFT=3.0
- osx_image: xcode8.2
env: PLAT=iOS SWFT=3.0
- osx_image: xcode8.2
env: PLAT=tvOS SWFT=3.0
- osx_image: xcode8.3
env: PLAT=macOS SWFT=3.1
- osx_image: xcode8.3
env: PLAT=iOS SWFT=3.1
- osx_image: xcode8.3
env: PLAT=tvOS SWFT=3.1
- osx_image: xcode9
env: PLAT=macOS SWFT=3.2
- osx_image: xcode9
env: PLAT=iOS SWFT=3.2
- osx_image: xcode9
env: PLAT=tvOS SWFT=3.2
- osx_image: xcode9
env: PLAT=macOS SWFT=4.0
- osx_image: xcode9
env: PLAT=iOS SWFT=4.0
- osx_image: xcode9
env: PLAT=tvOS SWFT=4.0
before_install:
- if [ -n "$NAME" ]; then
- case $PLAT in
iOS)
NAME="iPhone SE";;
tvOS)
NAME="Apple TV 1080p";;
esac;
if [ -n "$NAME" ]; then
export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /$NAME .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
export DESTINATION="id=$UUID";
fi
install:
- carthage bootstrap --platform $PLATFORM
- case $PLAT in
macOS)
carthage bootstrap --platform Mac;;
tvOS|iOS)
carthage bootstrap --platform $PLAT;;
esac;
script:
- set -o pipefail;
case $PLATFORM in
Mac)
xcodebuild -scheme PMKStoreKit test | xcpretty;;
case $PLAT in
macOS)
xcodebuild -scheme PMKStoreKit -quiet build clean SWIFT_VERSION=$SWFT;
xcodebuild -scheme PMKStoreKit -quiet test;;
iOS|tvOS)
open -a "simulator" --args -CurrentDeviceUDID "$UUID";
xcodebuild -scheme PMKStoreKit -destination "id=$UUID" test | xcpretty;;
open -b com.apple.iphonesimulator --args -CurrentDeviceUDID "$UUID";
xcodebuild -scheme PMKStoreKit -quiet -destination "$DESTINATION" build clean SWIFT_VERSION=$SWFT;
xcodebuild -scheme PMKStoreKit -quiet -destination "$DESTINATION" test;;
esac
30 changes: 21 additions & 9 deletions PMKStoreKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,17 @@
D3F6DBF21EA245750013E242 /* SKPayment+Promise.swift */,
D3F6DBF41EA246340013E242 /* SKReceiptRefreshRequest+Promise.swift */,
);
name = Sources;
path = "PMK+UIKit";
sourceTree = "<group>";
path = Sources;
sourceTree = SOURCE_ROOT;
};
63C7FFF31D5C020D003BAE60 /* Tests */ = {
isa = PBXGroup;
children = (
637B4A6F1D5D5FA400E1BC6C /* TestStoreKit.m */,
637B4A701D5D5FA400E1BC6C /* TestStoreKit.swift */,
);
name = Tests;
path = PMKTests/NS;
sourceTree = "<group>";
path = Tests;
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */

Expand Down Expand Up @@ -165,17 +163,17 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Max Howell";
TargetAttributes = {
63C7FFA61D5BEE09003BAE60 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
63C7FFF11D5C020D003BAE60 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -258,15 +256,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -316,15 +321,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -69,6 +70,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
3 changes: 3 additions & 0 deletions Sources/SKProductsRequest+Promise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ fileprivate class SKDelegate: NSObject, SKProductsRequestDelegate {
retainCycle = nil
}

#if swift(>=3.2)
#else
@objc override class func initialize() {
NSError.registerCancelledErrorDomain(SKErrorDomain, code: SKError.Code.paymentCancelled.rawValue)
}
#endif
}
3 changes: 3 additions & 0 deletions Tests/TestStoreKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SKProductsRequestTests: XCTestCase {
waitForExpectations(timeout: 1, handler: nil)
}

#if swift(>=3.2)
#else
func testCancellation() {
class MockProductsRequest: SKProductsRequest {
override func start() {
Expand All @@ -37,4 +39,5 @@ class SKProductsRequestTests: XCTestCase {
}
waitForExpectations(timeout: 1, handler: nil)
}
#endif
}

0 comments on commit a56c183

Please sign in to comment.