File tree Expand file tree Collapse file tree 11 files changed +176
-5
lines changed Expand file tree Collapse file tree 11 files changed +176
-5
lines changed Original file line number Diff line number Diff line change 88 See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99*/
1010
11- import class Foundation. NSLock
11+ import Foundation
1212
1313/// A simple lock wrapper.
1414public struct Lock {
15+ #if os(OSX)
16+ private var _lock = Foundation . Lock ( )
17+ #else
1518 private var _lock = NSLock ( )
19+ #endif
1620
1721 /// Create a new lock.
1822 public init ( ) {
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSJSONSerialization = JSONSerialization
20+
21+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSProcessInfo = ProcessInfo
20+
21+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSProcessInfo = ProcessInfo
20+
21+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSProcessInfo = ProcessInfo
20+
21+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSFileHandle = FileHandle
20+ public typealias NSFileManager = FileManager
21+ public typealias NSJSONSerialization = JSONSerialization
22+ public typealias NSProcessInfo = ProcessInfo
23+
24+ public let NSUTF8StringEncoding = String . Encoding. utf8
25+
26+ extension NSJSONSerialization {
27+ public static func jsonObject( with data: NSData , options: JSONSerialization . ReadingOptions ) throws -> AnyObject {
28+ return try JSONSerialization . jsonObject ( with: data as Data , options: options)
29+ }
30+ }
31+
32+ extension NSFileHandle {
33+ public func write( _ data: NSData ) {
34+ write ( data as Data )
35+ }
36+ }
37+
38+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSBundle = Bundle
20+ public typealias NSFileHandle = FileHandle
21+ public typealias NSFileManager = FileManager
22+ public typealias NSJSONSerialization = JSONSerialization
23+
24+ #endif
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import Basic
1515class LockTests : XCTestCase {
1616 func testBasics( ) {
1717 // FIXME: Make this a more interesting test once we have concurrency primitives.
18- var lock = Lock ( )
18+ var lock = Basic . Lock ( )
1919 var count = 0
2020 let N = 100
2121 for _ in 0 ..< N {
Original file line number Diff line number Diff line change 1+ /*
2+ This source file is part of the Swift.org open source project
3+
4+ Copyright 2016 Apple Inc. and the Swift project authors
5+ Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+ See http://swift.org/LICENSE.txt for license information
8+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
10+ -------------------------------------------------------------------------
11+
12+ Platform-specific shims for the Swift3 transition.
13+ */
14+
15+ #if os(OSX)
16+
17+ import Foundation
18+
19+ public typealias NSBundle = Bundle
20+
21+ #endif
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import POSIX
1414import Utility
1515
1616#if os(OSX)
17- import class Foundation. NSBundle
17+ import class Foundation. Bundle
1818#endif
1919
2020
@@ -107,7 +107,7 @@ enum SwiftPMProduct {
107107 /// Path to currently built binary.
108108 var path : String {
109109 #if os(OSX)
110- for bundle in NSBundle . allBundles ( ) where bundle. bundlePath. hasSuffix ( " .xctest " ) {
110+ for bundle in Bundle . allBundles ( ) where bundle. bundlePath. hasSuffix ( " .xctest " ) {
111111 return Path . join ( bundle. bundlePath. parentDirectory, exec)
112112 }
113113 fatalError ( )
You can’t perform that action at this time.
0 commit comments