Skip to content

Commit 58352e2

Browse files
committed
[Commands] Remove hidden --ignore-dependencies.
- This was just for my own performance testing purposes, but we can now accomplish the same thing more directly with unit tests.
1 parent f4a8cf7 commit 58352e2

File tree

6 files changed

+10
-36
lines changed

6 files changed

+10
-36
lines changed

Sources/Commands/SwiftBuildTool.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ private enum BuildToolFlag: Argument {
5959
case buildTests
6060
case chdir(AbsolutePath)
6161
case colorMode(ColorWrap.Mode)
62-
case ignoreDependencies
6362
case verbose(Int)
6463

6564
init?(argument: String, pop: @escaping () -> String?) throws {
@@ -89,8 +88,6 @@ private enum BuildToolFlag: Argument {
8988
throw OptionParserError.invalidUsage("invalid color mode: \(rawValue)")
9089
}
9190
self = .colorMode(mode)
92-
case "--ignore-dependencies":
93-
self = .ignoreDependencies
9491
default:
9592
return nil
9693
}
@@ -102,7 +99,6 @@ private class BuildToolOptions: Options {
10299
var flags = BuildFlags()
103100
var buildTests: Bool = false
104101
var colorMode: ColorWrap.Mode = .Auto
105-
var ignoreDependencies: Bool = false
106102
}
107103

108104
/// swift-build tool namespace
@@ -132,7 +128,7 @@ public struct SwiftBuildTool: SwiftTool {
132128
print(Versioning.currentVersion.completeDisplayString)
133129

134130
case .build(let conf, let toolchain):
135-
let graph = try loadPackage(at: opts.path.root, ignoreDependencies: opts.ignoreDependencies)
131+
let graph = try loadPackage(at: opts.path.root)
136132
let yaml = try describe(opts.path.build, conf, graph, flags: opts.flags, toolchain: toolchain)
137133
try build(yamlPath: yaml, target: opts.buildTests ? "test" : nil)
138134

@@ -198,8 +194,6 @@ public struct SwiftBuildTool: SwiftTool {
198194
opts.buildTests = true
199195
case .colorMode(let mode):
200196
opts.colorMode = mode
201-
case .ignoreDependencies:
202-
opts.ignoreDependencies = true
203197
}
204198
}
205199

Sources/Commands/SwiftPackageTool.swift

+3-9
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ private enum PackageToolFlag: Argument {
8484
case xld(String)
8585
case xswiftc(String)
8686
case xcconfigOverrides(AbsolutePath)
87-
case ignoreDependencies
8887
case verbose(Int)
8988

9089
init?(argument: String, pop: @escaping () -> String?) throws {
@@ -115,8 +114,6 @@ private enum PackageToolFlag: Argument {
115114
throw OptionParserError.invalidUsage("invalid color mode: \(rawValue)")
116115
}
117116
self = .colorMode(mode)
118-
case "--ignore-dependencies":
119-
self = .ignoreDependencies
120117
case "-Xcc":
121118
self = try .xcc(forcePop())
122119
case "-Xlinker":
@@ -139,7 +136,6 @@ class PackageToolOptions: Options {
139136
var verbosity: Int = 0
140137
var colorMode: ColorWrap.Mode = .Auto
141138
var xcodeprojOptions = XcodeprojOptions()
142-
var ignoreDependencies: Bool = false
143139
}
144140

145141
/// swift-build tool namespace
@@ -205,13 +201,13 @@ public struct SwiftPackageTool: SwiftTool {
205201
fallthrough
206202

207203
case .fetch:
208-
_ = try loadPackage(at: opts.path.root, ignoreDependencies: opts.ignoreDependencies)
204+
_ = try loadPackage(at: opts.path.root)
209205

210206
case .showDependencies:
211-
let graph = try loadPackage(at: opts.path.root, ignoreDependencies: opts.ignoreDependencies)
207+
let graph = try loadPackage(at: opts.path.root)
212208
dumpDependenciesOf(rootPackage: graph.rootPackage, mode: opts.showDepsMode)
213209
case .generateXcodeproj:
214-
let graph = try loadPackage(at: opts.path.root, ignoreDependencies: opts.ignoreDependencies)
210+
let graph = try loadPackage(at: opts.path.root)
215211

216212
let projectName: String
217213
let dstdir: AbsolutePath
@@ -308,8 +304,6 @@ public struct SwiftPackageTool: SwiftTool {
308304
opts.colorMode = mode
309305
case .xcconfigOverrides(let path):
310306
opts.xcodeprojOptions.xcconfigOverrides = path
311-
case .ignoreDependencies:
312-
opts.ignoreDependencies = true
313307
}
314308
}
315309
if let mode = mode {

Sources/Commands/SwiftTestTool.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ private enum TestToolFlag: Argument {
8484
case buildPath(AbsolutePath)
8585
case colorMode(ColorWrap.Mode)
8686
case skipBuild
87-
case ignoreDependencies
8887
case verbose(Int)
8988

9089
init?(argument: String, pop: @escaping () -> String?) throws {
@@ -114,8 +113,6 @@ private enum TestToolFlag: Argument {
114113
throw OptionParserError.invalidUsage("invalid color mode: \(rawValue)")
115114
}
116115
self = .colorMode(mode)
117-
case "--ignore-dependencies":
118-
self = .ignoreDependencies
119116
default:
120117
return nil
121118
}
@@ -127,7 +124,6 @@ private class TestToolOptions: Options {
127124
var buildTests: Bool = true
128125
var colorMode: ColorWrap.Mode = .Auto
129126
var flags = BuildFlags()
130-
var ignoreDependencies: Bool = false
131127
}
132128

133129
/// swift-test tool namespace
@@ -185,7 +181,7 @@ public struct SwiftTestTool: SwiftTool {
185181
///
186182
/// - Returns: The path to the test binary.
187183
private func buildTestsIfNeeded(_ opts: TestToolOptions) throws -> AbsolutePath {
188-
let graph = try loadPackage(at: opts.path.root, ignoreDependencies: opts.ignoreDependencies)
184+
let graph = try loadPackage(at: opts.path.root)
189185
if opts.buildTests {
190186
let yaml = try describe(opts.path.build, configuration, graph, flags: opts.flags, toolchain: UserToolchain())
191187
try build(yamlPath: yaml, target: "test")
@@ -259,8 +255,6 @@ public struct SwiftTestTool: SwiftTool {
259255
opts.colorMode = mode
260256
case .skipBuild:
261257
opts.buildTests = false
262-
case .ignoreDependencies:
263-
opts.ignoreDependencies = true
264258
}
265259
}
266260

Sources/Commands/SwiftTool.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension SwiftTool {
3434
}
3535

3636
/// Fetch and load the complete package at the given path.
37-
func loadPackage(at path: AbsolutePath, ignoreDependencies: Bool) throws -> PackageGraph {
38-
return try packageGraphLoader.loadPackage(at: path, ignoreDependencies: ignoreDependencies)
37+
func loadPackage(at path: AbsolutePath) throws -> PackageGraph {
38+
return try packageGraphLoader.loadPackage(at: path)
3939
}
4040
}

Sources/Get/PackagesDirectory.swift

+1-6
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,11 @@ public final class PackagesDirectory {
6161

6262
/// Recursively fetch the dependencies for the root package.
6363
///
64-
/// - Parameters:
65-
/// - ignoreDependencies: If true, then skip resolution (and loading) of the package dependencies.
6664
/// - Returns: The loaded root package and all external packages, with dependencies resolved.
6765
/// - Throws: Error.InvalidDependencyGraph
68-
public func loadManifests(ignoreDependencies: Bool = false) throws -> (rootManifest: Manifest, externalManifests: [Manifest]) {
66+
public func loadManifests() throws -> (rootManifest: Manifest, externalManifests: [Manifest]) {
6967
// Load the manifest for the root package.
7068
let manifest = try manifestLoader.load(packagePath: rootPath, baseURL: rootPath.asString, version: nil)
71-
if ignoreDependencies {
72-
return (manifest, [])
73-
}
7469

7570
// Resolve and fetch all package dependencies and their manifests.
7671
let externalManifests = try recursivelyFetch(manifest.dependencies)

Sources/PackageGraph/PackageGraphLoader.swift

+2-5
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,12 @@ public struct PackageGraphLoader {
5555
}
5656

5757
/// Load the package graph for the given package path.
58-
///
59-
/// - Parameters:
60-
/// - ignoreDependencies: If true, then skip resolution (and loading) of the package dependencies.
61-
public func loadPackage(at path: AbsolutePath, ignoreDependencies: Bool) throws -> PackageGraph {
58+
public func loadPackage(at path: AbsolutePath) throws -> PackageGraph {
6259
// Create the packages directory container.
6360
let packagesDirectory = PackagesDirectory(root: path, manifestLoader: manifestLoader)
6461

6562
// Fetch and load the manifests.
66-
let (rootManifest, externalManifests) = try packagesDirectory.loadManifests(ignoreDependencies: ignoreDependencies)
63+
let (rootManifest, externalManifests) = try packagesDirectory.loadManifests()
6764
let allManifests = externalManifests + [rootManifest]
6865

6966
// Create the packages and convert to modules.

0 commit comments

Comments
 (0)