Skip to content

Commit 728e2f6

Browse files
authored
Merge pull request #2489 from rintaro/pluginmessage-spi
Mark all PluginMessageHandling symbols SPI
2 parents 7c499d4 + 31ea421 commit 728e2f6

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed

Release Notes/600.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@
172172
- Pull request: https://github.com/apple/swift-syntax/pull/2531
173173
- Migration steps: Use `if case .backslash = triviaPiece` instead
174174

175+
- All symbols in `SwiftCompilerPluginMessageHandling` are now SPI
176+
- Description: This module is only intended to be used from some internal components. Any other modules should not use them directly.
177+
- Pull request: https://github.com/apple/swift-syntax/pull/2489
178+
- Migration steps: Stop using this module.
179+
175180
## Template
176181

177182
- *Affected API or two word description*

Sources/SwiftCompilerPlugin/CompilerPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
#if swift(>=6.0)
1616
public import SwiftSyntaxMacros
1717
private import Foundation
18-
private import SwiftCompilerPluginMessageHandling
18+
@_spi(PluginMessage) private import SwiftCompilerPluginMessageHandling
1919
#else
2020
import SwiftSyntaxMacros
2121
import Foundation
22-
import SwiftCompilerPluginMessageHandling
22+
@_spi(PluginMessage) import SwiftCompilerPluginMessageHandling
2323
#endif
2424

2525
#if os(Windows)

Sources/SwiftCompilerPluginMessageHandling/CompilerPluginMessageHandler.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ import SwiftSyntaxMacros
1717
#endif
1818

1919
/// Optional features.
20+
@_spi(PluginMessage)
2021
public enum PluginFeature: String {
2122
case loadPluginLibrary = "load-plugin-library"
2223
}
2324

2425
/// A type that provides the actual plugin functions.
26+
@_spi(PluginMessage)
2527
public protocol PluginProvider {
2628
/// Resolve macro type by the module name and the type name.
2729
func resolveMacro(moduleName: String, typeName: String) throws -> Macro.Type
@@ -37,6 +39,7 @@ public protocol PluginProvider {
3739

3840
/// Low level message connection to the plugin host.
3941
/// This encapsulates the connection and the message serialization.
42+
@_spi(PluginMessage)
4043
public protocol MessageConnection {
4144
/// Send a message to the peer.
4245
func sendMessage<TX: Encodable>(_ message: TX) throws
@@ -66,6 +69,7 @@ struct HostCapability {
6669
/// the response.
6770
///
6871
/// The low level connection and the provider is injected by the client.
72+
@_spi(PluginMessage)
6973
public class CompilerPluginMessageHandler<Connection: MessageConnection, Provider: PluginProvider> {
7074
/// Message channel for bidirectional communication with the plugin host.
7175
let connection: Connection

Sources/SwiftCompilerPluginMessageHandling/Macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SwiftBasicFormat
1414
import SwiftDiagnostics
1515
import SwiftOperators
1616
import SwiftSyntax
17-
@_spi(ExperimentalLanguageFeature) import SwiftSyntaxMacroExpansion
17+
@_spi(MacroExpansion) @_spi(ExperimentalLanguageFeature) import SwiftSyntaxMacroExpansion
1818
@_spi(ExperimentalLanguageFeature) import SwiftSyntaxMacros
1919

2020
extension CompilerPluginMessageHandler {

Sources/SwiftCompilerPluginMessageHandling/PluginMessageCompatibility.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// Old compiler might send '.declaration' as "freeStandingDeclaration".
14-
@_spi(PluginMessage) public extension PluginMessage.MacroRole {
14+
@_spi(PluginMessage)
15+
public extension PluginMessage.MacroRole {
1516
init(from decoder: Decoder) throws {
1617
let stringValue = try decoder.singleValueContainer().decode(String.self)
1718
if let role = Self(rawValue: stringValue) {

Sources/SwiftCompilerPluginMessageHandling/PluginMessages.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
// NOTE: Types in this file should be self-contained and should not depend on any non-stdlib types.
1414

15+
@_spi(PluginMessage)
1516
public enum HostToPluginMessage: Codable {
1617
/// Send capability of the host, and get capability of the plugin.
1718
case getCapability(
@@ -49,6 +50,7 @@ public enum HostToPluginMessage: Codable {
4950
)
5051
}
5152

53+
@_spi(PluginMessage)
5254
public enum PluginToHostMessage: Codable {
5355
case getCapabilityResult(
5456
capability: PluginMessage.PluginCapability
@@ -78,6 +80,7 @@ public enum PluginToHostMessage: Codable {
7880
)
7981
}
8082

83+
@_spi(PluginMessage)
8184
public enum PluginMessage {
8285
public static var PROTOCOL_VERSION_NUMBER: Int { 7 } // Pass extension protocol list
8386

0 commit comments

Comments
 (0)