Skip to content

Commit 0fe264f

Browse files
authored
Merge pull request #194 from spevans/pr_swift4
Swift4: Update to use swift 4 syntax
2 parents 6d99bc0 + 064373e commit 0fe264f

File tree

6 files changed

+37
-15
lines changed

6 files changed

+37
-15
lines changed

Tests/Functional/Asynchronous/Predicates/Handler/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PredicateHandlerTestCase: XCTestCase {
1818
func test_predicateIsTrue_handlerReturnsTrue_passes() {
1919
let predicate = NSPredicate(value: true)
2020
let object = NSObject()
21-
self.expectation(for: predicate, evaluatedWith: object, handler: { _ in
21+
self.expectation(for: predicate, evaluatedWith: object, handler: {
2222
return true
2323
})
2424
waitForExpectations(timeout: 0.1)
@@ -29,7 +29,7 @@ class PredicateHandlerTestCase: XCTestCase {
2929
func test_predicateIsTrue_handlerReturnsFalse_fails() {
3030
let predicate = NSPredicate(value: true)
3131
let object = NSObject()
32-
self.expectation(for: predicate, evaluatedWith: object, handler: { _ in
32+
self.expectation(for: predicate, evaluatedWith: object, handler: {
3333
return false
3434
})
3535
waitForExpectations(timeout: 0.1)
@@ -46,7 +46,7 @@ class PredicateHandlerTestCase: XCTestCase {
4646
}
4747
return false
4848
})
49-
expectation(for: predicate, evaluatedWith: halfSecLaterDate, handler: { _ in
49+
expectation(for: predicate, evaluatedWith: halfSecLaterDate, handler: {
5050
XCTFail("Should not call the predicate expectation handler")
5151
return true
5252
})

Tests/Functional/lit.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def _getenv(name):
3737
return value
3838

3939
built_products_dir = _getenv('BUILT_PRODUCTS_DIR')
40-
# Force tests to build with -swift-version 3 for now.
40+
# Force tests to build with -swift-version 4 for now.
4141
swift_exec = [
4242
_getenv('SWIFT_EXEC'),
43-
'-swift-version', '3',
43+
'-swift-version', '4',
4444
'-Xlinker', '-rpath',
4545
'-Xlinker', built_products_dir,
4646
'-L', built_products_dir,

XCTest.xcodeproj/project.pbxproj

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@
279279
attributes = {
280280
LastSwiftMigration = 0730;
281281
LastSwiftUpdateCheck = 0730;
282-
LastUpgradeCheck = 0800;
282+
LastUpgradeCheck = 0900;
283283
ORGANIZATIONNAME = Apple;
284284
TargetAttributes = {
285285
5B5D86DA1BBC74AD00234F36 = {
286286
CreatedOnToolsVersion = 7.1;
287-
LastSwiftMigration = 0800;
287+
LastSwiftMigration = 0900;
288288
};
289289
DAA333B51C267AD6000CC115 = {
290290
CreatedOnToolsVersion = 7.2;
@@ -376,14 +376,20 @@
376376
CLANG_CXX_LIBRARY = "libc++";
377377
CLANG_ENABLE_MODULES = YES;
378378
CLANG_ENABLE_OBJC_ARC = YES;
379+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
379380
CLANG_WARN_BOOL_CONVERSION = YES;
381+
CLANG_WARN_COMMA = YES;
380382
CLANG_WARN_CONSTANT_CONVERSION = YES;
381383
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
382384
CLANG_WARN_EMPTY_BODY = YES;
383385
CLANG_WARN_ENUM_CONVERSION = YES;
384386
CLANG_WARN_INFINITE_RECURSION = YES;
385387
CLANG_WARN_INT_CONVERSION = YES;
388+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
389+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
386390
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
391+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
392+
CLANG_WARN_STRICT_PROTOTYPES = YES;
387393
CLANG_WARN_SUSPICIOUS_MOVE = YES;
388394
CLANG_WARN_UNREACHABLE_CODE = YES;
389395
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -416,7 +422,8 @@
416422
SDKROOT = macosx;
417423
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
418424
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
419-
SWIFT_VERSION = 3.0;
425+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
426+
SWIFT_VERSION = 4.0;
420427
VERSIONING_SYSTEM = "apple-generic";
421428
VERSION_INFO_PREFIX = "";
422429
};
@@ -430,14 +437,20 @@
430437
CLANG_CXX_LIBRARY = "libc++";
431438
CLANG_ENABLE_MODULES = YES;
432439
CLANG_ENABLE_OBJC_ARC = YES;
440+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
433441
CLANG_WARN_BOOL_CONVERSION = YES;
442+
CLANG_WARN_COMMA = YES;
434443
CLANG_WARN_CONSTANT_CONVERSION = YES;
435444
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
436445
CLANG_WARN_EMPTY_BODY = YES;
437446
CLANG_WARN_ENUM_CONVERSION = YES;
438447
CLANG_WARN_INFINITE_RECURSION = YES;
439448
CLANG_WARN_INT_CONVERSION = YES;
449+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
450+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
440451
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
452+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
453+
CLANG_WARN_STRICT_PROTOTYPES = YES;
441454
CLANG_WARN_SUSPICIOUS_MOVE = YES;
442455
CLANG_WARN_UNREACHABLE_CODE = YES;
443456
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -462,7 +475,8 @@
462475
PRODUCT_NAME = SwiftXCTest;
463476
SDKROOT = macosx;
464477
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
465-
SWIFT_VERSION = 3.0;
478+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
479+
SWIFT_VERSION = 4.0;
466480
VERSIONING_SYSTEM = "apple-generic";
467481
VERSION_INFO_PREFIX = "";
468482
};
@@ -485,10 +499,12 @@
485499
"-framework",
486500
SwiftFoundation,
487501
);
488-
OTHER_SWIFT_FLAGS = "-swift-version 3";
502+
OTHER_SWIFT_FLAGS = "-swift-version 4";
489503
PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK;
490504
SKIP_INSTALL = YES;
491505
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
506+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
507+
SWIFT_VERSION = 4.0;
492508
TARGETED_DEVICE_FAMILY = "1,2,3,4";
493509
TVOS_DEPLOYMENT_TARGET = 10.0;
494510
USER_HEADER_SEARCH_PATHS = $BUILT_PRODUCTS_DIR/usr/local/include/CoreFoundation;
@@ -510,10 +526,12 @@
510526
"-framework",
511527
SwiftFoundation,
512528
);
513-
OTHER_SWIFT_FLAGS = "-swift-version 3";
529+
OTHER_SWIFT_FLAGS = "-swift-version 4";
514530
PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK;
515531
SKIP_INSTALL = YES;
516532
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
533+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
534+
SWIFT_VERSION = 4.0;
517535
TARGETED_DEVICE_FAMILY = "1,2,3,4";
518536
TVOS_DEPLOYMENT_TARGET = 10.0;
519537
USER_HEADER_SEARCH_PATHS = $BUILT_PRODUCTS_DIR/usr/local/include/CoreFoundation;

XCTest.xcodeproj/xcshareddata/xcschemes/SwiftXCTest.xcscheme

Lines changed: 3 additions & 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 = "0830"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "NO"
@@ -40,6 +40,7 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
language = ""
4344
shouldUseLaunchSchemeArgsEnv = "YES">
4445
<Testables>
4546
</Testables>
@@ -59,6 +60,7 @@
5960
buildConfiguration = "Debug"
6061
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
6162
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
63+
language = ""
6264
launchStyle = "0"
6365
useCustomWorkingDirectory = "NO"
6466
ignoresPersistentStateOnLaunch = "NO"

XCTest.xcodeproj/xcshareddata/xcschemes/SwiftXCTestFunctionalTests.xcscheme

Lines changed: 3 additions & 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 = "0830"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "NO"
@@ -54,6 +54,7 @@
5454
buildConfiguration = "Debug"
5555
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5656
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
language = ""
5758
shouldUseLaunchSchemeArgsEnv = "YES">
5859
<Testables>
5960
</Testables>
@@ -73,6 +74,7 @@
7374
buildConfiguration = "Debug"
7475
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7576
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
77+
language = ""
7678
launchStyle = "0"
7779
useCustomWorkingDirectory = "NO"
7880
ignoresPersistentStateOnLaunch = "NO"

build_script.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ def build(args):
183183
else:
184184
libdispatch_args = ""
185185

186-
# NOTE: Force -swift-version 3 to build XCTest sources.
186+
# NOTE: Force -swift-version 4 to build XCTest sources.
187187
run("{swiftc} -Xcc -fblocks -c {style_options} -emit-object -emit-module "
188188
"-module-name XCTest -module-link-name XCTest -parse-as-library "
189189
"-emit-module-path {build_dir}/XCTest.swiftmodule "
190190
"-force-single-frontend-invocation "
191-
"-swift-version 3 "
191+
"-swift-version 4 "
192192
"-I {foundation_build_dir} -I {core_foundation_build_dir} "
193193
"{libdispatch_args} "
194194
"{source_paths} -o {build_dir}/XCTest.o".format(

0 commit comments

Comments
 (0)