diff --git a/.travis.yml b/.travis.yml index e2d832d..c337846 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/PMKStoreKit.xcodeproj/project.pbxproj b/PMKStoreKit.xcodeproj/project.pbxproj index b0179cc..bd708c8 100644 --- a/PMKStoreKit.xcodeproj/project.pbxproj +++ b/PMKStoreKit.xcodeproj/project.pbxproj @@ -94,9 +94,8 @@ D3F6DBF21EA245750013E242 /* SKPayment+Promise.swift */, D3F6DBF41EA246340013E242 /* SKReceiptRefreshRequest+Promise.swift */, ); - name = Sources; - path = "PMK+UIKit"; - sourceTree = ""; + path = Sources; + sourceTree = SOURCE_ROOT; }; 63C7FFF31D5C020D003BAE60 /* Tests */ = { isa = PBXGroup; @@ -104,9 +103,8 @@ 637B4A6F1D5D5FA400E1BC6C /* TestStoreKit.m */, 637B4A701D5D5FA400E1BC6C /* TestStoreKit.swift */, ); - name = Tests; - path = PMKTests/NS; - sourceTree = ""; + path = Tests; + sourceTree = SOURCE_ROOT; }; /* End PBXGroup section */ @@ -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; }; }; @@ -258,7 +256,9 @@ 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; @@ -266,7 +266,12 @@ 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; @@ -316,7 +321,9 @@ 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; @@ -324,7 +331,12 @@ 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; diff --git a/PMKStoreKit.xcodeproj/xcshareddata/xcschemes/PMKStoreKit.xcscheme b/PMKStoreKit.xcodeproj/xcshareddata/xcschemes/PMKStoreKit.xcscheme index 1a648fa..442d133 100644 --- a/PMKStoreKit.xcodeproj/xcshareddata/xcschemes/PMKStoreKit.xcscheme +++ b/PMKStoreKit.xcodeproj/xcshareddata/xcschemes/PMKStoreKit.xcscheme @@ -1,6 +1,6 @@ =3.2) +#else @objc override class func initialize() { NSError.registerCancelledErrorDomain(SKErrorDomain, code: SKError.Code.paymentCancelled.rawValue) } +#endif } diff --git a/Tests/TestStoreKit.swift b/Tests/TestStoreKit.swift index bdb3220..0fcd176 100644 --- a/Tests/TestStoreKit.swift +++ b/Tests/TestStoreKit.swift @@ -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() { @@ -37,4 +39,5 @@ class SKProductsRequestTests: XCTestCase { } waitForExpectations(timeout: 1, handler: nil) } +#endif }