Skip to content

Commit aa033d6

Browse files
authored
Add scripts to fetch and generate protos (#1784)
* Add scripts to fetch and generate protos Motivation: Many of the proto files used in the repo are copied from upstream gRPC repos and built using the Makefile. There's no easy wasy to update the proto files and the Makefile has grown quite unwieldly and tends to be a bit painful to update. It's also inconvenient to run each generate target and targets often get missed. Modifications: - Add a 'Protos' directory containing two scripts: 'fetch.sh' and 'generate.sh'. - 'fetch.sh' clones a few upstream gRPC repos and selectively copies out protos we are interested in into 'Protos/upstream'. This makes it convenient to update all vendored protos. - 'generate.sh' effectively replaces the Makefile with separaet functions for generating grpc code and messages. - Move a few other protos from Sources/Tests into Protos - Remove the Makefile Result: Much easier to update and re-generate protos.
1 parent 53396af commit aa033d6

File tree

27 files changed

+1606
-335
lines changed

27 files changed

+1606
-335
lines changed

Makefile

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

Package.swift

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ extension Target {
189189
.grpcCore
190190
]
191191
)
192-
192+
193193
static let grpcInterceptors: Target = .target(
194194
name: "GRPCInterceptors",
195195
dependencies: [
@@ -208,14 +208,14 @@ extension Target {
208208
.dequeModule
209209
]
210210
)
211-
211+
212212
static let grpcHTTP2TransportNIOPosix: Target = .target(
213213
name: "GRPCHTTP2TransportNIOPosix",
214214
dependencies: [
215215
.grpcHTTP2Core
216216
]
217217
)
218-
218+
219219
static let grpcHTTP2TransportNIOTransportServices: Target = .target(
220220
name: "GRPCHTTP2TransportNIOTransportServices",
221221
dependencies: [
@@ -276,8 +276,7 @@ extension Target {
276276
.nioSSL, if: includeNIOSSL
277277
),
278278
exclude: [
279-
"Codegen/Normalization/normalization.proto",
280-
"Codegen/Serialization/echo.grpc.reflection",
279+
"Codegen/Serialization/echo.grpc.reflection"
281280
]
282281
)
283282

@@ -298,7 +297,7 @@ extension Target {
298297
.grpcInProcessTransport
299298
]
300299
)
301-
300+
302301
static let grpcInterceptorsTests: Target = .testTarget(
303302
name: "GRPCInterceptorsTests",
304303
dependencies: [
@@ -319,14 +318,14 @@ extension Target {
319318
.nioTestUtils,
320319
]
321320
)
322-
321+
323322
static let grpcHTTP2TransportNIOPosixTests: Target = .testTarget(
324323
name: "GRPCHTTP2TransportNIOPosixTests",
325324
dependencies: [
326325
.grpcHTTP2TransportNIOPosix
327326
]
328327
)
329-
328+
330329
static let grpcHTTP2TransportNIOTransportServicesTests: Target = .testTarget(
331330
name: "GRPCHTTP2TransportNIOTransportServicesTests",
332331
dependencies: [
@@ -349,7 +348,7 @@ extension Target {
349348
.protobuf
350349
]
351350
)
352-
351+
353352
static let grpcProtobufCodeGenTests: Target = .testTarget(
354353
name: "GRPCProtobufCodeGenTests",
355354
dependencies: [
@@ -359,7 +358,7 @@ extension Target {
359358
.protobufPluginLibrary
360359
]
361360
)
362-
361+
363362
static let interopTestModels: Target = .target(
364363
name: "GRPCInteroperabilityTestModels",
365364
dependencies: [
@@ -447,10 +446,7 @@ extension Target {
447446
.nio,
448447
.protobuf,
449448
],
450-
path: "Sources/Examples/Echo/Model",
451-
exclude: [
452-
"echo.proto",
453-
]
449+
path: "Sources/Examples/Echo/Model"
454450
)
455451

456452
static let echoImplementation: Target = .target(
@@ -489,10 +485,7 @@ extension Target {
489485
.nio,
490486
.protobuf,
491487
],
492-
path: "Sources/Examples/HelloWorld/Model",
493-
exclude: [
494-
"helloworld.proto",
495-
]
488+
path: "Sources/Examples/HelloWorld/Model"
496489
)
497490

498491
static let helloWorldClient: Target = .executableTarget(
@@ -526,10 +519,7 @@ extension Target {
526519
.nio,
527520
.protobuf,
528521
],
529-
path: "Sources/Examples/RouteGuide/Model",
530-
exclude: [
531-
"route_guide.proto",
532-
]
522+
path: "Sources/Examples/RouteGuide/Model"
533523
)
534524

535525
static let routeGuideClient: Target = .executableTarget(
@@ -580,11 +570,7 @@ extension Target {
580570
.nio,
581571
.protobuf,
582572
],
583-
path: "Sources/GRPCReflectionService",
584-
exclude: [
585-
"v1/reflection-v1.proto",
586-
"v1Alpha/reflection-v1alpha.proto"
587-
]
573+
path: "Sources/GRPCReflectionService"
588574
)
589575

590576
static let reflectionServer: Target = .executableTarget(
@@ -609,7 +595,7 @@ extension Target {
609595
name: "GRPCCodeGen",
610596
path: "Sources/GRPCCodeGen"
611597
)
612-
598+
613599
static let grpcProtobuf: Target = .target(
614600
name: "GRPCProtobuf",
615601
dependencies: [

0 commit comments

Comments
 (0)