Skip to content

Commit 39132eb

Browse files
Merge branch 'main' into #189-macos-host-toolchain-default
2 parents 290786e + 0158a41 commit 39132eb

27 files changed

+254
-106
lines changed

.swift-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"lineBreakAroundMultilineExpressionChainComponents" : false,
1111
"lineBreakBeforeControlFlowKeywords" : false,
12-
"lineBreakBeforeEachArgument" : false,
12+
"lineBreakBeforeEachArgument" : true,
1313
"lineBreakBeforeEachGenericRequirement" : false,
1414
"lineLength" : 100,
1515
"maximumBlankLines" : 1,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ subsequently as `<generated_sdk_id>`.
8787
Create a new project to verify that the SDK works:
8888

8989
```
90-
mkdir cross-compilation test
90+
mkdir cross-compilation-test
9191
cd cross-compilation-test
9292
swift package init --type executable
9393
```

Sources/AsyncProcess/FileContentStream.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ private final class ReadIntoAsyncChannelHandler: ChannelDuplexHandler {
256256
extension FileHandle {
257257
func fileContentStream(eventLoop: EventLoop) throws -> FileContentStream {
258258
let asyncBytes = try FileContentStream(
259-
fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
259+
fileDescriptor: self.fileDescriptor,
260+
eventLoop: eventLoop
261+
)
260262
try self.close()
261263
return asyncBytes
262264
}
@@ -432,7 +434,8 @@ where Base: AsyncSequence, Base.Element == ByteBuffer {
432434
}
433435

434436
public init(
435-
_ underlying: Base, dropTerminator: Bool,
437+
_ underlying: Base,
438+
dropTerminator: Bool,
436439
maximumAllowableBufferSize: Int,
437440
dropLastChunkIfNoNewline: Bool
438441
) {

Sources/AsyncProcess/ProcessExecutor+Convenience.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ extension ProcessExecutor {
324324
}
325325

326326
var allInfo = ProcessExitReasonAndOutput(
327-
exitReason: .exit(-1), standardOutput: nil, standardError: nil)
327+
exitReason: .exit(-1),
328+
standardOutput: nil,
329+
standardError: nil
330+
)
328331
while let next = try await group.next() {
329332
switch next {
330333
case let .exitReason(exitReason):
@@ -467,7 +470,8 @@ extension ProcessExecutor {
467470
try await self.runCollectingOutput(
468471
group: group,
469472
executable: executable,
470-
arguments, standardInput: EOFSequence(),
473+
arguments,
474+
standardInput: EOFSequence(),
471475
collectStandardOutput: collectStandardOutput,
472476
collectStandardError: collectStandardError,
473477
perStreamCollectionLimitBytes: perStreamCollectionLimitBytes,

Sources/AsyncProcess/ProcessExecutor.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public final actor ProcessExecutor {
159159
private let _standardOutput: ChunkSequence
160160
private let _standardError: ChunkSequence
161161
private let processIsRunningApproximation = ManagedAtomic(
162-
RunningStateApproximation.neverStarted.rawValue)
162+
RunningStateApproximation.neverStarted.rawValue
163+
)
163164
private let processOutputConsumptionApproximation = ManagedAtomic(UInt8(0))
164165
private let processPid = ManagedAtomic(pid_t(0))
165166
private let ownsStandardOutputWriteHandle: Bool
@@ -568,7 +569,10 @@ public final actor ProcessExecutor {
568569
// At this point, the process is running, we should therefore have a process ID (unless we're already dead).
569570
let childPid = p.processIdentifier
570571
_ = self.processPid.compareExchange(
571-
expected: 0, desired: childPid, ordering: .sequentiallyConsistent)
572+
expected: 0,
573+
desired: childPid,
574+
ordering: .sequentiallyConsistent
575+
)
572576
assert(childPid != 0 || !p.isRunning)
573577
self.logger.debug(
574578
"running command",

Sources/GeneratorCLI/GeneratorCLI.swift

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ struct GeneratorCLI: AsyncParsableCommand {
7171

7272
logger.info(
7373
"Generator run finished successfully.",
74-
metadata: ["elapsedTime": .string(elapsed.intervalString)])
74+
metadata: ["elapsedTime": .string(elapsed.intervalString)]
75+
)
7576
}
7677
}
7778

@@ -181,7 +182,8 @@ extension GeneratorCLI {
181182
if let arch = hostArch {
182183
let target = Triple(arch: arch, vendor: current.vendor!, os: current.os!)
183184
appLogger.warning(
184-
"deprecated: Please use `--host \(target.triple)` instead of `--host-arch \(arch)`")
185+
"deprecated: Please use `--host \(target.triple)` instead of `--host-arch \(arch)`"
186+
)
185187
return target
186188
}
187189
return current
@@ -256,7 +258,9 @@ extension GeneratorCLI {
256258
let distributionVersion =
257259
self.distributionVersion ?? distributionDefaultVersion
258260
let linuxDistribution = try LinuxDistribution(
259-
name: distributionName, version: distributionVersion)
261+
name: distributionName,
262+
version: distributionVersion
263+
)
260264
let hostTriple = try self.generatorOptions.deriveHostTriple()
261265
let targetTriple = self.deriveTargetTriple(hostTriple: hostTriple)
262266

@@ -275,7 +279,10 @@ extension GeneratorCLI {
275279
logger: loggerWithLevel(from: self.generatorOptions)
276280
)
277281
try await GeneratorCLI.run(
278-
recipe: recipe, targetTriple: targetTriple, options: self.generatorOptions)
282+
recipe: recipe,
283+
targetTriple: targetTriple,
284+
options: self.generatorOptions
285+
)
279286
}
280287

281288
func isInvokedAsDefaultSubcommand() -> Bool {
@@ -332,7 +339,10 @@ extension GeneratorCLI {
332339
)
333340
let targetTriple = self.deriveTargetTriple()
334341
try await GeneratorCLI.run(
335-
recipe: recipe, targetTriple: targetTriple, options: self.generatorOptions)
342+
recipe: recipe,
343+
targetTriple: targetTriple,
344+
options: self.generatorOptions
345+
)
336346
}
337347
}
338348
}
@@ -343,12 +353,19 @@ extension Duration {
343353
let date = Date(timeInterval: TimeInterval(self.components.seconds), since: reference)
344354

345355
let components = Calendar.current.dateComponents(
346-
[.hour, .minute, .second], from: reference, to: date)
356+
[.hour, .minute, .second],
357+
from: reference,
358+
to: date
359+
)
347360

