@@ -23,6 +23,7 @@ import PackageModel
23
23
import SourceControl
24
24
import SKCore
25
25
import SKSupport
26
+ import TSCBasic
26
27
import Workspace
27
28
import Dispatch
28
29
import struct Foundation. URL
@@ -85,18 +86,25 @@ public final class SwiftPMWorkspace {
85
86
let destination = try Destination . hostDestination ( destinationToolchainBinDir)
86
87
let toolchain = try UserToolchain ( destination: destination)
87
88
88
- let buildPath : AbsolutePath = buildSetup. path ?? packageRoot. appending ( component: " .build " )
89
+ var location = Workspace . Location ( forRootPackage: packageRoot, fileSystem: fileSystem)
90
+ if let customWorkingDirectory = buildSetup. path {
91
+ location. workingDirectory = customWorkingDirectory
92
+ }
89
93
90
- let workspaceConfiguration = try Workspace . Configuration ( path: packageRoot. appending ( components: " .swiftpm " , " config " ) , fs: fileSystem)
94
+ // since we are customizing the workspace location, we need to explicitly pass the mirrors configuration
95
+ let mirrorsConfiguration = try Workspace . Configuration. Mirrors (
96
+ forRootPackage: packageRoot,
97
+ sharedMirrorFile: location. sharedMirrorsConfigurationFile,
98
+ fileSystem: fileSystem
99
+ )
91
100
92
- self . workspace = Workspace (
93
- dataPath: buildPath,
94
- editablesPath: packageRoot. appending ( component: " Packages " ) ,
95
- pinsFile: packageRoot. appending ( component: " Package.resolved " ) ,
96
- manifestLoader: ManifestLoader ( manifestResources: toolchain. manifestResources, cacheDir: buildPath) ,
97
- config: workspaceConfiguration,
101
+ self . workspace = try Workspace (
98
102
fileSystem: fileSystem,
99
- skipUpdate: true )
103
+ location: location,
104
+ mirrors: mirrorsConfiguration. mirrors,
105
+ customManifestLoader: ManifestLoader ( toolchain: toolchain. configuration, cacheDir: location. workingDirectory) ,
106
+ resolverUpdateEnabled: false
107
+ )
100
108
101
109
let triple = toolchain. triple
102
110
@@ -109,10 +117,11 @@ public final class SwiftPMWorkspace {
109
117
}
110
118
111
119
self . buildParameters = BuildParameters (
112
- dataPath: buildPath. appending ( component: triple. tripleString) ,
113
- configuration: buildConfiguration,
114
- toolchain: toolchain,
115
- flags: buildSetup. flags)
120
+ dataPath: location. workingDirectory. appending ( component: triple. tripleString) ,
121
+ configuration: buildConfiguration,
122
+ toolchain: toolchain,
123
+ flags: buildSetup. flags
124
+ )
116
125
117
126
self . packageGraph = try PackageGraph ( rootPackages: [ ] , dependencies: [ ] )
118
127
0 commit comments