Skip to content

Commit 9980d4a

Browse files
committed
Swift4 Only changes and set swift-version to 4
Set xcode project to use Swift 4
1 parent ccb2fde commit 9980d4a

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

Foundation.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,15 +2594,15 @@
25942594
r,
25952595
r,
25962596
);
2597-
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -DDEPLOYMENT_RUNTIME_SWIFT -swift-version 3";
2597+
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -DDEPLOYMENT_RUNTIME_SWIFT -swift-version 4";
25982598
PRODUCT_BUNDLE_IDENTIFIER = org.swift.Foundation;
25992599
PRODUCT_NAME = "$(TARGET_NAME)";
26002600
SKIP_INSTALL = YES;
26012601
SWIFT_INDEX_STORE_ENABLE = NO;
26022602
SWIFT_INSTALL_OBJC_HEADER = NO;
26032603
SWIFT_OBJC_INTERFACE_HEADER_NAME = "";
26042604
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
2605-
SWIFT_VERSION = 3.0;
2605+
SWIFT_VERSION = 4.0;
26062606
};
26072607
name = Debug;
26082608
};
@@ -2667,14 +2667,14 @@
26672667
r,
26682668
r,
26692669
);
2670-
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -DDEPLOYMENT_RUNTIME_SWIFT -swift-version 3";
2670+
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -DDEPLOYMENT_RUNTIME_SWIFT -swift-version 4";
26712671
PRODUCT_BUNDLE_IDENTIFIER = org.swift.Foundation;
26722672
PRODUCT_NAME = "$(TARGET_NAME)";
26732673
SKIP_INSTALL = YES;
26742674
SWIFT_INDEX_STORE_ENABLE = NO;
26752675
SWIFT_INSTALL_OBJC_HEADER = NO;
26762676
SWIFT_OBJC_INTERFACE_HEADER_NAME = "";
2677-
SWIFT_VERSION = 3.0;
2677+
SWIFT_VERSION = 4.0;
26782678
};
26792679
name = Release;
26802680
};
@@ -2716,7 +2716,7 @@
27162716
PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/CoreFoundation;
27172717
PRODUCT_NAME = "$(TARGET_NAME)";
27182718
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/CoreFoundation;
2719-
SWIFT_VERSION = 3.0;
2719+
SWIFT_VERSION = 4.0;
27202720
};
27212721
name = Debug;
27222722
};
@@ -2758,7 +2758,7 @@
27582758
PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/CoreFoundation;
27592759
PRODUCT_NAME = "$(TARGET_NAME)";
27602760
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/CoreFoundation;
2761-
SWIFT_VERSION = 3.0;
2761+
SWIFT_VERSION = 4.0;
27622762
};
27632763
name = Release;
27642764
};
@@ -2778,12 +2778,12 @@
27782778
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
27792779
LIBRARY_SEARCH_PATHS = "$(inherited)";
27802780
MACH_O_TYPE = mh_execute;
2781-
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -swift-version 3";
2781+
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -swift-version 4";
27822782
PRODUCT_BUNDLE_IDENTIFIER = org.swift.TestFoundation;
27832783
PRODUCT_NAME = "$(TARGET_NAME)";
27842784
SKIP_INSTALL = YES;
27852785
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
2786-
SWIFT_VERSION = 3.0;
2786+
SWIFT_VERSION = 4.0;
27872787
WRAPPER_EXTENSION = app;
27882788
};
27892789
name = Debug;
@@ -2804,11 +2804,11 @@
28042804
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
28052805
LIBRARY_SEARCH_PATHS = "$(inherited)";
28062806
MACH_O_TYPE = mh_execute;
2807-
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -swift-version 3";
2807+
OTHER_SWIFT_FLAGS = "-DDEPLOYMENT_ENABLE_LIBDISPATCH -swift-version 4";
28082808
PRODUCT_BUNDLE_IDENTIFIER = org.swift.TestFoundation;
28092809
PRODUCT_NAME = "$(TARGET_NAME)";
28102810
SKIP_INSTALL = YES;
2811-
SWIFT_VERSION = 3.0;
2811+
SWIFT_VERSION = 4.0;
28122812
WRAPPER_EXTENSION = app;
28132813
};
28142814
name = Release;
@@ -2863,7 +2863,7 @@
28632863
HEADER_SEARCH_PATHS = "$(CONFIGURATION_BUILD_DIR)/usr/local/include";
28642864
PRODUCT_NAME = "$(TARGET_NAME)";
28652865
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
2866-
SWIFT_VERSION = 3.0;
2866+
SWIFT_VERSION = 4.0;
28672867
};
28682868
name = Debug;
28692869
};
@@ -2874,7 +2874,7 @@
28742874
CLANG_ENABLE_OBJC_ARC = YES;
28752875
HEADER_SEARCH_PATHS = "$(CONFIGURATION_BUILD_DIR)/usr/local/include";
28762876
PRODUCT_NAME = "$(TARGET_NAME)";
2877-
SWIFT_VERSION = 3.0;
2877+
SWIFT_VERSION = 4.0;
28782878
};
28792879
name = Release;
28802880
};

Foundation/NSIndexSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ open class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
400400
lock.unlock()
401401
if stop { return }
402402

403-
let idx = rangeSequence.index(rangeSequence.startIndex, offsetBy: IntMax(rangeIdx))
403+
let idx = rangeSequence.index(rangeSequence.startIndex, offsetBy: Int64(rangeIdx))
404404
let curRange = rangeSequence[idx]
405405
let intersection = NSIntersectionRange(curRange, range)
406406
if passRanges {

Foundation/NSURLSession/http/HTTPBodySource.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ internal final class _HTTPBodyFileSource {
124124
var fileSystemRepresentation: UnsafePointer<Int8>! = nil
125125
fileURL.withUnsafeFileSystemRepresentation {
126126
fileSystemRepresentation = $0
127-
}
128-
self.channel = DispatchIO(type: .stream, path: fileSystemRepresentation, oflag: O_RDONLY, mode: 0, queue: workQueue, cleanupHandler: {_ in })
127+
}
128+
guard let channel = DispatchIO(type: .stream, path: fileSystemRepresentation,
129+
oflag: O_RDONLY, mode: 0, queue: workQueue,
130+
cleanupHandler: {_ in }) else {
131+
fatalError("Cant create DispatchIO channel")
132+
}
133+
self.channel = channel
129134
self.channel.setLimit(highWater: CFURLSessionMaxWriteSize)
130135
}
131136

lib/phases.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ def generate(self):
172172
generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.ROOT_HEADERS_FOLDER_PATH
173173
generated += " -I" + Configuration.current.build_directory.relative()
174174
swiftflags = TargetConditional.value(self.product.SWIFTCFLAGS)
175-
# Force building in Swift 3 compatibility mode.
176-
swiftflags += " -swift-version 3"
175+
# Force building in Swift 4 compatibility mode.
176+
swiftflags += " -swift-version 4"
177177
if swiftflags is not None:
178178
generated += " " + swiftflags
179179
return generated
@@ -431,10 +431,10 @@ def generate(self):
431431
if resource is None:
432432
continue
433433
swiftSources += " " + resource.relative()
434-
# Note: Fix -swift-version 3 for now.
434+
# Note: Fix -swift-version 4 for now.
435435
return """
436436
build """ + appName + """: SwiftExecutable """ + swiftSources + self.generate_dependencies(libDependencyName) + """
437-
flags = -swift-version 3 -I""" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.ROOT_HEADERS_FOLDER_PATH + " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + " -L" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + " " + TargetConditional.value(self.product.SWIFTCFLAGS) + """
437+
flags = -swift-version 4 -I""" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.ROOT_HEADERS_FOLDER_PATH + " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + " -L" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + " " + TargetConditional.value(self.product.SWIFTCFLAGS) + """
438438
build """ + self.executableName + """: phony | """ + appName + """
439439
"""
440440

0 commit comments

Comments
 (0)