Skip to content

Commit eca189e

Browse files
committed
Clean up non-core commands
This separates out the collections and registry commands from the `Commands` module, allowing to simplify the first stage of bootstrap: - Moves the command implementations to new modules `PackageCollectionsTool` and `PackageRegistryTool`. - Adds a new multi-tool entry point executable `swift-package-manager`. This used to be included in `swift-package`, but that would render the separation moot and also seems like a better structure. For installation into the toolchain, we're simply installing the new executable under the name `swift-package`, so nothing changes there. - Remove package-collections related stuff from the CMake build, it was anyway completely unused.
1 parent 87254d2 commit eca189e

File tree

19 files changed

+91
-210
lines changed

19 files changed

+91
-210
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ if(FIND_PM_DEPS)
5252
endif()
5353

5454
find_package(ArgumentParser CONFIG REQUIRED)
55-
find_package(SwiftCrypto CONFIG REQUIRED)
5655
find_package(SwiftDriver CONFIG REQUIRED)
5756
find_package(SwiftCollections CONFIG REQUIRED)
5857
endif()

CONTRIBUTING.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,29 +183,21 @@ Clone the following repositories beside the SwiftPM directory:
183183
$> git clone https://github.com/apple/swift-driver
184184
```
185185

186-
6. [swift-crypto] and check out tag with the [latest version](https://github.com/apple/swift-crypto/tags).
187-
188-
For example, if the latest tag is 1.1.6:
189-
```sh
190-
$> git clone https://github.com/apple/swift-crypto --branch 1.1.6
191-
```
192-
193-
7. [swift-system] and check out tag with the [latest version](https://github.com/apple/swift-system/tags).
186+
6. [swift-system] and check out tag with the [latest version](https://github.com/apple/swift-system/tags).
194187

195188
For example, if the latest tag is 1.0.0:
196189
```sh
197190
$> git clone https://github.com/apple/swift-system --branch 1.0.0
198191
```
199192

200-
8. [swift-collections] and check out tag with the [latest version](https://github.com/apple/swift-collections/tags).
193+
7. [swift-collections] and check out tag with the [latest version](https://github.com/apple/swift-collections/tags).
201194

202195
For example, if the latest tag is 1.0.1:
203196
```sh
204197
$> git clone https://github.com/apple/swift-collections --branch 1.0.1
205198
206199
[swift-argument-parser]: https://github.com/apple/swift-argument-parser
207200
[swift-collections]: https://github.com/apple/swift-collections
208-
[swift-crypto]: https://github.com/apple/swift-crypto
209201
[swift-driver]: https://github.com/apple/swift-driver
210202
[swift-llbuild]: https://github.com/apple/swift-llbuild
211203
[swift-system]: https://github.com/apple/swift-system

Package.swift

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ packageCollectionsSigningTargets.append(
7676
dependencies: [
7777
.product(name: "Crypto", package: "swift-crypto"), // for CCryptoBoringSSL
7878
],
79-
exclude: ["CMakeLists.txt"],
8079
cSettings: [
8180
.define("WIN32_LEAN_AND_MEAN"),
8281
]
@@ -90,7 +89,6 @@ packageCollectionsSigningTargets.append(
9089
/** Package collections signing */
9190
name: "PackageCollectionsSigning",
9291
dependencies: packageCollectionsSigningDeps,
93-
exclude: ["CMakeLists.txt"],
9492
swiftSettings: swiftSettings
9593
)
9694
)
@@ -260,7 +258,6 @@ let package = Package(
260258
name: "PackageCollectionsModel",
261259
dependencies: [],
262260
exclude: [
263-
"CMakeLists.txt",
264261
"Formats/v1.md"
265262
]
266263
),
@@ -274,8 +271,7 @@ let package = Package(
274271
"PackageCollectionsSigning",
275272
"PackageModel",
276273
"SourceControl",
277-
],
278-
exclude: ["CMakeLists.txt"]
274+
]
279275
),
280276

