@@ -211,7 +211,7 @@ public class Workspace {
211211 /// Enable prefetching containers in resolver.
212212 fileprivate let resolverPrefetchingEnabled : Bool
213213
214- /// Skip updating containers while fetching them.
214+ /// Update containers while fetching them.
215215 fileprivate let resolverUpdateEnabled : Bool
216216
217217 /// Write dependency resolver trace to a file.
@@ -238,9 +238,6 @@ public class Workspace {
238238 /// - Parameters:
239239 /// - fileSystem: The file system to use.
240240 /// - location: Workspace location configuration.
241- /// - editablesPath: Path to store the editable versions of dependencies.
242- /// - resolvedVersionsFilePath: Path to the Package.resolved file.
243- /// - cachePath: Path to the shared cache.
244241 /// - netrcFilePath: Path tot he netrc file.
245242 /// - mirrors: Dependencies mirrors.
246243 /// - customToolsVersion: A custom tools version.
@@ -259,7 +256,6 @@ public class Workspace {
259256 public init (
260257 fileSystem: FileSystem ,
261258 location: Location ,
262- cachePath: AbsolutePath ? = . none,
263259 netrcFilePath: AbsolutePath ? = . none,
264260 mirrors: DependencyMirrors ? = . none,
265261 customToolsVersion: ToolsVersion ? = . none,
@@ -281,14 +277,12 @@ public class Workspace {
281277 let toolsVersionLoader = ToolsVersionLoader ( )
282278 let manifestLoader = try customManifestLoader ?? ManifestLoader ( toolchain: UserToolchain ( destination: . hostDestination( ) ) . configuration)
283279 let repositoryProvider = customRepositoryProvider ?? GitRepositoryProvider ( )
284- let repositoriesPath = location. workingDirectory. appending ( component: " repositories " )
285- let repositoriesCachePath = cachePath. map { $0. appending ( component: " repositories " ) }
286280 let repositoryManager = customRepositoryManager ?? RepositoryManager (
287- path: repositoriesPath ,
281+ path: location . repositoriesDirectory ,
288282 provider: repositoryProvider,
289283 delegate: delegate. map ( WorkspaceRepositoryManagerDelegate . init ( workspaceDelegate: ) ) ,
290284 fileSystem: fileSystem,
291- cachePath: repositoriesCachePath )
285+ cachePath: location . repositoriesSharedCacheDirectory )
292286 let httpClient = customHTTPClient ?? HTTPClient ( )
293287 let archiver = customArchiver ?? ZipArchiver ( )
294288 let mirrors = mirrors ?? DependencyMirrors ( )
@@ -374,9 +368,9 @@ public class Workspace {
374368 location: . init(
375369 workingDirectory: dataPath,
376370 editsDirectory: editablesPath,
377- resolvedVersionsFilePath: pinsFile
371+ resolvedVersionsFilePath: pinsFile,
372+ sharedCacheDirectory: cachePath
378373 ) ,
379- cachePath: cachePath,
380374 netrcFilePath: netrcFilePath,
381375 mirrors: config? . mirrors,
382376 customToolsVersion: currentToolsVersion,
@@ -602,7 +596,7 @@ extension Workspace {
602596 // These are the things we don't want to remove while cleaning.
603597 let protectedAssets = [
604598 repositoryManager. path,
605- self . location. checkoutsDirectory ,
599+ self . location. repositoriesCheckoutsDirectory ,
606600 self . location. artifactsDirectory,
607601 state. path,
608602 ] . map ( { path -> String in
@@ -646,7 +640,7 @@ extension Workspace {
646640 /// and notes.
647641 public func reset( with diagnostics: DiagnosticsEngine ) {
648642 let removed = diagnostics. wrap {
649- try fileSystem. chmod ( . userWritable, path: self . location. checkoutsDirectory , options: [ . recursive, . onlyFiles] )
643+ try fileSystem. chmod ( . userWritable, path: self . location. repositoriesCheckoutsDirectory , options: [ . recursive, . onlyFiles] )
650644 // Reset state.
651645 try self . resetState ( )
652646 }
@@ -1072,7 +1066,7 @@ extension Workspace {
10721066
10731067 // Remove the existing checkout.
10741068 do {
1075- let oldCheckoutPath = self . location. checkoutsDirectory . appending ( dependency. subpath)
1069+ let oldCheckoutPath = self . location. repositoriesCheckoutsDirectory . appending ( dependency. subpath)
10761070 try fileSystem. chmod ( . userWritable, path: oldCheckoutPath, options: [ . recursive, . onlyFiles] )
10771071 try fileSystem. removeFileTree ( oldCheckoutPath)
10781072 }
@@ -1370,7 +1364,7 @@ extension Workspace {
13701364 fileprivate func createCacheDirectories( with diagnostics: DiagnosticsEngine ) {
13711365 do {
13721366 try fileSystem. createDirectory ( repositoryManager. path, recursive: true )
1373- try fileSystem. createDirectory ( self . location. checkoutsDirectory , recursive: true )
1367+ try fileSystem. createDirectory ( self . location. repositoriesCheckoutsDirectory , recursive: true )
13741368 try fileSystem. createDirectory ( self . location. artifactsDirectory, recursive: true )
13751369 } catch {
13761370 diagnostics. emit ( error)
@@ -1385,7 +1379,7 @@ extension Workspace {
13851379 public func path( to dependency: ManagedDependency ) -> AbsolutePath {
13861380 switch dependency. state {
13871381 case . checkout:
1388- return self . location. checkoutsDirectory . appending ( dependency. subpath)
1382+ return self . location. repositoriesCheckoutsDirectory . appending ( dependency. subpath)
13891383 case . edited( let path) :
13901384 return path ?? self . location. editsDirectory. appending ( dependency. subpath)
13911385 case . local:
@@ -2620,7 +2614,7 @@ extension Workspace {
26202614 private func fetch( package : PackageReference ) throws -> AbsolutePath {
26212615 // If we already have it, fetch to update the repo from its remote.
26222616 if let dependency = state. dependencies [ forURL: package . location] {
2623- let path = self . location. checkoutsDirectory . appending ( dependency. subpath)
2617+ let path = self . location. repositoriesCheckoutsDirectory . appending ( dependency. subpath)
26242618
26252619 // Make sure the directory is not missing (we will have to clone again
26262620 // if not).
@@ -2652,7 +2646,7 @@ extension Workspace {
26522646 }
26532647
26542648 // Clone the repository into the checkouts.
2655- let path = self . location. checkoutsDirectory . appending ( component: package . repository. basename)
2649+ let path = self . location. repositoriesCheckoutsDirectory . appending ( component: package . repository. basename)
26562650
26572651 try fileSystem. chmod ( . userWritable, path: path, options: [ . recursive, . onlyFiles] )
26582652 try fileSystem. removeFileTree ( path)
@@ -2696,7 +2690,7 @@ extension Workspace {
26962690 // Write the state record.
26972691 state. dependencies. add ( ManagedDependency (
26982692 packageRef: package ,
2699- subpath: path. relative ( to: self . location. checkoutsDirectory ) ,
2693+ subpath: path. relative ( to: self . location. repositoriesCheckoutsDirectory ) ,
27002694 checkoutState: checkoutState) )
27012695 try state. saveState ( )
27022696
@@ -2779,7 +2773,7 @@ extension Workspace {
27792773 }
27802774
27812775 // Remove the checkout.
2782- let dependencyPath = self . location. checkoutsDirectory . appending ( dependencyToRemove. subpath)
2776+ let dependencyPath = self . location. repositoriesCheckoutsDirectory . appending ( dependencyToRemove. subpath)
27832777 let workingCopy = try repositoryManager. provider. openWorkingCopy ( at: dependencyPath)
27842778 guard !workingCopy. hasUncommittedChanges ( ) else {
27852779 throw WorkspaceDiagnostics . UncommitedChanges ( repositoryPath: dependencyPath)
0 commit comments