@@ -211,7 +211,7 @@ public class Workspace {
211
211
/// Enable prefetching containers in resolver.
212
212
fileprivate let resolverPrefetchingEnabled : Bool
213
213
214
- /// Skip updating containers while fetching them.
214
+ /// Update containers while fetching them.
215
215
fileprivate let resolverUpdateEnabled : Bool
216
216
217
217
/// Write dependency resolver trace to a file.
@@ -238,9 +238,6 @@ public class Workspace {
238
238
/// - Parameters:
239
239
/// - fileSystem: The file system to use.
240
240
/// - 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.
244
241
/// - netrcFilePath: Path tot he netrc file.
245
242
/// - mirrors: Dependencies mirrors.
246
243
/// - customToolsVersion: A custom tools version.
@@ -259,7 +256,6 @@ public class Workspace {
259
256
public init (
260
257
fileSystem: FileSystem ,
261
258
location: Location ,
262
- cachePath: AbsolutePath ? = . none,
263
259
netrcFilePath: AbsolutePath ? = . none,
264
260
mirrors: DependencyMirrors ? = . none,
265
261
customToolsVersion: ToolsVersion ? = . none,
@@ -281,14 +277,12 @@ public class Workspace {
281
277
let toolsVersionLoader = ToolsVersionLoader ( )
282
278
let manifestLoader = try customManifestLoader ?? ManifestLoader ( toolchain: UserToolchain ( destination: . hostDestination( ) ) . configuration)
283
279
let repositoryProvider = customRepositoryProvider ?? GitRepositoryProvider ( )
284
- let repositoriesPath = location. workingDirectory. appending ( component: " repositories " )
285
- let repositoriesCachePath = cachePath. map { $0. appending ( component: " repositories " ) }
286
280
let repositoryManager = customRepositoryManager ?? RepositoryManager (
287
- path: repositoriesPath ,
281
+ path: location . repositoriesDirectory ,
288
282
provider: repositoryProvider,
289
283
delegate: delegate. map ( WorkspaceRepositoryManagerDelegate . init ( workspaceDelegate: ) ) ,
290
284
fileSystem: fileSystem,
291
- cachePath: repositoriesCachePath )
285
+ cachePath: location . repositoriesSharedCacheDirectory )
292
286
let httpClient = customHTTPClient ?? HTTPClient ( )
293
287
let archiver = customArchiver ?? ZipArchiver ( )
294
288
let mirrors = mirrors ?? DependencyMirrors ( )
@@ -374,9 +368,9 @@ public class Workspace {
374
368
location: . init(
375
369
workingDirectory: dataPath,
376
370
editsDirectory: editablesPath,
377
- resolvedVersionsFilePath: pinsFile
371
+ resolvedVersionsFilePath: pinsFile,
372
+ sharedCacheDirectory: cachePath
378
373
) ,
379
- cachePath: cachePath,
380
374
netrcFilePath: netrcFilePath,
381
375
mirrors: config? . mirrors,
382
376
customToolsVersion: currentToolsVersion,
@@ -602,7 +596,7 @@ extension Workspace {
602
596
// These are the things we don't want to remove while cleaning.
603
597
let protectedAssets = [
604
598
repositoryManager. path,
605
- self . location. checkoutsDirectory ,
599
+ self . location. repositoriesCheckoutsDirectory ,
606
600
self . location. artifactsDirectory,
607
601
state. path,
608
602
] . map ( { path -> String in
@@ -646,7 +640,7 @@ extension Workspace {
646
640
/// and notes.
647
641
public func reset( with diagnostics: DiagnosticsEngine ) {
648
642
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] )
650
644
// Reset state.
651
645
try self . resetState ( )
652
646
}
@@ -1072,7 +1066,7 @@ extension Workspace {
1072
1066
1073
1067
// Remove the existing checkout.
1074
1068
do {
1075
- let oldCheckoutPath = self . location. checkoutsDirectory . appending ( dependency. subpath)
1069
+ let oldCheckoutPath = self . location. repositoriesCheckoutsDirectory . appending ( dependency. subpath)
1076
1070
try fileSystem. chmod ( . userWritable, path: oldCheckoutPath, options: [ . recursive, . onlyFiles] )
1077
1071
try fileSystem. removeFileTree ( oldCheckoutPath)
1078
1072
}
@@ -1370,7 +1364,7 @@ extension Workspace {
1370
1364
fileprivate func createCacheDirectories( with diagnostics: DiagnosticsEngine ) {
1371
1365
do {
1372
1366
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 )
1374
1368
try fileSystem. createDirectory ( self . location. artifactsDirectory, recursive: true )
1375
1369
} catch {
1376
1370
diagnostics. emit ( error)
@@ -1385,7 +1379,7 @@ extension Workspace {
1385
1379
public func path( to dependency: ManagedDependency ) -> AbsolutePath {
1386
1380
switch dependency. state {
1387
1381
case . checkout:
1388
- return self . location. checkoutsDirectory . appending ( dependency. subpath)
1382
+ return self . location. repositoriesCheckoutsDirectory . appending ( dependency. subpath)
1389
1383
case . edited( let path) :
1390
1384
return path ?? self . location. editsDirectory. appending ( dependency. subpath)
1391
1385
case . local:
@@ -2620,7 +2614,7 @@ extension Workspace {
2620
2614
private func fetch( package : PackageReference ) throws -> AbsolutePath {
2621
2615
// If we already have it, fetch to update the repo from its remote.
2622
2616
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)
2624
2618
2625
2619
// Make sure the directory is not missing (we will have to clone again
2626
2620
// if not).
@@ -2652,7 +2646,7 @@ extension Workspace {
2652
2646
}
2653
2647
2654
2648
// 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)
2656
2650
2657
2651
try fileSystem. chmod ( . userWritable, path: path, options: [ . recursive, . onlyFiles] )
2658
2652
try fileSystem. removeFileTree ( path)
@@ -2696,7 +2690,7 @@ extension Workspace {
2696
2690
// Write the state record.
2697
2691
state. dependencies. add ( ManagedDependency (
2698
2692
packageRef: package ,
2699
- subpath: path. relative ( to: self . location. checkoutsDirectory ) ,
2693
+ subpath: path. relative ( to: self . location. repositoriesCheckoutsDirectory ) ,
2700
2694
checkoutState: checkoutState) )
2701
2695
try state. saveState ( )
2702
2696
@@ -2779,7 +2773,7 @@ extension Workspace {
2779
2773
}
2780
2774
2781
2775
// Remove the checkout.
2782
- let dependencyPath = self . location. checkoutsDirectory . appending ( dependencyToRemove. subpath)
2776
+ let dependencyPath = self . location. repositoriesCheckoutsDirectory . appending ( dependencyToRemove. subpath)
2783
2777
let workingCopy = try repositoryManager. provider. openWorkingCopy ( at: dependencyPath)
2784
2778
guard !workingCopy. hasUncommittedChanges ( ) else {
2785
2779
throw WorkspaceDiagnostics . UncommitedChanges ( repositoryPath: dependencyPath)
0 commit comments