Skip to content

Improve Swift Build error formatting #8493

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 4 commits into from
Apr 15, 2025

Conversation

pmattos
Copy link
Contributor

@pmattos pmattos commented Apr 12, 2025

Motivation:

This improves a bit the error/warning output when building with the new --build-system swiftbuild.

This was the current output:

warning: unknown Enabling the Swift language feature 'MemberImportVisibility' is recommended; set 'SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES' []
error: path("/Users/pmattos/Development/SampleProjects/SamplePackages/PackageAccessCLI/Sources/ExampleApp/main.swift", fileLocation: Optional(SwiftBuild.SwiftBuildMessage.DiagnosticInfo.Location.FileLocation.textual(line: 6, column: Optional(5)))) cannot find 'bar' in scope []

...and this is the improved one:

warning: Enabling the Swift language feature 'MemberImportVisibility' is recommended; set 'SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES' 
error: /Users/pmattos/Development/SampleProjects/SamplePackages/PackageAccessCLI/Sources/ExampleApp/main.swift:5:5 cannot find 'foo2' in scope 

Eventually, we should consider adopting the error output style from the --build-system native instead, i.e.:

/Users/pmattos/Development/SampleProjects/SamplePackages/PackageAccessCLI/Sources/ExampleApp/main.swift:5:5: error: cannot find 'foo2' in scope
3 | print("Hello, world!")
4 | 
5 | _ = foo2()
  |     `- error: cannot find 'foo2' in scope
6 | _ = bar()
7 | 

Modifications:

These formatting changes are strictly local to the new SwiftBuildSupport target.

Result:

Slightly better error formatting :-)

@pmattos
Copy link
Contributor Author

pmattos commented Apr 12, 2025

@swift-ci test

@pmattos pmattos force-pushed the pmattos/swift-build-error-formatting branch from 608db76 to bdc6d0a Compare April 12, 2025 06:58
@pmattos
Copy link
Contributor Author

pmattos commented Apr 12, 2025

@swift-ci test

1 similar comment
@pmattos
Copy link
Contributor Author

pmattos commented Apr 12, 2025

@swift-ci test

@pmattos
Copy link
Contributor Author

pmattos commented Apr 14, 2025

@swift-ci test macOS

@pmattos pmattos force-pushed the pmattos/swift-build-error-formatting branch from bdc6d0a to d0ceaa2 Compare April 14, 2025 18:44
@pmattos
Copy link
Contributor Author

pmattos commented Apr 14, 2025

@swift-ci test

@dschaefer2
Copy link
Member

@swift-ci please test windows

@dschaefer2
Copy link
Member

@swift-ci please test self hosted windows

@pmattos
Copy link
Contributor Author

pmattos commented Apr 14, 2025

@swift-ci please test self hosted macOS

@pmattos
Copy link
Contributor Author

pmattos commented Apr 14, 2025

@swift-ci test

1 similar comment
@pmattos
Copy link
Contributor Author

pmattos commented Apr 14, 2025

@swift-ci test

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test linux

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test macos

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows

3 similar comments
@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows self hosted

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows nightly toolchain

@bkhouri
Copy link
Contributor

bkhouri commented Apr 15, 2025

@swift-ci test self hosted windows

@bkhouri bkhouri enabled auto-merge (squash) April 15, 2025 16:43
@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test smoke test windows

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test windows

@bkhouri bkhouri merged commit dec1ded into main Apr 15, 2025
7 checks passed
@bkhouri bkhouri deleted the pmattos/swift-build-error-formatting branch April 15, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants