Skip to content

Commit 8f00942

Browse files
Merge branch 'main' into #116-support-debian-distributions
2 parents b199eef + 0158a41 commit 8f00942

26 files changed

+280
-115
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,

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: 26 additions & 8 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

@@ -167,7 +168,8 @@ extension GeneratorCLI {
167168
if let arch = hostArch {
168169
let target = Triple(arch: arch, vendor: current.vendor!, os: current.os!)
169170
appLogger.warning(
170-
"deprecated: Please use `--host \(target.triple)` instead of `--host-arch \(arch)`")
171+
"deprecated: Please use `--host \(target.triple)` instead of `--host-arch \(arch)`"
172+
)
171173
return target
172174
}
173175
return current
@@ -221,7 +223,8 @@ extension GeneratorCLI {
221223
if let arch = generatorOptions.targetArch {
222224
let target = Triple(arch: arch, vendor: nil, os: .linux, environment: .gnu)
223225
appLogger.warning(
224-
"deprecated: Please use `--target \(target.triple)` instead of `--target-arch \(arch)`")
226+
"deprecated: Please use `--target \(target.triple)` instead of `--target-arch \(arch)`"
227+
)
225228
}
226229
return Triple(arch: hostTriple.arch!, vendor: nil, os: .linux, environment: .gnu)
227230
}
@@ -244,7 +247,9 @@ extension GeneratorCLI {
244247
let linuxDistributionVersion =
245248
self.linuxDistributionVersion ?? linuxDistributionDefaultVersion
246249
let linuxDistribution = try LinuxDistribution(
247-
name: linuxDistributionName, version: linuxDistributionVersion)
250+
name: linuxDistributionName,
251+
version: linuxDistributionVersion
252+
)
248253
let hostTriple = try self.generatorOptions.deriveHostTriple()
249254
let targetTriple = self.deriveTargetTriple(hostTriple: hostTriple)
250255

@@ -263,7 +268,10 @@ extension GeneratorCLI {
263268
logger: loggerWithLevel(from: self.generatorOptions)
264269
)
265270
try await GeneratorCLI.run(
266-
recipe: recipe, targetTriple: targetTriple, options: self.generatorOptions)
271+
recipe: recipe,
272+
targetTriple: targetTriple,
273+
options: self.generatorOptions
274+
)
267275
}
268276

269277
func isInvokedAsDefaultSubcommand() -> Bool {
@@ -320,7 +328,10 @@ extension GeneratorCLI {
320328
)
321329
let targetTriple = self.deriveTargetTriple()
322330
try await GeneratorCLI.run(
323-
recipe: recipe, targetTriple: targetTriple, options: self.generatorOptions)
331+
recipe: recipe,
332+
targetTriple: targetTriple,
333+
options: self.generatorOptions
334+
)
324335
}
325336
}
326337
}
@@ -331,12 +342,19 @@ extension Duration {
331342
let date = Date(timeInterval: TimeInterval(self.components.seconds), since: reference)
332343

333344
let components = Calendar.current.dateComponents(
334-
[.hour, .minute, .second], from: reference, to: date)
345+
[.hour, .minute, .second],
346+
from: reference,
347+
to: date
348+
)
335349

336350
if let hours = components.hour, hours > 0 {
337351
#if !canImport(Darwin) && compiler(<6.0)
338352
return String(
339-
format: "%02d:%02d:%02d", hours, components.minute ?? 0, components.second ?? 0)
353+
format: "%02d:%02d:%02d",
354+
hours,
355+
components.minute ?? 0,
356+
components.second ?? 0
357+
)
340358
#else
341359
return self.formatted()
342360
#endif

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ extension SwiftSDKGenerator {
163163
if isOptional && !doesFileExist(at: fromPath) {
164164
logger.debug(
165165
"Optional package path ignored since it does not exist",
166-
metadata: ["packagePath": .string(fromPath.string)])
166+
metadata: ["packagePath": .string(fromPath.string)]
167+
)
167168
continue
168169
}
169170

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Download.swift

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ extension FilePath {
3232

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

@@ -75,7 +77,8 @@ extension SwiftSDKGenerator {
7577
"Using downloaded artifacts in these locations.",
7678
metadata: [
7779
"paths": .array(results.map(\.path.metadataValue))
78-
])
80+
]
81+
)
7982
}
8083

8184
func getMirrorURL(for linuxDistribution: LinuxDistribution) throws -> String {
@@ -123,15 +126,17 @@ extension SwiftSDKGenerator {
123126
"""
124127
The `xz` utility was not found in `PATH`. \
125128
Consider installing it for more efficient downloading of package lists.
126-
""")
129+
"""
130+
)
127131
}
128132

129133
logger.info(
130134
"Downloading and parsing packages lists...",
131135
metadata: [
132136
"distributionName": .stringConvertible(distributionName),
133137
"distributionRelease": .string(distributionRelease),
134-
])
138+
]
139+
)
135140

136141
let allPackages = try await withThrowingTaskGroup(of: [String: URL].self) { group in
137142
group.addTask {
@@ -191,7 +196,8 @@ extension SwiftSDKGenerator {
191196
metadata: [
192197
"distributionName": .stringConvertible(distributionName),
193198
"packageCount": .stringConvertible(urls.count),
194-
])
199+
]
200+
)
195201
try await inTemporaryDirectory { fs, tmpDir in
196202
let downloadedFiles = try await self.downloadFiles(from: urls, to: tmpDir, client, engine)
197203
await report(downloadedFiles: downloadedFiles)
@@ -275,8 +281,11 @@ extension SwiftSDKGenerator {
275281
$0.addTask {
276282
let downloadedFilePath = try await engine[
277283
DownloadFileQuery(
278-
remoteURL: url, localDirectory: directory, httpClient: client
279-
)]
284+
remoteURL: url,
285+
localDirectory: directory,
286+
httpClient: client
287+
)
288+
]
280289
let filePath = downloadedFilePath.path
281290
guard
282291
let fileSize = try FileManager.default.attributesOfItem(
@@ -306,7 +315,8 @@ extension SwiftSDKGenerator {
306315
metadata: [
307316
"url": .string(url.absoluteString),
308317
"size": .string(byteCountFormatter.string(fromByteCount: Int64(bytes))),
309-
])
318+
]
319+
)
310320
}
311321
}
312322
}

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(

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Metadata.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ extension SwiftSDKGenerator {
6363
"""
6464
`toolchainBinDirPath`, `sdkDirPath`, and `toolsetPath` are at unexpected locations that prevent computing \
6565
relative paths
66-
""")
66+
"""
67+
)
6768
}
6869

6970
var metadata = SwiftSDKMetadataV4.TripleProperties(

0 commit comments

Comments
 (0)