Skip to content

Commit 6361b4b

Browse files
authored
[6.4] Remove percent from swift build progress logging (#10068)
Cherry-pick of #10063
1 parent 1d29fcd commit 6361b4b

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

Sources/SwiftBuildSupport/SwiftBuildSystem.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
706706
switch operation.state {
707707
case .succeeded:
708708
guard !self.logLevel.isQuiet else { return }
709-
buildMessageHandler.progressAnimation.update(step: 100, total: 100, text: "")
710709
buildMessageHandler.progressAnimation.complete(success: true)
711710
let duration = ContinuousClock.Instant.now - buildStartTime
712711
let formattedDuration = duration.formatted(.units(allowed: [.seconds], fractionalPart: .show(length: 2, rounded: .up)))

Sources/SwiftBuildSupport/SwiftBuildSystemMessageHandler.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,15 @@ public final class SwiftBuildSystemMessageHandler {
242242
}
243243
}
244244
case .didUpdateProgress(let progressInfo):
245-
let step = Int(progressInfo.percentComplete)
246245
let message = if let targetName = progressInfo.targetName {
247-
"\(targetName) \(progressInfo.message)"
246+
"[\(progressInfo.message)] \(targetName)"
248247
} else {
249-
"\(progressInfo.message)"
248+
"[\(progressInfo.message)]"
250249
}
251250

252251
// Skip if message doesn't contain anything useful to display.
253-
// TODO: To file an issue for SwiftBuild here.
254-
if message.contains(where: \.isLetter) {
255-
progressAnimation.update(step: step, total: 100, text: message)
252+
if !message.isEmpty {
253+
progressAnimation.update(step: -1, total: 100, text: message)
256254
}
257255

258256
callback = { [weak self] buildSystem in

Tests/SwiftBuildSupportTests/SwiftBuildSystemMessageHandlerTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,10 @@ struct SwiftBuildSystemMessageHandlerTests {
480480
#expect(self.observability.diagnostics.count == 0)
481481

482482
let output = self.outputStream.bytes.description
483-
#expect(output.contains("Weird percent"))
484-
#expect(!output.contains("12 / 32"))
485-
#expect(output.contains("Something useful"))
486-
#expect(output.contains("Complete"))
483+
#expect(output.contains("[Weird percent]"))
484+
#expect(output.contains("[12 / 32]"))
485+
#expect(output.contains("[Something useful]"))
486+
#expect(output.contains("[Complete]"))
487487
}
488488
}
489489

0 commit comments

Comments
 (0)