@@ -166,30 +166,34 @@ public class SwiftPackageTool: SwiftTool<PackageMode, PackageToolOptions> {
166
166
break
167
167
168
168
case . update:
169
- let packagesDirectory = try getCheckoutsDirectory ( )
170
- // Attempt to ensure that none of the repositories are modified.
171
- if localFileSystem. exists ( packagesDirectory) {
172
- for name in try localFileSystem. getDirectoryContents ( packagesDirectory) {
173
- let item = packagesDirectory. appending ( RelativePath ( name) )
169
+ if options. enableNewResolver {
170
+ let workspace = try getActiveWorkspace ( )
171
+ try workspace. updateDependencies ( )
172
+ } else {
173
+ let packagesDirectory = try getCheckoutsDirectory ( )
174
+ // Attempt to ensure that none of the repositories are modified.
175
+ if localFileSystem. exists ( packagesDirectory) {
176
+ for name in try localFileSystem. getDirectoryContents ( packagesDirectory) {
177
+ let item = packagesDirectory. appending ( RelativePath ( name) )
174
178
175
- // Only look at repositories.
176
- guard exists ( item. appending ( component: " .git " ) ) else { continue }
179
+ // Only look at repositories.
180
+ guard exists ( item. appending ( component: " .git " ) ) else { continue }
177
181
178
- // If there is a staged or unstaged diff, don't remove the
179
- // tree. This won't detect new untracked files, but it is
180
- // just a safety measure for now.
181
- let diffArgs = [ " --no-ext-diff " , " --quiet " , " --exit-code " ]
182
- do {
183
- _ = try Git . runPopen ( [ Git . tool, " -C " , item. asString, " diff " ] + diffArgs)
184
- _ = try Git . runPopen ( [ Git . tool, " -C " , item. asString, " diff " , " --cached " ] + diffArgs)
185
- } catch {
186
- throw Error . repositoryHasChanges ( item. asString)
182
+ // If there is a staged or unstaged diff, don't remove the
183
+ // tree. This won't detect new untracked files, but it is
184
+ // just a safety measure for now.
185
+ let diffArgs = [ " --no-ext-diff " , " --quiet " , " --exit-code " ]
186
+ do {
187
+ _ = try Git . runPopen ( [ Git . tool, " -C " , item. asString, " diff " ] + diffArgs)
188
+ _ = try Git . runPopen ( [ Git . tool, " -C " , item. asString, " diff " , " --cached " ] + diffArgs)
189
+ } catch {
190
+ throw Error . repositoryHasChanges ( item. asString)
191
+ }
187
192
}
193
+ try removeFileTree ( packagesDirectory)
188
194
}
189
- try removeFileTree ( packagesDirectory )
195
+ _ = try loadPackage ( )
190
196
}
191
- fallthrough
192
-
193
197
case . fetch:
194
198
_ = try loadPackage ( )
195
199
0 commit comments