Skip to content

Commit e22ea16

Browse files
authored
Avoid emitting a .info diagnostic with an empty message when there is no compiler output at all (#5566)
rdar://94414151
1 parent 2c67abc commit e22ea16

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Sources/Workspace/DefaultPluginScriptRunner.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
318318
completion($0.tryMap { process in
319319
// Emit the compiler output as observable info.
320320
let compilerOutput = ((try? process.utf8Output()) ?? "") + ((try? process.utf8stderrOutput()) ?? "")
321-
observabilityScope.emit(info: compilerOutput)
321+
if !compilerOutput.isEmpty {
322+
observabilityScope.emit(info: compilerOutput)
323+
}
322324

323325
// Save the persisted compilation state for possible reuse next time.
324326
let compilationState = PersistedCompilationState(

Tests/FunctionalTests/PluginTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ class PluginTests: XCTestCase {
441441
catch {
442442
XCTFail("error \(String(describing: error))", file: file, line: line)
443443
}
444+
445+
// Check that we didn't end up with any completely empty diagnostics.
446+
XCTAssertNil(observability.diagnostics.first{ $0.message.isEmpty })
447+
448+
// Invoke the diagnostics checker for the plugin output.
444449
testDiagnostics(delegate.diagnostics, problemsOnly: false, file: file, line: line, handler: diagnosticsChecker)
445450
}
446451

0 commit comments

Comments
 (0)