Skip to content

Commit 9a1a3f5

Browse files
committed
Merge branch 'main' of github.com:cmcgee1024/swiftly into self-host-gh-actions
2 parents 2f46918 + 8fb4bef commit 9a1a3f5

24 files changed

+619
-148
lines changed

Package.resolved

Lines changed: 71 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ let package = Package(
1515
],
1616
dependencies: [
1717
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
18-
.package(url: "https://github.com/swift-server/async-http-client", from: "1.21.2"),
19-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.64.0"),
18+
.package(url: "https://github.com/swift-server/async-http-client", from: "1.24.0"),
19+
.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.1.0"),
20+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.79.0"),
2021
.package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.7.2"),
2122
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
23+
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.6.0"),
24+
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.7.0"),
2225
// This dependency provides the correct version of the formatter so that you can run `swift run swiftformat Package.swift Plugins/ Sources/ Tests/`
2326
.package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.49.18"),
2427
],
@@ -38,6 +41,11 @@ let package = Package(
3841
dependencies: [
3942
.product(name: "AsyncHTTPClient", package: "async-http-client"),
4043
.product(name: "NIOFoundationCompat", package: "swift-nio"),
44+
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
45+
.product(name: "OpenAPIAsyncHTTPClient", package: "swift-openapi-async-http-client"),
46+
],
47+
plugins: [
48+
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
4149
]
4250
),
4351
.target(

Sources/LinuxPlatform/Linux.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public struct Linux: Platform {
6969
You can install the ca-certificates package on your system to fix this.
7070
"""
7171

72-
throw Error(message: msg)
72+
throw SwiftlyError(message: msg)
7373
}
7474
}
7575

@@ -258,7 +258,7 @@ public struct Linux: Platform {
258258
}
259259
msg += "\n" + Self.skipVerificationMessage
260260

261-
throw Error(message: msg)
261+
throw SwiftlyError(message: msg)
262262
}
263263

264264
// Import the latest swift keys, but only once per session, which will help with the performance in tests
@@ -270,7 +270,7 @@ public struct Linux: Platform {
270270
}
271271

272272
guard let url = URL(string: "https://www.swift.org/keys/all-keys.asc") else {
273-
throw Error(message: "malformed URL to the swift gpg keys")
273+
throw SwiftlyError(message: "malformed URL to the swift gpg keys")
274274
}
275275

276276
try await httpClient.downloadFile(url: url, to: tmpFile)
@@ -329,7 +329,7 @@ public struct Linux: Platform {
329329

330330
public func install(from tmpFile: URL, version: ToolchainVersion, verbose: Bool) throws {
331331
guard tmpFile.fileExists() else {
332-
throw Error(message: "\(tmpFile) doesn't exist")
332+
throw SwiftlyError(message: "\(tmpFile) doesn't exist")
333333
}
334334

335335
if !self.swiftlyToolchainsDir.fileExists() {
@@ -361,7 +361,7 @@ public struct Linux: Platform {
361361

362362
public func extractSwiftlyAndInstall(from archive: URL) throws {
363363
guard archive.fileExists() else {
364-
throw Error(message: "\(archive) doesn't exist")
364+
throw SwiftlyError(message: "\(archive) doesn't exist")
365365
}
366366

367367
let tmpDir = self.getTempFilePath()
@@ -414,7 +414,7 @@ public struct Linux: Platform {
414414
do {
415415
try self.runProgram("gpg", "--verify", sigFile.path, archive.path, quiet: !verbose)
416416
} catch {
417-
throw Error(message: "Signature verification failed: \(error).")
417+
throw SwiftlyError(message: "Signature verification failed: \(error).")
418418
}
419419
}
420420

@@ -471,7 +471,7 @@ public struct Linux: Platform {
471471
guard let releaseFile = releaseFile else {
472472
let message = "Unable to detect the type of Linux OS and the release"
473473
if disableConfirmation {
474-
throw Error(message: message)
474+
throw SwiftlyError(message: message)
475475
} else {
476476
print(message)
477477
}
@@ -498,7 +498,7 @@ public struct Linux: Platform {
498498
guard let id, let versionID else {
499499
let message = "Unable to find release information from file \(releaseFile)"
500500
if disableConfirmation {
501-
throw Error(message: message)
501+
throw SwiftlyError(message: message)
502502
} else {
503503
print(message)
504504
}
@@ -509,7 +509,7 @@ public struct Linux: Platform {
509509
guard versionID == "2" else {
510510
let message = "Unsupported version of Amazon Linux"
511511
if disableConfirmation {
512-
throw Error(message: message)
512+
throw SwiftlyError(message: message)
513513
} else {
514514
print(message)
515515
}
@@ -521,7 +521,7 @@ public struct Linux: Platform {
521521
guard versionID.hasPrefix("9") else {
522522
let message = "Unsupported version of RHEL"
523523
if disableConfirmation {
524-
throw Error(message: message)
524+
throw SwiftlyError(message: message)
525525
} else {
526526
print(message)
527527
}
@@ -535,7 +535,7 @@ public struct Linux: Platform {
535535

536536
let message = "Unsupported Linux platform"
537537
if disableConfirmation {
538-
throw Error(message: message)
538+
throw SwiftlyError(message: message)
539539
} else {
540540
print(message)
541541
}

Sources/MacOSPlatform/MacOS.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public struct MacOS: Platform {
5151

5252
public func install(from tmpFile: URL, version: ToolchainVersion, verbose: Bool) throws {
5353
guard tmpFile.fileExists() else {
54-
throw Error(message: "\(tmpFile) doesn't exist")
54+
throw SwiftlyError(message: "\(tmpFile) doesn't exist")
5555
}
5656

5757
if !self.swiftlyToolchainsDir.fileExists() {
@@ -85,7 +85,7 @@ public struct MacOS: Platform {
8585

8686
public func extractSwiftlyAndInstall(from archive: URL) throws {
8787
guard archive.fileExists() else {
88-
throw Error(message: "\(archive) doesn't exist")
88+
throw SwiftlyError(message: "\(archive) doesn't exist")
8989
}
9090

9191
let homeDir: URL
@@ -111,7 +111,7 @@ public struct MacOS: Platform {
111111
// and the ones that are mocked here in the test framework.
112112
let payload = tmpDir.appendingPathComponent("Payload")
113113
guard payload.fileExists() else {
114-
throw Error(message: "Payload file could not be found at \(tmpDir).")
114+
throw SwiftlyError(message: "Payload file could not be found at \(tmpDir).")
115115
}
116116

117117
try runProgram("tar", "-C", installDir.path, "-xf", payload.path)
@@ -128,11 +128,11 @@ public struct MacOS: Platform {
128128
let decoder = PropertyListDecoder()
129129
let infoPlist = toolchainDir.appendingPathComponent("Info.plist")
130130
guard let data = try? Data(contentsOf: infoPlist) else {
131-
throw Error(message: "could not open \(infoPlist)")
131+
throw SwiftlyError(message: "could not open \(infoPlist)")
132132
}
133133

134134
guard let pkgInfo = try? decoder.decode(SwiftPkgInfo.self, from: data) else {
135-
throw Error(message: "could not decode plist at \(infoPlist)")
135+
throw SwiftlyError(message: "could not decode plist at \(infoPlist)")
136136
}
137137

138138
try FileManager.default.removeItem(at: toolchainDir)

Sources/Swiftly/Config.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct Config: Codable, Equatable {
4040
4141
To begin using swiftly you can install it: '\(CommandLine.arguments[0]) init'.
4242
"""
43-
throw Error(message: msg)
43+
throw SwiftlyError(message: msg)
4444
}
4545
}
4646

0 commit comments

Comments
 (0)