Skip to content

fix "build complete" message #3313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Sources/Build/BuildOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ public final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildS
let llbuildTarget = try computeLLBuildTargetName(for: subset)
let success = buildSystem.build(target: llbuildTarget)

buildSystemDelegate?.progressAnimation.complete(success: success)
buildSystemDelegate?.buildComplete(success: success)
delegate?.buildSystem(self, didFinishWithResult: success)
guard success else { throw Diagnostics.fatalError }

// Create backwards-compatibilty symlink to old build path.
// Create backwards-compatibility symlink to old build path.
let oldBuildPath = buildParameters.dataPath.parentDirectory.appending(
component: buildParameters.configuration.dirname
)
Expand Down
23 changes: 14 additions & 9 deletions Sources/Build/BuildOperationBuildSystemDelegateHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,25 @@ final class BuildOperationBuildSystemDelegateHandler: LLBuildBuildSystemDelegate
onCommmandFailure?()
}

func buildComplete(success: Bool) {
if success {
self.progressAnimation.update(
step: taskTracker.finishedCount,
total: taskTracker.totalCount,
text: "Build complete!")
}
self.progressAnimation.complete(success: success)
}

// MARK: Private

private func updateProgress() {
if let progressText = taskTracker.latestFinishedText {
progressAnimation.update(
self.progressAnimation.update(
step: taskTracker.finishedCount,
total: taskTracker.totalCount,
text: progressText)
text: progressText
)
}
}
}
Expand All @@ -638,13 +649,7 @@ fileprivate struct CommandTaskTracker {
case .isUpToDate:
totalCount -= 1
case .isComplete:
if (totalCount == finishedCount) {
let latestOutput: String? = latestFinishedText
latestFinishedText = """
\(latestOutput ?? "")\n
* Build Completed!
"""
}
break
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was added in #2971

@unknown default:
assertionFailure("unhandled command status kind \(kind) for command \(command)")
break
Expand Down
18 changes: 18 additions & 0 deletions Tests/CommandsTests/BuildToolTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,22 @@ final class BuildToolTests: XCTestCase {
}
}
}

func testBuildCompleteMessage() {
fixture(name: "DependencyResolution/Internal/Simple") { path in
do {
let result = try execute([], packagePath: path)
#if os(macOS)
XCTAssertTrue(result.stdout.contains("[6/6] Build complete!"), result.stdout)
#else
XCTAssertTrue(result.stdout.contains("[8/8] Build complete!"), result.stdout)
#endif
}

do {
let result = try execute([], packagePath: path)
XCTAssertTrue(result.stdout.contains("[0/0] Build complete!"), result.stdout)
}
}
}
}
4 changes: 2 additions & 2 deletions Tests/FunctionalTests/PluginTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PluginTests: XCTestCase {
XCTAssert(stdout.contains("Linking MySourceGenTool"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Generating Foo.swift from Foo.dat"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Linking MyLocalTool"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Build Completed"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Build complete!"), "stdout:\n\(stdout)")
}
catch {
print(error)
Expand All @@ -38,7 +38,7 @@ class PluginTests: XCTestCase {
XCTAssert(stdout.contains("Linking MySourceGenTool"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Generating Foo.swift from Foo.dat"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Linking MyTool"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Build Completed"), "stdout:\n\(stdout)")
XCTAssert(stdout.contains("Build complete!"), "stdout:\n\(stdout)")
}
catch {
print(error)
Expand Down