281277
.target(
@@ -365,15 +361,45 @@ let package = Package(
365361
"Basics",
366362
"Build",
367363
"CoreCommands",
368-
"PackageCollections",
369-
"PackageFingerprint",
370364
"PackageGraph",
371365
"SourceControl",
372366
"Workspace",
373367
"XCBuildSupport",
374368
],
375369
exclude: ["CMakeLists.txt", "README.md"]
376370
),
371+
372+
.target(
373+
/** Interacts with package collections */
374+
name: "PackageCollectionsTool",
375+
dependencies: [
376+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
377+
"Basics",
378+
"Commands",
379+
"CoreCommands",
380+
"PackageCollections",
381+
"PackageModel",
382+
]
383+
),
384+
385+
.target(
386+
/** Interact with package registry */
387+
name: "PackageRegistryTool",
388+
dependencies: [
389+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
390+
"Basics",
391+
"Commands",
392+
"CoreCommands",
393+
"PackageGraph",
394+
"PackageLoading",
395+
"PackageModel",
396+
"PackageRegistry",
397+
"SourceControl",
398+
"SPMBuildCore",
399+
"Workspace",
400+
]
401+
),
402+
377403
.executableTarget(
378404
/** The main executable provided by SwiftPM */
379405
name: "swift-package",
@@ -407,13 +433,18 @@ let package = Package(
407433
.executableTarget(
408434
/** Interacts with package collections */
409435
name: "swift-package-collection",
410-
dependencies: ["Commands"],
436+
dependencies: ["Commands", "PackageCollectionsTool"],
411437
exclude: ["CMakeLists.txt"]
412438
),
439+
.executableTarget(
440+
/** Multi-tool entry point for SwiftPM. */
441+
name: "swift-package-manager",
442+
dependencies: ["Commands", "Basics", "PackageCollectionsTool", "PackageRegistryTool"]
443+
),
413444
.executableTarget(
414445
/** Interact with package registry */
415446
name: "swift-package-registry",
416-
dependencies: ["Commands"],
447+
dependencies: ["Commands", "PackageRegistryTool"],
417448
exclude: ["CMakeLists.txt"]
418449
),
419450
.executableTarget(

Sources/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ add_subdirectory(Commands)
1313
add_subdirectory(CoreCommands)
1414
add_subdirectory(DriverSupport)
1515
add_subdirectory(LLBuildManifest)
16-
add_subdirectory(PackageCollections)
17-
add_subdirectory(PackageCollectionsModel)
18-
add_subdirectory(PackageCollectionsSigning)
19-
add_subdirectory(PackageCollectionsSigningLibc)
2016
add_subdirectory(PackageDescription)
2117
add_subdirectory(PackageFingerprint)
2218
add_subdirectory(PackageGraph)

Sources/Commands/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ add_library(Commands
2222
PackageTools/ResetCommands.swift
2323
PackageTools/Resolve.swift
2424
PackageTools/ShowDependencies.swift
25-
PackageTools/SwiftPackageCollectionsTool.swift
26-
PackageTools/SwiftPackageRegistryTool.swift
2725
PackageTools/SwiftPackageTool.swift
2826
PackageTools/ToolsVersionCommand.swift
2927
PackageTools/Update.swift
@@ -52,8 +50,6 @@ target_link_libraries(Commands PUBLIC
5250
Basics
5351
Build
5452
CoreCommands
55-
PackageCollections
56-
PackageFingerprint
5753
PackageGraph
5854
SourceControl
5955
TSCBasic

Sources/Commands/SwiftBuildTool.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ public struct SwiftBuildTool: SwiftCommand {
159159
public init() {}
160160
}
161161

162-
extension SwiftCommand {
163-
public func buildSystemProvider(_ swiftTool: SwiftTool) throws -> BuildSystemProvider {
162+
public extension SwiftCommand {
163+
func buildSystemProvider(_ swiftTool: SwiftTool) throws -> BuildSystemProvider {
164164
return try swiftTool.defaultBuildSystemProvider
165165
}
166166
}

Sources/Commands/ToolWorkspaceDelegate.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Basics
14-
import Build
1514
import CoreCommands
1615
import Dispatch
1716
import class Foundation.NSLock
@@ -181,14 +180,14 @@ class ToolWorkspaceDelegate: WorkspaceDelegate {
181180
func didDownloadAllBinaryArtifacts() {}
182181
}
183182

184-
extension SwiftCommand {
185-
public var workspaceDelegateProvider: WorkspaceDelegateProvider {
183+
public extension SwiftCommand {
184+
var workspaceDelegateProvider: WorkspaceDelegateProvider {
186185
return {
187186
ToolWorkspaceDelegate(observabilityScope: $0, outputHandler: $1, progressHandler: $2)
188187
}
189188
}
190189

191-
public var workspaceLoaderProvider: WorkspaceLoaderProvider {
190+
var workspaceLoaderProvider: WorkspaceLoaderProvider {
192191
return {
193192
XcodeWorkspaceLoader(fileSystem: $0, observabilityScope: $1)
194193
}

Sources/PackageCollections/CMakeLists.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.

Sources/PackageCollectionsModel/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

Sources/PackageCollectionsSigning/CMakeLists.txt

Lines changed: 0 additions & 53 deletions
This file was deleted.

Sources/PackageCollectionsSigningLibc/CMakeLists.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

Sources/Commands/PackageTools/SwiftPackageCollectionsTool.swift renamed to Sources/PackageCollectionsTool/SwiftPackageCollectionsTool.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import ArgumentParser
1414
import Basics
15+
import Commands
1516
import CoreCommands
1617
import Foundation
1718
import PackageCollections

Sources/Commands/PackageTools/SwiftPackageRegistryTool.swift renamed to Sources/PackageRegistryTool/SwiftPackageRegistryTool.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import ArgumentParser
1414
import Basics
15+
import Commands
1516
import CoreCommands
1617
import TSCBasic
1718
import SPMBuildCore

Sources/swift-package-collection/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Commands
14+
import PackageCollectionsTool
1415

1516
SwiftPackageCollectionsTool.main()

0 commit comments

Comments
 (0)