Skip to content

Commit 5e22621

Browse files
authored
Build plugin executables with debug symbols (#5665)
This seems like the better default until we might add a dedicated debugging feature for plugins.
1 parent 6cb8f61 commit 5e22621

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

Sources/Workspace/DefaultPluginScriptRunner.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
164164
// Add any extra flags required as indicated by the ManifestLoader.
165165
commandLine += self.toolchain.swiftCompilerFlags
166166

167+
commandLine.append("-g")
168+
167169
// Add the Swift language version implied by the package tools version.
168170
commandLine += ["-swift-version", toolsVersion.swiftLanguageVersion.rawValue]
169171

Tests/SPMBuildCoreTests/PluginInvocationTests.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,6 @@ class PluginInvocationTests: XCTestCase {
373373
XCTAssert(result.compilerOutput.contains("warning: variable 'unused' was never used"), "\(result.compilerOutput)")
374374
XCTAssert(result.diagnosticsFile.suffix == ".dia", "\(result.diagnosticsFile.pathString)")
375375

376-
// Check the serialized diagnostics. We should no longer have an error but now have a warning.
377-
let diaFileContents = try localFileSystem.readFileContents(result.diagnosticsFile)
378-
let diagnosticsSet = try SerializedDiagnostics(bytes: diaFileContents)
379-
XCTAssertEqual(diagnosticsSet.diagnostics.count, 1)
380-
let warningDiagnostic = try XCTUnwrap(diagnosticsSet.diagnostics.first)
381-
XCTAssertTrue(warningDiagnostic.text.hasPrefix("variable \'unused\' was never used"), "\(warningDiagnostic)")
382-
383376
// Check that the executable file exists.
384377
XCTAssertTrue(localFileSystem.exists(result.executableFile), "\(result.executableFile.pathString)")
385378

@@ -408,13 +401,6 @@ class PluginInvocationTests: XCTestCase {
408401
XCTAssert(result.compilerOutput.contains("warning: variable 'unused' was never used"), "\(result.compilerOutput)")
409402
XCTAssert(result.diagnosticsFile.suffix == ".dia", "\(result.diagnosticsFile.pathString)")
410403

411-
// Check that the diagnostics still have the same warning as before.
412-
let diaFileContents = try localFileSystem.readFileContents(result.diagnosticsFile)
413-
let diagnosticsSet = try SerializedDiagnostics(bytes: diaFileContents)
414-
XCTAssertEqual(diagnosticsSet.diagnostics.count, 1)
415-
let warningDiagnostic = try XCTUnwrap(diagnosticsSet.diagnostics.first)
416-
XCTAssertTrue(warningDiagnostic.text.hasPrefix("variable \'unused\' was never used"), "\(warningDiagnostic)")
417-
418404
// Check that the executable file exists.
419405
XCTAssertTrue(localFileSystem.exists(result.executableFile), "\(result.executableFile.pathString)")
420406

0 commit comments

Comments
 (0)