Skip to content

Commit 9dbb9a0

Browse files
authored
Revert "adopt swift-collections (#3595)"
This reverts commit 0b0ac51.
1 parent 91f816c commit 9dbb9a0

13 files changed

+37
-69
lines changed

CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} Windows CMAKE_INSTALL_DEFAULT)
3737
option(USE_CMAKE_INSTALL
3838
"Install build products using cmake's install() instead of the bootstrap script's install()"
3939
${CMAKE_INSTALL_DEFAULT})
40-
40+
4141
if(BUILD_SHARED_LIBS)
4242
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
4343
endif()
@@ -53,7 +53,6 @@ if(FIND_PM_DEPS)
5353
find_package(ArgumentParser CONFIG REQUIRED)
5454
find_package(SwiftCrypto CONFIG REQUIRED)
5555
find_package(SwiftDriver CONFIG REQUIRED)
56-
find_package(SwiftCollections CONFIG REQUIRED)
5756
endif()
5857

5958
find_package(dispatch QUIET)

CONTRIBUTING.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Please refer to the [_Get Started_ guide](https://github.com/apple/swift/blob/ma
132132
Clone the following repositories beside the SwiftPM directory:
133133

134134
1. [swift-argument-parser] and check out tag with the [latest version](https://github.com/apple/swift-argument-parser/tags).
135-
135+
136136
For example, if the latest tag is 0.4.3:
137137
```sh
138138
$> git clone https://github.com/apple/swift-argument-parser --branch 0.4.3
@@ -150,7 +150,7 @@ Clone the following repositories beside the SwiftPM directory:
150150
```
151151

152152
4. [Yams] and checkout tag with the [latest version](https://github.com/jpsim/Yams.git/tags) before 5.0.0.
153-
153+
154154
For example, if the latest tag is 4.0.6:
155155
```sh
156156
$> git clone https://github.com/jpsim/yams --branch 4.0.6
@@ -162,21 +162,13 @@ Clone the following repositories beside the SwiftPM directory:
162162
```
163163

164164
6. [swift-crypto] and check out tag with the [latest version](https://github.com/apple/swift-crypto/tags).
165-
165+
166166
For example, if the latest tag is 1.1.6:
167167
```sh
168168
$> git clone https://github.com/apple/swift-crypto --branch 1.1.6
169169
```
170170

171-
7. [swift-collections] and check out tag with the [latest version](https://github.com/apple/swift-collections/tags).
172-
173-
For example, if the latest tag is 0.0.4:
174-
```sh
175-
$> git clone https://github.com/apple/swift-collections --branch 0.0.4
176-
```
177-
178171
[swift-argument-parser]: https://github.com/apple/swift-argument-parser
179-
[swift-collections]: https://github.com/apple/swift-collections
180172
[swift-crypto]: https://github.com/apple/swift-crypto
181173
[swift-driver]: https://github.com/apple/swift-driver
182174
[swift-llbuild]: https://github.com/apple/swift-llbuild
@@ -393,3 +385,4 @@ $> swift package update
393385
```
394386
Alternatively, if you are using Xcode, you can update to the latest version of all packages:
395387
**Xcode App** > *File* > *Swift Packages* > *Update to Latest Package Versions*
388+

Package.swift

+3-8
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 allows some clients (such as IDEs) that use SwiftPM's data model but not its build system
18+
This allowis 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 programmatically work with Swift
36+
/** The `libSwiftPM` set of interfaces to programatically 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,10 +126,7 @@ let package = Package(
126126

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

134131
.target(
135132
/** The llbuild manifest model */
@@ -359,14 +356,12 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
359356
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "0.4.3")),
360357
.package(url: "https://github.com/apple/swift-driver.git", .branch(relatedDependenciesBranch)),
361358
.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.4")),
363359
]
364360
} else {
365361
package.dependencies += [
366362
.package(path: "../swift-tools-support-core"),
367363
.package(path: "../swift-argument-parser"),
368364
.package(path: "../swift-driver"),
369365
.package(path: "../swift-crypto"),
370-
.package(path: "../swift-collections"),
371366
]
372367
}

Sources/Basics/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ add_library(Basics
1212
Dictionary+Extensions.swift
1313
DispatchTimeInterval+Extensions.swift
1414
Errors.swift
15-
Exports.swift
1615
FileSystem+Extensions.swift
1716
HTPClient+URLSession.swift
1817
HTTPClient.swift
@@ -22,7 +21,6 @@ add_library(Basics
2221
SQLiteBackedCache.swift
2322
Version+Extensions.swift)
2423
target_link_libraries(Basics PUBLIC
25-
SwiftCollections::OrderedCollections
2624
TSCBasic
2725
TSCUtility)
2826
target_link_libraries(Basics PRIVATE

Sources/Basics/Exports.swift

-14
This file was deleted.

Sources/Build/BuildPlan.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ public class BuildPlan {
19871987
}
19881988

19891989
// Build cache
1990-
var cflagsCache: Basics.OrderedSet<String> = []
1990+
var cflagsCache: OrderedSet<String> = []
19911991
var libsCache: [String] = []
19921992
for tuple in ret {
19931993
for cFlag in tuple.cFlags {

Sources/PackageGraph/PackageGraph+Loading.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ fileprivate func findCycle(
611611
successors: (GraphLoadingNode) throws -> [GraphLoadingNode]
612612
) rethrows -> (path: [Manifest], cycle: [Manifest])? {
613613
// Ordered set to hold the current traversed path.
614-
var path = Basics.OrderedSet<Manifest>()
614+
var path = OrderedSet<Manifest>()
615615

616616
// Function to visit nodes recursively.
617617
// FIXME: Convert to stack.
@@ -620,7 +620,7 @@ fileprivate func findCycle(
620620
_ successors: (GraphLoadingNode) throws -> [GraphLoadingNode]
621621
) rethrows -> (path: [Manifest], cycle: [Manifest])? {
622622
// If this node is already in the current path then we have found a cycle.
623-
if !path.append(node.manifest).inserted {
623+
if !path.append(node.manifest) {
624624
let index = path.firstIndex(of: node.manifest)! // forced unwrap safe
625625
return (Array(path[path.startIndex..<index]), Array(path[index..<path.endIndex]))
626626
}

Sources/PackageGraph/Pubgrub/Incompatibility.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ import PackageModel
1616
/// all be true at the same time. In dependency resolution, these are derived
1717
/// from version requirements and when running into unresolvable situations.
1818
public struct Incompatibility: Equatable, Hashable {
19-
public let terms: Basics.OrderedSet<Term>
19+
public let terms: OrderedSet<Term>
2020
public let cause: Cause
2121

22-
public init(terms: Basics.OrderedSet<Term>, cause: Cause) {
22+
public init(terms: OrderedSet<Term>, cause: Cause) {
2323
self.terms = terms
2424
self.cause = cause
2525
}
2626

2727
public init(_ terms: Term..., root: DependencyResolutionNode, cause: Cause = .root) throws {
28-
let termSet = Basics.OrderedSet(terms)
28+
let termSet = OrderedSet(terms)
2929
try self.init(termSet, root: root, cause: cause)
3030
}
3131

32-
public init(_ terms: Basics.OrderedSet<Term>, root: DependencyResolutionNode, cause: Cause) throws {
32+
public init(_ terms: OrderedSet<Term>, root: DependencyResolutionNode, cause: Cause) throws {
3333
if terms.isEmpty {
3434
self.init(terms: terms, cause: cause)
3535
return
@@ -43,7 +43,7 @@ public struct Incompatibility: Equatable, Hashable {
4343
terms = OrderedSet(terms.filter { !$0.isPositive || $0.node != root })
4444
}
4545

46-
let normalizedTerms = try normalize(terms: terms.elements)
46+
let normalizedTerms = try normalize(terms: terms.contents)
4747
assert(normalizedTerms.count > 0,
4848
"An incompatibility must contain at least one term after normalization.")
4949
self.init(terms: OrderedSet(normalizedTerms), cause: cause)
@@ -134,7 +134,7 @@ extension Incompatibility {
134134
/// requirements to a^1.5.0.
135135
fileprivate func normalize(terms: [Term]) throws -> [Term] {
136136

137-
let dict = try terms.reduce(into: Basics.OrderedDictionary<DependencyResolutionNode, (req: VersionSetSpecifier, polarity: Bool)>()) {
137+
let dict = try terms.reduce(into: OrderedDictionary<DependencyResolutionNode, (req: VersionSetSpecifier, polarity: Bool)>()) {
138138
res, term in
139139
// Don't try to intersect if this is the first time we're seeing this package.
140140
guard let previous = res[term.node] else {

Sources/PackageGraph/Pubgrub/PartialSolution.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct PartialSolution {
2525

2626
/// The intersection of all positive assignments for each package, minus any
2727
/// negative assignments that refer to that package.
28-
public private(set) var _positive: Basics.OrderedDictionary<DependencyResolutionNode, Term> = [:]
28+
public private(set) var _positive: OrderedDictionary<DependencyResolutionNode, Term> = [:]
2929

3030
/// Union of all negative assignments for a package.
3131
///

Sources/PackageGraph/Pubgrub/PubgrubDependencyResolver.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ public struct PubgrubDependencyResolver {
445445
/// If a conflict is found, the conflicting incompatibility is returned to
446446
/// resolve the conflict on.
447447
internal func propagate(state: State, node: DependencyResolutionNode) throws {
448-
var changed: Basics.OrderedSet<DependencyResolutionNode> = [node]
448+
var changed: OrderedSet<DependencyResolutionNode> = [node]
449449

450450
while !changed.isEmpty {
451451
let package = changed.removeFirst()
@@ -1209,7 +1209,7 @@ private final class PubGrubPackageContainer {
12091209
throw InternalError("Unexpected unversioned requirement: \(constraint)")
12101210
}
12111211
return try constraint.nodes().map { dependencyNode in
1212-
var terms: Basics.OrderedSet<Term> = []
1212+
var terms: OrderedSet<Term> = []
12131213
terms.append(Term(node, .exact(version)))
12141214
terms.append(Term(not: dependencyNode, vs))
12151215
return try Incompatibility(terms, root: root, cause: .dependency(node: node))
@@ -1223,7 +1223,7 @@ private final class PubGrubPackageContainer {
12231223
products: node.productFilter)
12241224

12251225
return try constraints.map { constraint in
1226-
var terms: Basics.OrderedSet<Term> = []
1226+
var terms: OrderedSet<Term> = []
12271227
let lowerBound = lowerBounds[constraint.package] ?? "0.0.0"
12281228
let upperBound = upperBounds[constraint.package] ?? Version(version.major + 1, 0, 0)
12291229
assert(lowerBound < upperBound)

Sources/PackageLoading/PackageBuilder.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1190,11 +1190,11 @@ public final class PackageBuilder {
11901190

11911191
/// Collects the products defined by a package.
11921192
private func constructProducts(_ targets: [Target]) throws -> [Product] {
1193-
var products = Basics.OrderedSet<KeyedPair<Product, String>>()
1193+
var products = OrderedSet<KeyedPair<Product, String>>()
11941194

11951195
/// Helper method to append to products array.
11961196
func append(_ product: Product) {
1197-
let inserted = products.append(KeyedPair(product, key: product.name)).inserted
1197+
let inserted = products.append(KeyedPair(product, key: product.name))
11981198
if !inserted {
11991199
diagnostics.emit(
12001200
.duplicateProduct(product: product),

Tests/PackageGraphTests/PubgrubTests.swift

+9-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import Basics
12-
@testable import PackageGraph
11+
import XCTest
12+
13+
import TSCBasic
1314
import PackageLoading
1415
@testable import PackageModel
16+
@testable import PackageGraph
1517
import SourceControl
16-
import TSCBasic
17-
import XCTest
18+
19+
1820

1921
// There's some useful helper utilities defined below for easier testing:
2022
//
@@ -2153,7 +2155,7 @@ class DependencyGraphBuilder {
21532155
}
21542156

21552157
func create(
2156-
dependencies: Basics.OrderedDictionary<String, (PackageRequirement, ProductFilter)>
2158+
dependencies: OrderedDictionary<String, (PackageRequirement, ProductFilter)>
21572159
) -> [PackageContainerConstraint] {
21582160
return dependencies.map {
21592161
PackageContainerConstraint(package: reference(for: $0), requirement: $1.0, products: $1.1)
@@ -2164,7 +2166,7 @@ class DependencyGraphBuilder {
21642166
_ package: String,
21652167
at version: Version,
21662168
toolsVersion: ToolsVersion? = nil,
2167-
with dependencies: KeyValuePairs<String, Basics.OrderedDictionary<String, (PackageRequirement, ProductFilter)>> = [:]
2169+
with dependencies: KeyValuePairs<String, OrderedDictionary<String, (PackageRequirement, ProductFilter)>> = [:]
21682170
) {
21692171
serve(package, at: .version(version), toolsVersion: toolsVersion, with: dependencies)
21702172
}
@@ -2173,7 +2175,7 @@ class DependencyGraphBuilder {
21732175
_ package: String,
21742176
at version: BoundVersion,
21752177
toolsVersion: ToolsVersion? = nil,
2176-
with dependencies: KeyValuePairs<String, Basics.OrderedDictionary<String, (PackageRequirement, ProductFilter)>> = [:]
2178+
with dependencies: KeyValuePairs<String, OrderedDictionary<String, (PackageRequirement, ProductFilter)>> = [:]
21772179
) {
21782180
let packageReference = reference(for: package)
21792181
let container = self.containers[package] ?? MockContainer(package: packageReference)

Utilities/bootstrap

+5-10
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ def parse_global_args(args):
185185
args.source_dirs["swift-argument-parser"] = os.path.join(args.project_root, "..", "swift-argument-parser")
186186
args.source_dirs["swift-driver"] = os.path.join(args.project_root, "..", "swift-driver")
187187
args.source_dirs["swift-crypto"] = os.path.join(args.project_root, "..", "swift-crypto")
188-
args.source_dirs["swift-collections"] = os.path.join(args.project_root, "..", "swift-collections")
189188
args.source_root = os.path.join(args.project_root, "Sources")
190189

191190
if platform.system() == 'Darwin':
@@ -342,7 +341,6 @@ def build(args):
342341
]
343342
build_dependency(args, "swift-driver", swift_driver_cmake_flags)
344343
build_dependency(args, "swift-crypto")
345-
build_dependency(args, "swift-collections")
346344
build_swiftpm_with_cmake(args)
347345

348346
build_swiftpm_with_swiftpm(args,integrated_swift_driver=False)
@@ -555,12 +553,11 @@ def build_swiftpm_with_cmake(args):
555553

556554
cmake_flags = [
557555
get_llbuild_cmake_arg(args),
558-
"-DTSC_DIR=" + os.path.join(args.build_dirs["tsc"], "cmake/modules"),
559-
"-DYams_DIR=" + os.path.join(args.build_dirs["yams"], "cmake/modules"),
560-
"-DArgumentParser_DIR=" + os.path.join(args.build_dirs["swift-argument-parser"], "cmake/modules"),
561-
"-DSwiftDriver_DIR=" + os.path.join(args.build_dirs["swift-driver"], "cmake/modules"),
562-
"-DSwiftCrypto_DIR=" + os.path.join(args.build_dirs["swift-crypto"], "cmake/modules"),
563-
"-DSwiftCollections_DIR=" + os.path.join(args.build_dirs["swift-collections"], "cmake/modules"),
556+
"-DTSC_DIR=" + os.path.join(args.build_dirs["tsc"], "cmake/modules"),
557+
"-DYams_DIR=" + os.path.join(args.build_dirs["yams"], "cmake/modules"),
558+
"-DArgumentParser_DIR=" + os.path.join(args.build_dirs["swift-argument-parser"], "cmake/modules"),
559+
"-DSwiftDriver_DIR=" + os.path.join(args.build_dirs["swift-driver"], "cmake/modules"),
560+
"-DSwiftCrypto_DIR=" + os.path.join(args.build_dirs["swift-crypto"], "cmake/modules"),
564561
]
565562

566563
if platform.system() == 'Darwin':
@@ -577,7 +574,6 @@ def build_swiftpm_with_cmake(args):
577574
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-argument-parser"], "lib"))
578575
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-driver"], "lib"))
579576
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-crypto"], "lib"))
580-
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-collections"], "lib"))
581577

582578
def build_swiftpm_with_swiftpm(args, integrated_swift_driver):
583579
"""Builds SwiftPM using the version of SwiftPM built with CMake."""
@@ -676,7 +672,6 @@ def get_swiftpm_env_cmd(args):
676672
os.path.join(args.build_dirs["swift-argument-parser"], "lib"),
677673
os.path.join(args.build_dirs["swift-driver"], "lib"),
678674
os.path.join(args.build_dirs["swift-crypto"], "lib"),
679-
os.path.join(args.build_dirs["swift-collections"], "lib"),
680675
] + args.target_info["paths"]["runtimeLibraryPaths"])
681676

682677
if platform.system() == 'Darwin':

0 commit comments

Comments
 (0)