-
Notifications
You must be signed in to change notification settings - Fork 149
Enforce error diagnostics by aborting execution #607
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
czechboy0
merged 12 commits into
apple:main
from
PARAIPAN9:paraipan/180-Enforce-error-diagnostics-by-aborting-execution
Sep 18, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ee78985
Create DiagnosticSubmitter wrapper
PARAIPAN9 7fba3b9
Make emit throwable
PARAIPAN9 d71f2cf
Create ErrorThrowingDiagnosticCollector diagnostics before code gener…
PARAIPAN9 3d37c20
Add test for runGenerator function
PARAIPAN9 15277ed
Update comment
PARAIPAN9 3882872
Remove unused code
PARAIPAN9 038a428
Fix linux failures
PARAIPAN9 f2c4b43
Move YamlFileDiagnosticsCollector.swift to _OpenAPIGeneratorCore module
PARAIPAN9 4c1d323
Move diagnostics collector logic into prepare function
PARAIPAN9 28091be
Remove unnecessary text from header
PARAIPAN9 40e92e0
Add ArgumentParser explicit dependency
PARAIPAN9 c9fdec8
Merge branch 'main' into paraipan/180-Enforce-error-diagnostics-by-ab…
PARAIPAN9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Sources/_OpenAPIGeneratorCore/DiagnosticsCollectorProvider.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This source file is part of the SwiftOpenAPIGenerator open source project | ||
| // | ||
| // Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors | ||
| // Licensed under Apache License v2.0 | ||
| // | ||
| // See LICENSE.txt for license information | ||
| // See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| import Foundation | ||
|
|
||
| /// Prepares a diagnostics collector. | ||
| /// - Parameter outputPath: A file path where to persist the YAML file. If `nil`, diagnostics will be printed to stderr. | ||
| /// - Returns: A tuple containing: | ||
| /// - An instance of `DiagnosticCollector` conforming to `Sendable`. | ||
| /// - A closure to finalize the diagnostics collection | ||
| public func preparedDiagnosticsCollector(outputPath: URL?) -> (any DiagnosticCollector & Sendable, () throws -> Void) { | ||
| let innerDiagnostics: any DiagnosticCollector & Sendable | ||
| let finalizeDiagnostics: () throws -> Void | ||
|
|
||
| if let outputPath { | ||
| let _diagnostics = _YamlFileDiagnosticsCollector(url: outputPath) | ||
| finalizeDiagnostics = _diagnostics.finalize | ||
| innerDiagnostics = _diagnostics | ||
| } else { | ||
| innerDiagnostics = StdErrPrintingDiagnosticCollector() | ||
| finalizeDiagnostics = {} | ||
| } | ||
| let diagnostics = ErrorThrowingDiagnosticCollector(upstream: innerDiagnostics) | ||
| return (diagnostics, finalizeDiagnostics) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.