Skip to content

Commit ca7aeb7

Browse files
committed
Re-add the progress animation code
1 parent 04d881c commit ca7aeb7

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

Package.resolved

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
1818
.package(url: "https://github.com/swift-server/async-http-client", from: "1.21.2"),
1919
.package(url: "https://github.com/apple/swift-nio.git", from: "2.64.0"),
20-
//.package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.7.1"),
20+
.package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.7.2"),
2121
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
2222
// This dependency provides the correct version of the formatter so that you can run `swift run swiftformat Package.swift Plugins/ Sources/ Tests/`
2323
.package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.49.18"),
@@ -30,7 +30,7 @@ let package = Package(
3030
.target(name: "SwiftlyCore"),
3131
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
3232
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
33-
//.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
33+
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
3434
]
3535
),
3636
.target(

Sources/Swiftly/Install.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import _StringProcessing
22
import ArgumentParser
33
import Foundation
4-
//import TSCBasic
5-
//import TSCUtility
4+
import TSCBasic
5+
import TSCUtility
66

77
import SwiftlyCore
88

@@ -192,10 +192,10 @@ struct Install: SwiftlyCommand {
192192
throw Error(message: "Invalid toolchain URL: \(url)")
193193
}
194194

195-
/*let animation = PercentProgressAnimation(
195+
let animation = PercentProgressAnimation(
196196
stream: stdoutStream,
197197
header: "Downloading \(version)"
198-
)*/
198+
)
199199

200200
var lastUpdate = Date()
201201

@@ -215,20 +215,20 @@ struct Install: SwiftlyCommand {
215215

216216
lastUpdate = Date()
217217

218-
/*animation.update(
218+
animation.update(
219219
step: progress.receivedBytes,
220220
total: progress.totalBytes!,
221221
text: "Downloaded \(String(format: "%.1f", downloadedMiB)) MiB of \(String(format: "%.1f", totalMiB)) MiB"
222-
)*/
222+
)
223223
}
224224
)
225225
} catch let notFound as SwiftlyHTTPClient.DownloadNotFoundError {
226226
throw Error(message: "\(version) does not exist at URL \(notFound.url), exiting")
227227
} catch {
228-
//animation.complete(success: false)
228+
animation.complete(success: false)
229229
throw error
230230
}
231-
//animation.complete(success: true)
231+
animation.complete(success: true)
232232

233233
if verifySignature {
234234
try await Swiftly.currentPlatform.verifySignature(

Sources/Swiftly/SelfUpdate.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ArgumentParser
22
import Foundation
3-
//import TSCBasic
4-
//import TSCUtility
3+
import TSCBasic
4+
import TSCUtility
55

66
import SwiftlyCore
77

@@ -70,10 +70,10 @@ internal struct SelfUpdate: SwiftlyCommand {
7070
try? FileManager.default.removeItem(at: tmpFile)
7171
}
7272

73-
/*let animation = PercentProgressAnimation(
73+
let animation = PercentProgressAnimation(
7474
stream: stdoutStream,
7575
header: "Downloading swiftly \(version)"
76-
)*/
76+
)
7777
do {
7878
try await SwiftlyCore.httpClient.downloadFile(
7979
url: downloadURL,
@@ -82,18 +82,18 @@ internal struct SelfUpdate: SwiftlyCommand {
8282
let downloadedMiB = Double(progress.receivedBytes) / (1024.0 * 1024.0)
8383
let totalMiB = Double(progress.totalBytes!) / (1024.0 * 1024.0)
8484

85-
/*animation.update(
85+
animation.update(
8686
step: progress.receivedBytes,
8787
total: progress.totalBytes!,
8888
text: "Downloaded \(String(format: "%.1f", downloadedMiB)) MiB of \(String(format: "%.1f", totalMiB)) MiB"
89-
)*/
89+
)
9090
}
9191
)
9292
} catch {
93-
//animation.complete(success: false)
93+
animation.complete(success: false)
9494
throw error
9595
}
96-
//animation.complete(success: true)
96+
animation.complete(success: true)
9797

9898
try await Swiftly.currentPlatform.verifySignature(httpClient: SwiftlyCore.httpClient, archiveDownloadURL: downloadURL, archive: tmpFile, verbose: verbose)
9999
try Swiftly.currentPlatform.extractSwiftlyAndInstall(from: tmpFile)

Tools/build-swiftly-release/BuildSwiftlyRelease.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public func getShell() async throws -> String {
128128
}
129129
#endif
130130

131-
public func isSupportedLinux(useRhelUbi9: Bool) -> Bool {
132-
return true
131+
public func isSupportedLinux(useRhelUbi9 _: Bool) -> Bool {
132+
true
133133
}
134134

135135
@main

0 commit comments

Comments
 (0)