Skip to content

Commit 6df66b4

Browse files
committed
Testing...
1 parent b54ac5c commit 6df66b4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Sources/Workspace/DefaultPluginScriptRunner.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import PackageModel
1717
import SPMBuildCore
1818
import TSCBasic
1919

20+
import struct TSCUtility.SerializedDiagnostics
2021
import struct TSCUtility.Triple
2122

2223
/// A plugin script runner that compiles the plugin source files as an executable binary for the host platform, and invokes it as a subprocess.
@@ -121,6 +122,8 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
121122

122123
// We use the toolchain's Swift compiler for compiling the plugin.
123124
var commandLine = [self.toolchain.swiftCompilerPathForManifests.pathString]
125+
126+
observabilityScope.emit(debug: "Using compiler \(self.toolchain.swiftCompilerPathForManifests.pathString)")
124127

125128
// Get access to the path containing the PackagePlugin module and library.
126129
let pluginLibraryPath = self.toolchain.swiftPMLibrariesLocation.pluginLibraryPath
@@ -208,6 +211,8 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
208211
if (verboseOutput) {
209212
commandLine.append("-v")
210213
}
214+
215+
observabilityScope.emit(debug: "Using command line \(commandLine)")
211216

212217
// Pass through the compilation environment.
213218
let environment = toolchain.swiftCompilerEnvironment
@@ -363,6 +368,10 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
363368
compilerOutput: compilerOutput,
364369
cached: false)
365370

371+
let diaFileContents = try localFileSystem.readFileContents(result.diagnosticsFile)
372+
let diagnosticsSet = try SerializedDiagnostics(bytes: diaFileContents)
373+
observabilityScope.emit(debug: "Got serialized diagnostics: \(diagnosticsSet.diagnostics) from \(result.diagnosticsFile)")
374+
366375
// Tell the delegate that we're done compiling the plugin, passing it the result.
367376
delegate.didCompilePlugin(result: result)
368377

Tests/SPMBuildCoreTests/PluginInvocationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class PluginInvocationTests: XCTestCase {
413413
// Check the serialized diagnostics. We should no longer have an error but now have a warning.
414414
let diaFileContents = try localFileSystem.readFileContents(result.diagnosticsFile)
415415
let diagnosticsSet = try SerializedDiagnostics(bytes: diaFileContents)
416-
XCTAssertEqual(diagnosticsSet.diagnostics.count, 1)
416+
XCTAssertEqual(diagnosticsSet.diagnostics.count, 1, "unexpected diagnostics count in \(diagnosticsSet.diagnostics) from \(result.diagnosticsFile.pathString)")
417417
let warningDiagnostic = try XCTUnwrap(diagnosticsSet.diagnostics.first)
418418
XCTAssertTrue(warningDiagnostic.text.hasPrefix("variable \'unused\' was never used"), "\(warningDiagnostic)")
419419

0 commit comments

Comments
 (0)