348361
if let hours = components.hour, hours > 0 {
349362
#if !canImport(Darwin) && compiler(<6.0)
350363
return String(
351-
format: "%02d:%02d:%02d", hours, components.minute ?? 0, components.second ?? 0)
364+
format: "%02d:%02d:%02d",
365+
hours,
366+
components.minute ?? 0,
367+
components.second ?? 0
368+
)
352369
#else
353370
return self.formatted()
354371
#endif

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ extension SwiftSDKGenerator {
136136
if isOptional && !doesFileExist(at: fromPath) {
137137
logger.debug(
138138
"Optional package path ignored since it does not exist",
139-
metadata: ["packagePath": .string(fromPath.string)])
139+
metadata: ["packagePath": .string(fromPath.string)]
140+
)
140141
continue
141142
}
142143

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Download.swift

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ extension FilePath {
3131

3232
extension SwiftSDKGenerator {
3333
func downloadArtifacts(
34-
_ client: some HTTPClientProtocol, _ engine: QueryEngine,
34+
_ client: some HTTPClientProtocol,
35+
_ engine: QueryEngine,
3536
downloadableArtifacts: inout DownloadableArtifacts,
3637
itemsToDownload: @Sendable (DownloadableArtifacts) -> [DownloadableArtifacts.Item]
3738
) async throws {
@@ -58,7 +59,8 @@ extension SwiftSDKGenerator {
5859
for item in itemsToDownload(downloadableArtifacts) {
5960
group.addTask {
6061
try await engine[
61-
DownloadArtifactQuery(artifact: item, httpClient: client, logger: self.logger)]
62+
DownloadArtifactQuery(artifact: item, httpClient: client, logger: self.logger)
63+
]
6264
}
6365
}
6466

@@ -74,7 +76,8 @@ extension SwiftSDKGenerator {
7476
"Using downloaded artifacts in these locations.",
7577
metadata: [
7678
"paths": .array(results.map(\.path.metadataValue))
77-
])
79+
]
80+
)
7881
}
7982

8083
func downloadUbuntuPackages(
@@ -93,7 +96,8 @@ extension SwiftSDKGenerator {
9396
"""
9497
The `xz` utility was not found in `PATH`. \
9598
Consider installing it for more efficient downloading of package lists.
96-
""")
99+
"""
100+
)
97101
}
98102

99103
async let mainPackages = try await client.parseUbuntuPackagesList(
@@ -137,7 +141,9 @@ extension SwiftSDKGenerator {
137141
}
138142

139143
logger.info(
140-
"Downloading Ubuntu packages...", metadata: ["packageCount": .stringConvertible(urls.count)])
144+
"Downloading Ubuntu packages...",
145+
metadata: ["packageCount": .stringConvertible(urls.count)]
146+
)
141147
try await inTemporaryDirectory { fs, tmpDir in
142148
let downloadedFiles = try await self.downloadFiles(from: urls, to: tmpDir, client, engine)
143149
await report(downloadedFiles: downloadedFiles)
@@ -160,8 +166,11 @@ extension SwiftSDKGenerator {
160166
$0.addTask {
161167
let downloadedFilePath = try await engine[
162168
DownloadFileQuery(
163-
remoteURL: url, localDirectory: directory, httpClient: client
164-
)]
169+
remoteURL: url,
170+
localDirectory: directory,
171+
httpClient: client
172+
)
173+
]
165174
let filePath = downloadedFilePath.path
166175
guard
167176
let fileSize = try FileManager.default.attributesOfItem(
@@ -191,7 +200,8 @@ extension SwiftSDKGenerator {
191200
metadata: [
192201
"url": .string(url.absoluteString),
193202
"size": .string(byteCountFormatter.string(fromByteCount: Int64(bytes))),
194-
])
203+
]
204+
)
195205
}
196206
}
197207
}

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Entrypoint.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ extension SwiftSDKGenerator {
5151
try await self.createDirectoryIfNeeded(at: pathsConfiguration.artifactsCachePath)
5252

5353
let swiftSDKProduct = try await recipe.makeSwiftSDK(
54-
generator: self, engine: engine, httpClient: client)
54+
generator: self,
55+
engine: engine,
56+
httpClient: client
57+
)
5558

5659
let toolsetJSONPath = try await self.generateToolsetJSON(recipe: recipe)
5760

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Fixup.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ extension SwiftSDKGenerator {
5858

5959
func symlinkClangHeaders() throws {
6060
let swiftStaticClangPath = self.pathsConfiguration.toolchainDirPath.appending(
61-
"usr/lib/swift_static/clang")
61+
"usr/lib/swift_static/clang"
62+
)
6263
if !doesFileExist(at: swiftStaticClangPath) {
6364
logger.info("Symlinking clang headers...")
6465
try self.createSymlink(

0 commit comments

Comments
 (0)