@@ -82,16 +82,14 @@ public class SwiftPackageTool: SwiftTool<PackageToolOptions> {
82
82
83
83
case . fetch:
84
84
diagnostics. emit ( data: FetchDeprecatedDiagnostic ( ) )
85
- let workspace = try getActiveWorkspace ( )
86
- workspace. resolve ( root: try getWorkspaceRoot ( ) , diagnostics: diagnostics)
85
+ try resolve ( )
87
86
88
87
case . resolve:
89
88
let resolveOptions = options. resolveOptions
90
- let workspace = try getActiveWorkspace ( )
91
- let root = try getWorkspaceRoot ( )
92
89
93
90
// If a package is provided, use that to resolve the dependencies.
94
91
if let packageName = resolveOptions. packageName {
92
+ let workspace = try getActiveWorkspace ( )
95
93
return try workspace. resolve (
96
94
packageName: packageName,
97
95
root: getWorkspaceRoot ( ) ,
@@ -102,18 +100,16 @@ public class SwiftPackageTool: SwiftTool<PackageToolOptions> {
102
100
}
103
101
104
102
// Otherwise, run a normal resolve.
105
- workspace . resolve ( root : root , diagnostics : diagnostics )
103
+ try resolve ( )
106
104
107
105
case . edit:
108
106
let packageName = options. editOptions. packageName!
109
- // Load the package graph.
110
- try loadPackageGraph ( )
111
-
112
- // Get the current workspace.
107
+ try resolve ( )
113
108
let workspace = try getActiveWorkspace ( )
114
109
115
110
// Create revision object if provided by user.
116
111
let revision = options. editOptions. revision. flatMap ( { Revision ( identifier: $0) } )
112
+
117
113
// Put the dependency in edit mode.
118
114
workspace. edit (
119
115
packageName: packageName,
@@ -124,9 +120,7 @@ public class SwiftPackageTool: SwiftTool<PackageToolOptions> {
124
120
125
121
case . unedit:
126
122
let packageName = options. editOptions. packageName!
127
-
128
- // Load the package graph.
129
- try loadPackageGraph ( )
123
+ try resolve ( )
130
124
let workspace = try getActiveWorkspace ( )
131
125
132
126
try workspace. unedit ( packageName: packageName, forceRemove: options. editOptions. shouldForceRemove)
0 commit comments