@@ -8,7 +8,7 @@ import Basics
8
8
9
9
struct DescriptionPackage {
10
10
let mode : Runner . Mode
11
- let packageDirectory : AbsolutePath
11
+ let packageDirectory : ScipioAbsolutePath
12
12
private let toolchain : UserToolchain
13
13
let workspace : Workspace
14
14
let graph : PackageGraph
@@ -34,32 +34,32 @@ struct DescriptionPackage {
34
34
manifest. displayName
35
35
}
36
36
37
- var buildDirectory : AbsolutePath {
37
+ var buildDirectory : ScipioAbsolutePath {
38
38
packageDirectory. appending ( component: " .build " )
39
39
}
40
40
41
- var workspaceDirectory : AbsolutePath {
41
+ var workspaceDirectory : ScipioAbsolutePath {
42
42
buildDirectory. appending ( component: " scipio " )
43
43
}
44
44
45
45
var supportedSDKs : Set < SDK > {
46
46
Set ( manifest. platforms. map ( \. platformName) . compactMap ( SDK . init ( platformName: ) ) )
47
47
}
48
48
49
- var derivedDataPath : AbsolutePath {
49
+ var derivedDataPath : ScipioAbsolutePath {
50
50
workspaceDirectory. appending ( component: " DerivedData " )
51
51
}
52
52
53
- func generatedModuleMapPath( of target: ResolvedTarget , sdk: SDK ) throws -> AbsolutePath {
54
- let relativePath = try RelativePath ( validating: " ModuleMapsForFramework/ \( sdk. settingValue) " )
53
+ func generatedModuleMapPath( of target: ResolvedTarget , sdk: SDK ) throws -> ScipioAbsolutePath {
54
+ let relativePath = try TSCBasic . RelativePath ( validating: " ModuleMapsForFramework/ \( sdk. settingValue) " )
55
55
return workspaceDirectory
56
56
. appending ( relativePath)
57
57
. appending ( component: target. modulemapName)
58
58
}
59
59
60
60
/// Returns an Products directory path
61
61
/// It should be the default setting of `TARGET_BUILD_DIR`
62
- func productsDirectory( buildConfiguration: BuildConfiguration , sdk: SDK ) -> AbsolutePath {
62
+ func productsDirectory( buildConfiguration: BuildConfiguration , sdk: SDK ) -> ScipioAbsolutePath {
63
63
let intermediateDirectoryName = productDirectoryName (
64
64
buildConfiguration: buildConfiguration,
65
65
sdk: sdk
@@ -68,12 +68,12 @@ struct DescriptionPackage {
68
68
}
69
69
70
70
/// Returns a directory path which contains assembled frameworks
71
- var assembledFrameworksRootDirectory : AbsolutePath {
71
+ var assembledFrameworksRootDirectory : ScipioAbsolutePath {
72
72
workspaceDirectory. appending ( component: " AssembledFrameworks " )
73
73
}
74
74
75
75
/// Returns a directory path of the assembled frameworks path for the specific Configuration/Platform
76
- func assembledFrameworksDirectory( buildConfiguration: BuildConfiguration , sdk: SDK ) -> AbsolutePath {
76
+ func assembledFrameworksDirectory( buildConfiguration: BuildConfiguration , sdk: SDK ) -> ScipioAbsolutePath {
77
77
let intermediateDirName = productDirectoryName ( buildConfiguration: buildConfiguration, sdk: sdk)
78
78
return assembledFrameworksRootDirectory
79
79
. appending ( component: intermediateDirName)
@@ -91,7 +91,7 @@ struct DescriptionPackage {
91
91
92
92
// MARK: Initializer
93
93
94
- private static func makeWorkspace( toolchain: UserToolchain , packagePath: AbsolutePath ) throws -> Workspace {
94
+ private static func makeWorkspace( toolchain: UserToolchain , packagePath: ScipioAbsolutePath ) throws -> Workspace {
95
95
var workspaceConfiguration : WorkspaceConfiguration = . default
96
96
// override default configuration to treat XIB files
97
97
workspaceConfiguration. additionalFileRules = FileRuleDescription . xcbuildFileTypes
@@ -101,7 +101,7 @@ struct DescriptionPackage {
101
101
. makeAuthorizationProvider ( fileSystem: fileSystem, observabilityScope: observabilitySystem. topScope)
102
102
let workspace = try Workspace (
103
103
fileSystem: fileSystem,
104
- location: Workspace . Location ( forRootPackage: packagePath, fileSystem: fileSystem) ,
104
+ location: Workspace . Location ( forRootPackage: packagePath. spmAbsolutePath , fileSystem: fileSystem) ,
105
105
authorizationProvider: authorizationProvider,
106
106
configuration: workspaceConfiguration,
107
107
customHostToolchain: toolchain
@@ -116,25 +116,29 @@ struct DescriptionPackage {
116
116
/// Then, use package versions only from existing Package.resolved.
117
117
/// If it is `true`, Package.resolved never be updated.
118
118
/// Instead, the resolving will fail if the Package.resolved is mis-matched with the workspace.
119
- init ( packageDirectory: AbsolutePath , mode: Runner . Mode , onlyUseVersionsFromResolvedFile: Bool ) throws {
119
+ init ( packageDirectory: ScipioAbsolutePath , mode: Runner . Mode , onlyUseVersionsFromResolvedFile: Bool ) throws {
120
120
self . packageDirectory = packageDirectory
121
121
self . mode = mode
122
122
123
+ #if swift(>=5.10)
124
+ let toolchain = try UserToolchain ( swiftSDK: try . hostSwiftSDK( ) )
125
+ #else
123
126
let toolchain = try UserToolchain ( destination: try . hostDestination( ) )
127
+ #endif
124
128
self . toolchain = toolchain
125
129
126
130
let workspace = try Self . makeWorkspace ( toolchain: toolchain, packagePath: packageDirectory)
127
131
let scope = observabilitySystem. topScope
128
132
self . graph = try workspace. loadPackageGraph (
129
- rootInput: PackageGraphRootInput ( packages: [ packageDirectory] ) ,
133
+ rootInput: PackageGraphRootInput ( packages: [ packageDirectory. spmAbsolutePath ] ) ,
130
134
// This option is same with resolver option `--disable-automatic-resolution`
131
135
// Never update Package.resolved of the package
132
136
forceResolvedVersions: onlyUseVersionsFromResolvedFile,
133
137
observabilityScope: scope
134
138
)
135
139
self . manifest = try tsc_await {
136
140
workspace. loadRootManifest (
137
- at: packageDirectory,
141
+ at: packageDirectory. spmAbsolutePath ,
138
142
observabilityScope: scope,
139
143
completion: $0
140
144
)
0 commit comments