15
15
*/
16
16
17
17
import Foundation
18
- import SwiftProtobuf
19
- import SwiftProtobufPluginLibrary
20
-
21
- #if compiler(>=6.0)
22
18
import GRPCCodeGen
23
19
import GRPCProtobufCodeGen
24
- #endif
20
+ import SwiftProtobuf
21
+ import SwiftProtobufPluginLibrary
25
22
26
23
@main
27
24
final class GenerateGRPC : CodeGenerator {
@@ -65,17 +62,7 @@ final class GenerateGRPC: CodeGenerator {
65
62
continue
66
63
}
67
64
68
- if options. generateClient || options. generateServer || options. generateTestClient {
69
- #if compiler(>=6.0)
70
- if options. v2 {
71
- try self . generateV2Stubs ( descriptor, options: options, outputs: outputs)
72
- } else {
73
- try self . generateV1Stubs ( descriptor, options: options, outputs: outputs)
74
- }
75
- #else
76
- try self . generateV1Stubs ( descriptor, options: options, outputs: outputs)
77
- #endif
78
- }
65
+ try self . generateV2Stubs ( descriptor, options: options, outputs: outputs)
79
66
}
80
67
}
81
68
@@ -98,21 +85,6 @@ final class GenerateGRPC: CodeGenerator {
98
85
try outputs. add ( fileName: fileName, contents: reflectionData)
99
86
}
100
87
101
- private func generateV1Stubs(
102
- _ descriptor: FileDescriptor ,
103
- options: GeneratorOptions ,
104
- outputs: any GeneratorOutputs
105
- ) throws {
106
- let fileName = self . uniqueOutputFileName (
107
- fileDescriptor: descriptor,
108
- fileNamingOption: options. fileNaming
109
- )
110
-
111
- let fileGenerator = Generator ( descriptor, options: options)
112
- try outputs. add ( fileName: fileName, contents: fileGenerator. code)
113
- }
114
-
115
- #if compiler(>=6.0)
116
88
private func generateV2Stubs(
117
89
_ descriptor: FileDescriptor ,
118
90
options: GeneratorOptions ,
@@ -133,7 +105,6 @@ final class GenerateGRPC: CodeGenerator {
133
105
134
106
try outputs. add ( fileName: fileName, contents: contents)
135
107
}
136
- #endif
137
108
}
138
109
139
110
extension GenerateGRPC {
@@ -211,7 +182,6 @@ private func splitPath(pathname: String) -> (dir: String, base: String, suffix:
211
182
return ( dir: dir, base: base, suffix: suffix)
212
183
}
213
184
214
- #if compiler(>=6.0)
215
185
extension SourceGenerator . Config {
216
186
init ( options: GeneratorOptions ) {
217
187
let accessLevel : SourceGenerator . Config . AccessLevel
@@ -232,4 +202,3 @@ extension SourceGenerator.Config {
232
202
)
233
203
}
234
204
}
235
- #endif
0 commit comments