Skip to content
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

Plugin build diagnostics are badly formatted #8091

Open
1 task done
dabrahams opened this issue Nov 1, 2024 · 0 comments
Open
1 task done

Plugin build diagnostics are badly formatted #8091

dabrahams opened this issue Nov 1, 2024 · 0 comments
Labels

Comments

@dabrahams
Copy link
Contributor

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

They appear to be printing an Error's string representation

Expected behavior

A properly formatted diagnostic compatible with the Gnu coding standard for error message formatting.

Actual behavior

error: plugin compilation failed: <PluginCompilationResult(
    succeeded: false,
    commandLine: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/PluginAPI -lPackagePlugin -Xlinker -rpath -Xlinker /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/PluginAPI -target arm64-apple-macosx13.0 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -g -swift-version 6 -package-description-version 6.0.0 -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/PluginAPI -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -parse-as-library -Xfrontend -serialize-diagnostics-path -Xfrontend /Users/dave/src/citron/.build/plugins/cache/CitronParserGenerator.dia /Users/dave/src/citron/Plugins/CitronParserGenerator/CitronParserGenerator.swift -o /Users/dave/src/citron/.build/plugins/cache/CitronParserGenerator,
    executable: /Users/dave/src/citron/.build/plugins/cache/CitronParserGenerator
    diagnostics: /Users/dave/src/citron/.build/plugins/cache/CitronParserGenerator.dia
    compilerOutput: '/Users/dave/src/citron/Plugins/CitronParserGenerator/CitronParserGenerator.swift:8:83: error: value of type '\''URL'\'' has no member '\''extension'\''
 6 |   func createBuildCommands(context: PluginContext, target: Target) throws -> [Command] {
 7 |     guard let target = target as? SourceModuleTarget else { return [] }
 8 |     let inputFiles = target.sourceFiles.filter({ [ "citron", "y"].contains($0.url.extension) })
   |                                                                                   `- error: value of type '\''URL'\'' has no member '\''extension'\''
 9 |     return try inputFiles.map {
10 |       let inputFile = $0
'
)>

Steps to reproduce

Checkout the spm-bad-diagnostic-reproducer tag from https://github.com/dabrahams/citron and do swift test

Swift Package Manager version/commit hash

Whatever ships with Swift 6

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
Darwin DaveA-MBP14-5.localdomain 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:39:07 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6000 arm64

@dabrahams dabrahams added the bug label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant