Skip to content

[CompilerPlugin] Factor out message handling logic to a module #1403

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 1 commit into from
Mar 11, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Mar 10, 2023

Create a module _SwiftCompilerPluginImpl that abstracts the low level message connection/serialization.

CompilerPlugin is now an implementation of the message connection, and adapts the concrete type to the message handler.

This make it possible to make a plugin with a different messaging connection and serialization.

@rintaro rintaro requested a review from ahoppen as a code owner March 10, 2023 19:29
@rintaro
Copy link
Member Author

rintaro commented Mar 10, 2023

@swift-ci Please test

@rintaro rintaro requested a review from bnbarham March 10, 2023 19:31
@rintaro
Copy link
Member Author

rintaro commented Mar 10, 2023

@swift-ci Please test

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge fan of Impl. CompilerPluginAPI or something?

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about naming the module SwiftCompilerPluginMessageHandling or something like that. I think that’s more descriptive than Impl. Also, I’m not sure whether we should underscore it because it seems equally useful to users as the other modules in swift-syntax.

Package.swift Outdated
@@ -43,6 +43,7 @@ let package = Package(
.library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]),
.library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"]),
.library(name: "SwiftSyntaxMacros", type: .static, targets: ["SwiftSyntaxMacros"]),
.library(name: "_SwiftCompilerPluginBase", type: .static, targets: ["_SwiftCompilerPluginImpl"]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library is named differently than the target. Is that intentional?

Create a module '_SwiftCompilerPluginImpl' that abstracts the low level
message connection/serilaization.

'CompilerPlugin' is now a implementation of the message connection, and
adapts the concrete type to the message handler.

This make it possible to make a plugin with a different messaging
connection and serialization.
@rintaro
Copy link
Member Author

rintaro commented Mar 10, 2023

Thank for naming idea. Let me go with SwiftCompilerPluginMessageHandling

@rintaro
Copy link
Member Author

rintaro commented Mar 10, 2023

@swift-ci Please test

@rintaro rintaro merged commit fbd615b into swiftlang:main Mar 11, 2023
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.

3 participants