Skip to content

Commit c2b471c

Browse files
committed
Add --enable-package-registry flag to CLI
1 parent 4ccbc4a commit c2b471c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Sources/Commands/Options.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ public struct SwiftToolOptions: ParsableArguments {
332332
/// - important: Respects `--netrcOptional` option.
333333
@Option(name: .customLong("netrc-file"), completion: .file())
334334
var netrcFilePath: AbsolutePath?
335+
336+
@Flag(name: .customLong("enable-package-registry"),
337+
help: "Enable dependency resolution using package registries when available")
338+
var enablePackageRegistry: Bool = false
335339

336340
public init() {}
337341
}

Sources/Commands/SwiftTool.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@ public class SwiftTool {
565565
isResolverPrefetchingEnabled: options.shouldEnableResolverPrefetching,
566566
skipUpdate: options.skipDependencyUpdate,
567567
enableResolverTrace: options.enableResolverTrace,
568-
cachePath: cachePath
568+
cachePath: cachePath,
569+
enablePackageRegistry: options.enablePackageRegistry
569570
)
570571
_workspace = workspace
571572
_workspaceDelegate = delegate

Sources/Workspace/Workspace.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ public class Workspace {
230230

231231
fileprivate let additionalFileRules: [FileRuleDescription]
232232

233+
fileprivate let enablePackageRegistry: Bool
234+
233235
/// Create a new package workspace.
234236
///
235237
/// This will automatically load the persisted state for the package, if
@@ -266,7 +268,8 @@ public class Workspace {
266268
enablePubgrubResolver: Bool = false,
267269
skipUpdate: Bool = false,
268270
enableResolverTrace: Bool = false,
269-
cachePath: AbsolutePath? = nil
271+
cachePath: AbsolutePath? = nil,
272+
enablePackageRegistry: Bool = false
270273
) {
271274
self.delegate = delegate
272275
self.dataPath = dataPath
@@ -302,6 +305,8 @@ public class Workspace {
302305
cachePath: repositoriesCachePath)
303306
self.repositoryManager = repositoryManager
304307

308+
self.enablePackageRegistry = enablePackageRegistry
309+
305310
self.checkoutsPath = self.dataPath.appending(component: "checkouts")
306311
self.artifactsPath = self.dataPath.appending(component: "artifacts")
307312

0 commit comments

Comments
 (0)