Skip to content

Commit a8eace8

Browse files
authored
Merge pull request #3 from PromiseKit/fix-swift5-warning
Xcode 10.2; Fix Swift 5 warning
2 parents e582b67 + ca467c4 commit a8eace8

File tree

5 files changed

+95
-33
lines changed

5 files changed

+95
-33
lines changed

.travis.yml

Lines changed: 77 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,79 @@
11
os: osx
2-
language: objective-c
3-
matrix:
2+
language: swift
3+
osx_image: xcode10.2
4+
5+
branches:
6+
only:
7+
- master
8+
stages:
9+
- lint
10+
- carthage
11+
- test
12+
jobs:
413
include:
5-
- {osx_image: xcode8.3, env: 'SWFT=3.1 DST="OS=10.3.1,name=iPhone SE"'}
6-
- {osx_image: xcode9.2, env: 'SWFT=3.2 DST="OS=11.2,name=iPhone SE"'}
7-
- {osx_image: xcode9.4, env: 'SWFT=3.3 DST="OS=11.4,name=iPhone 5s"'}
8-
- {osx_image: xcode10, env: 'SWFT=3.4 DST="OS=12.0,name=iPhone SE"'}
9-
- {osx_image: xcode9.2, env: 'SWFT=4.0 DST="OS=11.2,name=iPhone SE"'}
10-
- {osx_image: xcode9.4, env: 'SWFT=4.1 DST="OS=11.4,name=iPhone 5s" TEST=1'}
11-
- {osx_image: xcode10, env: 'SWFT=4.2 DST="OS=12.0,name=iPhone SE"'}
12-
cache:
13-
directories:
14-
- Carthage
15-
before_install:
16-
- carthage bootstrap --cache-builds --no-use-binaries --platform iOS --verbose
17-
install:
18-
- xcodebuild -scheme PMKAddressBook -target PMKAddressBook -quiet -destination "$DST" SWIFT_VERSION=$SWFT SWIFT_TREAT_WARNINGS_AS_ERRORS=YES build
19-
- if [[ $TEST == "1" ]]; then
20-
xcodebuild -scheme PMKAddressBook -target PMKABTests -quiet -destination "$DST" build;
21-
fi
22-
script:
23-
- if [[ $TEST == "1" ]]; then
24-
xcodebuild -scheme PMKAddressBook -quiet -destination "$DST" test;
25-
fi
14+
- &pod
15+
stage: lint
16+
osx_image: xcode8.3
17+
env: SWIFT=3.1
18+
before_install:
19+
gem install cocoapods --prerelease --version 1.7.0.beta.3
20+
install:
21+
carthage bootstrap --no-build PromiseKit
22+
script: |
23+
cd Carthage/Checkouts/PromiseKit
24+
mv .github/PromiseKit.podspec .
25+
rm -rf Extensions/AddressBook/Sources
26+
cp -R ../../../Sources Extensions/AddressBook
27+
pod lib lint --subspec=PromiseKit/AddressBook --fail-fast --swift-version=$SWIFT
28+
- <<: *pod
29+
osx_image: xcode9.2
30+
env: SWIFT=3.2
31+
- <<: *pod
32+
osx_image: xcode9.4
33+
env: SWIFT=3.3
34+
- <<: *pod
35+
osx_image: xcode10.1
36+
env: SWIFT=3.4
37+
- <<: *pod
38+
osx_image: xcode9.2
39+
env: SWIFT=4.0
40+
- <<: *pod
41+
osx_image: xcode9.4
42+
env: SWIFT=4.1
43+
- <<: *pod
44+
osx_image: xcode10.1
45+
env: SWIFT=4.2
46+
# Fails at PromiseKit level currently
47+
# - <<: *pod
48+
# osx_image: xcode10.2
49+
# env: SWIFT=4.3
50+
# name: pod lib lint --swift-version=4.3
51+
- <<: *pod
52+
osx_image: xcode10.2
53+
env: SWIFT=5.0
54+
55+
- &carthage
56+
stage: carthage
57+
osx_image: xcode9.2
58+
script:
59+
carthage bootstrap
60+
cache:
61+
directories:
62+
- Carthage
63+
- <<: *carthage
64+
osx_image: xcode9.4
65+
- <<: *carthage
66+
osx_image: xcode10.1
67+
- <<: *carthage
68+
osx_image: xcode10.2
69+
70+
- stage: test
71+
xcode_scheme: PMKAddressBook
72+
xcode_project: PMKAddressBook.xcodeproj
73+
xcode_destination: 'platform=iOS Simulator,OS=12.2,name=iPhone SE'
74+
cache:
75+
directories:
76+
- Carthage
77+
before_install: |
78+
carthage bootstrap --cache-builds --no-use-binaries --platform iOS
79+
sed -i '' "s/SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;/SWIFT_TREAT_WARNINGS_AS_ERRORS = YES;/" *.xcodeproj/project.pbxproj

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "mxcl/PromiseKit" "6.3.3"
1+
github "mxcl/PromiseKit" "6.8.4"

