@@ -28,9 +28,11 @@ import Workspace
28
28
import Dispatch
29
29
import struct Foundation. URL
30
30
31
+ import struct Basics. AbsolutePath
32
+ import struct Basics. TSCAbsolutePath
33
+
31
34
import func TSCBasic. resolveSymlinks
32
35
import protocol TSCBasic. FileSystem
33
- import struct TSCBasic. AbsolutePath
34
36
import var TSCBasic. localFileSystem
35
37
36
38
/// Swift Package Manager build system and workspace support.
@@ -43,7 +45,7 @@ public final class SwiftPMWorkspace {
43
45
public enum Error : Swift . Error {
44
46
45
47
/// Could not find a manifest (Package.swift file). This is not a package.
46
- case noManifest( workspacePath: AbsolutePath )
48
+ case noManifest( workspacePath: TSCAbsolutePath )
47
49
48
50
/// Could not determine an appropriate toolchain for swiftpm to use for manifest loading.
49
51
case cannotDetermineHostToolchain
@@ -52,10 +54,10 @@ public final class SwiftPMWorkspace {
52
54
/// Delegate to handle any build system events.
53
55
public weak var delegate : SKCore . BuildSystemDelegate ? = nil
54
56
55
- let workspacePath : AbsolutePath
56
- let packageRoot : AbsolutePath
57
+ let workspacePath : TSCAbsolutePath
58
+ let packageRoot : TSCAbsolutePath
57
59
/// *Public for testing*
58
- public var _packageRoot : AbsolutePath { packageRoot }
60
+ public var _packageRoot : TSCAbsolutePath { packageRoot }
59
61
var packageGraph : PackageGraph
60
62
let workspace : Workspace
61
63
public let buildParameters : BuildParameters
@@ -84,7 +86,7 @@ public final class SwiftPMWorkspace {
84
86
/// manifest parsing and runtime support.
85
87
/// - Throws: If there is an error loading the package, or no manifest is found.
86
88
public init (
87
- workspacePath: AbsolutePath ,
89
+ workspacePath: TSCAbsolutePath ,
88
90
toolchainRegistry: ToolchainRegistry ,
89
91
fileSystem: FileSystem = localFileSystem,
90
92
buildSetup: BuildSetup ) throws
@@ -102,12 +104,15 @@ public final class SwiftPMWorkspace {
102
104
throw Error . cannotDetermineHostToolchain
103
105
}
104
106
105
- let destination = try Destination . hostDestination ( destinationToolchainBinDir)
107
+ let destination = try Destination . hostDestination ( AbsolutePath ( destinationToolchainBinDir) )
106
108
let toolchain = try UserToolchain ( destination: destination)
107
109
108
- var location = try Workspace . Location ( forRootPackage: packageRoot, fileSystem: fileSystem)
110
+ var location = try Workspace . Location (
111
+ forRootPackage: AbsolutePath ( packageRoot) ,
112
+ fileSystem: fileSystem
113
+ )
109
114
if let scratchDirectory = buildSetup. path {
110
- location. scratchDirectory = scratchDirectory
115
+ location. scratchDirectory = AbsolutePath ( scratchDirectory)
111
116
}
112
117
113
118
var configuration = WorkspaceConfiguration . default
@@ -150,7 +155,7 @@ public final class SwiftPMWorkspace {
150
155
{
151
156
do {
152
157
try self . init (
153
- workspacePath: try AbsolutePath ( validating: url. path) ,
158
+ workspacePath: try TSCAbsolutePath ( validating: url. path) ,
154
159
toolchainRegistry: toolchainRegistry,
155
160
fileSystem: localFileSystem,
156
161
buildSetup: buildSetup)
@@ -176,7 +181,7 @@ extension SwiftPMWorkspace {
176
181
} )
177
182
178
183
let packageGraph = try self . workspace. loadPackageGraph (
179
- rootInput: PackageGraphRootInput ( packages: [ packageRoot] ) ,
184
+ rootInput: PackageGraphRootInput ( packages: [ AbsolutePath ( packageRoot) ] ) ,
180
185
observabilityScope: observabilitySystem. topScope
181
186
)
182
187
@@ -234,15 +239,15 @@ extension SwiftPMWorkspace {
234
239
235
240
extension SwiftPMWorkspace : SKCore . BuildSystem {
236
241
237
- public var buildPath : AbsolutePath {
238
- return buildParameters. buildPath
242
+ public var buildPath : TSCAbsolutePath {
243
+ return TSCAbsolutePath ( buildParameters. buildPath)
239
244
}
240
245
241
- public var indexStorePath : AbsolutePath ? {
242
- return buildParameters. indexStoreMode == . off ? nil : buildParameters. indexStore
246
+ public var indexStorePath : TSCAbsolutePath ? {
247
+ return buildParameters. indexStoreMode == . off ? nil : TSCAbsolutePath ( buildParameters. indexStore)
243
248
}
244
249
245
- public var indexDatabasePath : AbsolutePath ? {
250
+ public var indexDatabasePath : TSCAbsolutePath ? {
246
251
return buildPath. appending ( components: " index " , " db " )
247
252
}
248
253
@@ -555,8 +560,8 @@ extension SwiftPMWorkspace {
555
560
556
561
/// Find a Swift Package root directory that contains the given path, if any.
557
562
private func findPackageDirectory(
558
- containing path: AbsolutePath ,
559
- _ fileSystem: FileSystem ) -> AbsolutePath ? {
563
+ containing path: TSCAbsolutePath ,
564
+ _ fileSystem: FileSystem ) -> TSCAbsolutePath ? {
560
565
var path = path
561
566
while true {
562
567
let packagePath = path. appending ( component: " Package.swift " )
0 commit comments