Skip to content

Commit 10dcf20

Browse files
committed
Remove v1 code generator
1 parent 2ccb946 commit 10dcf20

15 files changed

+42
-2101
lines changed

Sources/protoc-gen-grpc-swift/Docs.docc/spm-plugin.md

Lines changed: 0 additions & 152 deletions
This file was deleted.

Sources/protoc-gen-grpc-swift/GenerateGRPC.swift

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515
*/
1616

1717
import Foundation
18-
import SwiftProtobuf
19-
import SwiftProtobufPluginLibrary
20-
21-
#if compiler(>=6.0)
2218
import GRPCCodeGen
2319
import GRPCProtobufCodeGen
24-
#endif
20+
import SwiftProtobuf
21+
import SwiftProtobufPluginLibrary
2522

2623
@main
2724
final class GenerateGRPC: CodeGenerator {
@@ -65,17 +62,7 @@ final class GenerateGRPC: CodeGenerator {
6562
continue
6663
}
6764

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)
7966
}
8067
}
8168

@@ -98,21 +85,6 @@ final class GenerateGRPC: CodeGenerator {
9885
try outputs.add(fileName: fileName, contents: reflectionData)
9986
}
10087

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)
11688
private func generateV2Stubs(
11789
_ descriptor: FileDescriptor,
11890
options: GeneratorOptions,
@@ -133,7 +105,6 @@ final class GenerateGRPC: CodeGenerator {
133105

134106
try outputs.add(fileName: fileName, contents: contents)
135107
}
136-
#endif
137108
}
138109

139110
extension GenerateGRPC {
@@ -211,7 +182,6 @@ private func splitPath(pathname: String) -> (dir: String, base: String, suffix:
211182
return (dir: dir, base: base, suffix: suffix)
212183
}
213184

214-
#if compiler(>=6.0)
215185
extension SourceGenerator.Config {
216186
init(options: GeneratorOptions) {
217187
let accessLevel: SourceGenerator.Config.AccessLevel
@@ -232,4 +202,3 @@ extension SourceGenerator.Config {
232202
)
233203
}
234204
}
235-
#endif

0 commit comments

Comments
 (0)