PMKAddressBook.xcodeproj/project.pbxproj

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,27 +135,28 @@
135135
isa = PBXProject;
136136
attributes = {
137137
LastSwiftUpdateCheck = 0800;
138-
LastUpgradeCheck = 1000;
138+
LastUpgradeCheck = 1020;
139139
ORGANIZATIONNAME = "Max Howell";
140140
TargetAttributes = {
141141
63C7FFA61D5BEE09003BAE60 = {
142142
CreatedOnToolsVersion = 8.0;
143-
LastSwiftMigration = 0900;
143+
LastSwiftMigration = 1020;
144144
ProvisioningStyle = Automatic;
145145
};
146146
63C7FFF11D5C020D003BAE60 = {
147147
CreatedOnToolsVersion = 8.0;
148-
LastSwiftMigration = 0900;
148+
LastSwiftMigration = 1020;
149149
ProvisioningStyle = Automatic;
150150
};
151151
};
152152
};
153153
buildConfigurationList = 63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKAddressBook" */;
154154
compatibilityVersion = "Xcode 3.2";
155-
developmentRegion = English;
155+
developmentRegion = en;
156156
hasScannedForEncodings = 0;
157157
knownRegions = (
158158
en,
159+
Base,
159160
);
160161
mainGroup = 63C7FF9D1D5BEE09003BAE60;
161162
productRefGroup = 63C7FFA81D5BEE09003BAE60 /* Products */;
@@ -219,6 +220,7 @@
219220
baseConfigurationReference = 63BF28101D5C257100F62C66 /* Carthage.xcconfig */;
220221
buildSettings = {
221222
ALWAYS_SEARCH_USER_PATHS = NO;
223+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
222224
CLANG_ANALYZER_NONNULL = YES;
223225
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
224226
CLANG_CXX_LIBRARY = "libc++";
@@ -273,7 +275,7 @@
273275
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
274276
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
275277
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
276-
SWIFT_VERSION = 3.0;
278+
SWIFT_VERSION = 4.0;
277279
TARGETED_DEVICE_FAMILY = "1,2,3,4";
278280
TVOS_DEPLOYMENT_TARGET = 9.0;
279281
VERSIONING_SYSTEM = "apple-generic";
@@ -287,6 +289,7 @@
287289
baseConfigurationReference = 63BF28101D5C257100F62C66 /* Carthage.xcconfig */;
288290
buildSettings = {
289291
ALWAYS_SEARCH_USER_PATHS = NO;
292+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
290293
CLANG_ANALYZER_NONNULL = YES;
291294
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
292295
CLANG_CXX_LIBRARY = "libc++";
@@ -333,7 +336,7 @@
333336
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
334337
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
335338
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
336-
SWIFT_VERSION = 3.0;
339+
SWIFT_VERSION = 4.0;
337340
TARGETED_DEVICE_FAMILY = "1,2,3,4";
338341
TVOS_DEPLOYMENT_TARGET = 9.0;
339342
VALIDATE_PRODUCT = YES;
@@ -358,6 +361,7 @@
358361
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
359362
PRODUCT_NAME = "$(TARGET_NAME)";
360363
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
364+
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
361365
};
362366
name = Debug;
363367
};
@@ -375,6 +379,7 @@
375379
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.AddressBook;
376380
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
377381
PRODUCT_NAME = "$(TARGET_NAME)";
382+
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
378383
};
379384
name = Release;
380385
};
@@ -387,7 +392,6 @@
387392
PRODUCT_NAME = "$(TARGET_NAME)";
388393
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
389394
SWIFT_SUPPRESS_WARNINGS = YES;
390-
SWIFT_VERSION = 4.0;
391395
};
392396
name = Debug;
393397
};
@@ -399,7 +403,6 @@
399403
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
400404
PRODUCT_NAME = "$(TARGET_NAME)";
401405
SWIFT_SUPPRESS_WARNINGS = YES;
402-
SWIFT_VERSION = 4.0;
403406
};
404407
name = Release;
405408
};

PMKAddressBook.xcodeproj/xcshareddata/xcschemes/PMKAddressBook.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1000"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Sources/ABAddressBookRequestAccess+Promise.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public func ABAddressBookRequestAccess() -> Promise<ABAddressBook> {
6767
throw AddressBookError.denied
6868
case .authorized:
6969
fatalError("This should not happen")
70+
#if swift(>=4.3)
71+
@unknown default:
72+
print("warning: PromiseKit: unknown case statement, please PR a fix!")
73+
throw AddressBookError.denied
74+
#endif
7075
}
7176
}
7277

0 commit comments

Comments
 (0)