Skip to content

Commit 32b3135

Browse files
committed
adopt swift-collections
motivation: replace TSC versions of ordered collections with the new ones from swift-collections changes: * pull in swift-collections as a dependency * update bootstrap script * adapt callsites to swift-collections * reduce redundant imports, especially in tests across Basics, TSCBasic, TSCUtilities and SPMTestSupport
1 parent e4201de commit 32b3135

File tree

235 files changed

+313
-626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+313
-626
lines changed

Package.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import class Foundation.ProcessInfo
1515

1616

1717
/** SwiftPMDataModel is the subset of SwiftPM product that includes just its data model.
18-
This allowis some clients (such as IDEs) that use SwiftPM's data model but not its build system
18+
This allows some clients (such as IDEs) that use SwiftPM's data model but not its build system
1919
to not have to depend on SwiftDriver, SwiftLLBuild, etc. We should probably have better names here,
2020
though that could break some clients.
2121
*/
@@ -33,7 +33,7 @@ let swiftPMDataModelProduct = (
3333
]
3434
)
3535

36-
/** The `libSwiftPM` set of interfaces to programatically work with Swift
36+
/** The `libSwiftPM` set of interfaces to programmatically work with Swift
3737
packages. `libSwiftPM` includes all of the SwiftPM code except the
3838
command line tools, while `libSwiftPMDataModel` includes only the data model.
3939

@@ -126,7 +126,10 @@ let package = Package(
126126

127127
.target(
128128
name: "Basics",
129-
dependencies: ["SwiftToolsSupport-auto"]),
129+
dependencies: [
130+
"SwiftToolsSupport-auto",
131+
.product(name: "OrderedCollections", package: "swift-collections")
132+
]),
130133

131134
.target(
132135
/** The llbuild manifest model */
@@ -356,12 +359,14 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
356359
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "0.4.3")),
357360
.package(url: "https://github.com/apple/swift-driver.git", .branch(relatedDependenciesBranch)),
358361
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "1.1.4")),
362+
.package(url: "https://github.com/apple/swift-collections.git", .upToNextMinor(from: "0.0.3")),
359363
]
360364
} else {
361365
package.dependencies += [
362366
.package(path: "../swift-tools-support-core"),
363367
.package(path: "../swift-argument-parser"),
364368
.package(path: "../swift-driver"),
365369
.package(path: "../swift-crypto"),
370+
.package(path: "../swift-collections"),
366371
]
367372
}

Sources/Basics/ByteString+Extensions.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
77
*/
88

9-
import TSCBasic
10-
119
extension ByteString {
1210
/// A lowercase, hexadecimal representation of the SHA256 hash
1311
/// generated for the byte string's contents.

Sources/Basics/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ add_library(Basics
1212
Dictionary+Extensions.swift
1313
DispatchTimeInterval+Extensions.swift
1414
Errors.swift
15+
Exports.swift
1516
FileSystem+Extensions.swift
1617
HTPClient+URLSession.swift
1718
HTTPClient.swift

Sources/Basics/ConcurrencyHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11+
1112
import Dispatch
1213
import class Foundation.ProcessInfo
13-
import TSCBasic
1414

1515
/// Thread-safe dictionary like structure
1616
public final class ThreadSafeKeyValueStore<Key, Value> where Key: Hashable {

Sources/Basics/Dictionary+Extensions.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
77
*/
88

9-
import TSCBasic
10-
119
extension Dictionary {
1210
@inlinable
1311
@discardableResult

Sources/Basics/Exports.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2021 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+
@_exported import OrderedCollections
12+
@_exported import TSCBasic
13+
// override TSC versions until deprecated
14+
// TODO: remove once TSC removes these
15+
public typealias OrderedSet = OrderedCollections.OrderedSet
16+
public typealias OrderedDictionary = OrderedCollections.OrderedDictionary

Sources/Basics/FileSystem+Extensions.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import TSCBasic
1211
import class Foundation.FileManager
1312

1413
// MARK: - user level

Sources/Basics/HTPClient+URLSession.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
import Foundation
12-
import TSCBasic
1312
import struct TSCUtility.Versioning
1413
#if canImport(FoundationNetworking)
1514
// FIXME: this brings OpenSSL dependency on Linux

Sources/Basics/HTTPClient.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import struct Foundation.Date
1414
import class Foundation.JSONDecoder
1515
import class Foundation.NSError
1616
import struct Foundation.URL
17-
import TSCBasic
1817
import TSCUtility
1918

2019
#if canImport(Glibc)

Sources/Basics/SQLiteBackedCache.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*/
1010

1111
import Foundation
12-
13-
import TSCBasic
1412
import TSCUtility
1513

1614
/// SQLite backed persistent cache.

0 commit comments

Comments
 (0)