Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 71 additions & 26 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
.package(url: "https://github.com/swift-server/async-http-client", from: "1.21.2"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.64.0"),
.package(url: "https://github.com/swift-server/async-http-client", from: "1.24.0"),
.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.79.0"),
.package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.7.2"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.6.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.7.0"),
// This dependency provides the correct version of the formatter so that you can run `swift run swiftformat Package.swift Plugins/ Sources/ Tests/`
.package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.49.18"),
],
Expand All @@ -38,6 +41,11 @@ let package = Package(
dependencies: [
.product(name: "AsyncHTTPClient", package: "async-http-client"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(name: "OpenAPIAsyncHTTPClient", package: "swift-openapi-async-http-client"),
],
plugins: [
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
]
),
.target(
Expand Down
22 changes: 11 additions & 11 deletions Sources/LinuxPlatform/Linux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public struct Linux: Platform {
You can install the ca-certificates package on your system to fix this.
"""

throw Error(message: msg)
throw SwiftlyError(message: msg)
}
}

Expand Down Expand Up @@ -258,7 +258,7 @@ public struct Linux: Platform {
}
msg += "\n" + Self.skipVerificationMessage

throw Error(message: msg)
throw SwiftlyError(message: msg)
}

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

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

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

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

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

public func extractSwiftlyAndInstall(from archive: URL) throws {
guard archive.fileExists() else {
throw Error(message: "\(archive) doesn't exist")
throw SwiftlyError(message: "\(archive) doesn't exist")
}

let tmpDir = self.getTempFilePath()
Expand Down Expand Up @@ -414,7 +414,7 @@ public struct Linux: Platform {
do {
try self.runProgram("gpg", "--verify", sigFile.path, archive.path, quiet: !verbose)
} catch {
throw Error(message: "Signature verification failed: \(error).")
throw SwiftlyError(message: "Signature verification failed: \(error).")
}
}

Expand Down Expand Up @@ -471,7 +471,7 @@ public struct Linux: Platform {
guard let releaseFile = releaseFile else {
let message = "Unable to detect the type of Linux OS and the release"
if disableConfirmation {
throw Error(message: message)
throw SwiftlyError(message: message)
} else {
print(message)
}
Expand All @@ -498,7 +498,7 @@ public struct Linux: Platform {
guard let id, let versionID else {
let message = "Unable to find release information from file \(releaseFile)"
if disableConfirmation {
throw Error(message: message)
throw SwiftlyError(message: message)
} else {
print(message)
}
Expand All @@ -509,7 +509,7 @@ public struct Linux: Platform {
guard versionID == "2" else {
let message = "Unsupported version of Amazon Linux"
if disableConfirmation {
throw Error(message: message)
throw SwiftlyError(message: message)
} else {
print(message)
}
Expand All @@ -521,7 +521,7 @@ public struct Linux: Platform {
guard versionID.hasPrefix("9") else {
let message = "Unsupported version of RHEL"
if disableConfirmation {
throw Error(message: message)
throw SwiftlyError(message: message)
} else {
print(message)
}
Expand All @@ -535,7 +535,7 @@ public struct Linux: Platform {

let message = "Unsupported Linux platform"
if disableConfirmation {
throw Error(message: message)
throw SwiftlyError(message: message)
} else {
print(message)
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/MacOSPlatform/MacOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public struct MacOS: Platform {

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

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

public func extractSwiftlyAndInstall(from archive: URL) throws {
guard archive.fileExists() else {
throw Error(message: "\(archive) doesn't exist")
throw SwiftlyError(message: "\(archive) doesn't exist")
}

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

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

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

try FileManager.default.removeItem(at: toolchainDir)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Swiftly/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public struct Config: Codable, Equatable {

To begin using swiftly you can install it: '\(CommandLine.arguments[0]) init'.
"""
throw Error(message: msg)
throw SwiftlyError(message: msg)
}
}

Expand Down
Loading
Loading