@@ -19,15 +19,9 @@ extension Unidoc
19
19
let executablePath : String ?
20
20
21
21
public
22
- let swiftRuntime : String ?
23
- public
24
- let swiftPath : String ?
25
- public
26
- let swiftSDK : SSGC . AppleSDK ?
22
+ let authorization : String ?
27
23
public
28
24
let pretty : Bool
29
- public
30
- let authorization : String ?
31
25
32
26
public
33
27
let http : Protocol
@@ -36,11 +30,8 @@ extension Unidoc
36
30
37
31
@inlinable public
38
32
init (
39
- swiftRuntime: String ? ,
40
- swiftPath: String ? ,
41
- swiftSDK: SSGC . AppleSDK ? ,
42
- pretty: Bool ,
43
33
authorization: String ? ,
34
+ pretty: Bool ,
44
35
http: Protocol ,
45
36
port: Int )
46
37
{
@@ -56,11 +47,8 @@ extension Unidoc
56
47
self . executablePath = nil
57
48
#endif
58
49
59
- self . swiftRuntime = swiftRuntime
60
- self . swiftPath = swiftPath
61
- self . swiftSDK = swiftSDK
62
- self . pretty = pretty
63
50
self . authorization = authorization
51
+ self . pretty = pretty
64
52
self . http = http
65
53
self . port = port
66
54
}
@@ -144,6 +132,7 @@ extension Unidoc.Client<HTTP.Client2>
144
132
labels: Unidoc . BuildLabels ,
145
133
action: Unidoc . LinkerAction ,
146
134
remove: Bool = false ,
135
+ with toolchain: Unidoc . Toolchain ,
147
136
cache: FilePath ? = nil ) async throws -> Bool
148
137
{
149
138
if let cache: FilePath , remove
@@ -218,17 +207,19 @@ extension Unidoc.Client<HTTP.Client2>
218
207
{
219
208
arguments. append ( " --pretty " )
220
209
}
221
- if let path : String = self . swiftRuntime
210
+ if let usr : FilePath . Directory = toolchain . usr
222
211
{
212
+ let lib : FilePath . Directory = usr / " lib "
213
+
223
214
arguments. append ( " --swift-runtime " )
224
- arguments. append ( " \( path ) " )
225
- }
226
- if let path : String = self . swiftPath
227
- {
215
+ arguments. append ( " \( lib ) " )
216
+
217
+ let swift : FilePath . Directory = usr / " bin " / " swift "
218
+
228
219
arguments. append ( " --swift " )
229
- arguments. append ( " \( path ) " )
220
+ arguments. append ( " \( swift ) " )
230
221
}
231
- if let sdk: SSGC . AppleSDK = self . swiftSDK
222
+ if let sdk: SSGC . AppleSDK = toolchain . sdk
232
223
{
233
224
arguments. append ( " --sdk " )
234
225
arguments. append ( " \( sdk) " )
@@ -293,12 +284,14 @@ extension Unidoc.Client<HTTP.Client2>
293
284
294
285
public
295
286
func buildAndUpload( local symbol: Symbol . Package ,
296
- search: FilePath ? ,
297
- type: SSGC . ProjectType ) async throws
287
+ search: FilePath . Directory ? ,
288
+ type: SSGC . ProjectType ,
289
+ with toolchain: Unidoc . Toolchain ) async throws
298
290
{
299
291
let object : SymbolGraphObject < Void > = try await self . build ( local: symbol,
300
292
search: search,
301
- type: type)
293
+ type: type,
294
+ with: toolchain)
302
295
303
296
try await self . connect { try await $0. upload ( object) }
304
297
@@ -312,12 +305,14 @@ extension Unidoc.Client<HTTP.Client1>
312
305
{
313
306
public
314
307
func buildAndUpload( local symbol: Symbol . Package ,
315
- search: FilePath ? ,
316
- type: SSGC . ProjectType ) async throws
308
+ search: FilePath . Directory ? ,
309
+ type: SSGC . ProjectType ,
310
+ with toolchain: Unidoc . Toolchain ) async throws
317
311
{
318
312
let object : SymbolGraphObject < Void > = try await self . build ( local: symbol,
319
313
search: search,
320
- type: type)
314
+ type: type,
315
+ with: toolchain)
321
316
322
317
try await self . connect { try await $0. upload ( object) }
323
318
@@ -331,8 +326,9 @@ extension Unidoc.Client
331
326
{
332
327
private
333
328
func build( local symbol: Symbol . Package ,
334
- search: FilePath ? ,
335
- type: SSGC . ProjectType ) async throws -> SymbolGraphObject < Void >
329
+ search: FilePath . Directory ? ,
330
+ type: SSGC . ProjectType ,
331
+ with toolchain: Unidoc . Toolchain ) async throws -> SymbolGraphObject < Void >
336
332
{
337
333
let workspace : SSGC . Workspace = try . create( at: " .ssgc " )
338
334
let docs : FilePath = workspace. location / " docs.bson "
@@ -349,22 +345,24 @@ extension Unidoc.Client
349
345
{
350
346
arguments. append ( " --pretty " )
351
347
}
352
- if let path : String = self . swiftRuntime
348
+ if let usr : FilePath . Directory = toolchain . usr
353
349
{
350
+ let lib : FilePath . Directory = usr / " lib "
351
+
354
352
arguments. append ( " --swift-runtime " )
355
- arguments. append ( " \( path ) " )
356
- }
357
- if let path : String = self . swiftPath
358
- {
353
+ arguments. append ( " \( lib ) " )
354
+
355
+ let swift : FilePath . Directory = usr / " bin " / " swift "
356
+
359
357
arguments. append ( " --swift " )
360
- arguments. append ( " \( path ) " )
358
+ arguments. append ( " \( swift ) " )
361
359
}
362
- if let sdk: SSGC . AppleSDK = self . swiftSDK
360
+ if let sdk: SSGC . AppleSDK = toolchain . sdk
363
361
{
364
362
arguments. append ( " --sdk " )
365
363
arguments. append ( " \( sdk) " )
366
364
}
367
- if let search: FilePath = search
365
+ if let search: FilePath . Directory
368
366
{
369
367
arguments. append ( " --search-path " )
370
368
arguments. append ( " \( search) " )
0 commit comments