Package.swift 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. // swift-tools-version:5.8
  2. /*
  3. * Copyright 2017, gRPC Authors All rights reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import PackageDescription
  18. // swiftformat puts the next import before the tools version.
  19. // swiftformat:disable:next sortImports
  20. import class Foundation.ProcessInfo
  21. let grpcPackageName = "grpc-swift"
  22. let grpcProductName = "GRPC"
  23. let cgrpcZlibProductName = "CGRPCZlib"
  24. let grpcTargetName = grpcProductName
  25. let cgrpcZlibTargetName = cgrpcZlibProductName
  26. let includeNIOSSL = ProcessInfo.processInfo.environment["GRPC_NO_NIO_SSL"] == nil
  27. // MARK: - Package Dependencies
  28. let packageDependencies: [Package.Dependency] = [
  29. .package(
  30. url: "https://github.com/apple/swift-nio.git",
  31. from: "2.65.0"
  32. ),
  33. .package(
  34. url: "https://github.com/apple/swift-nio-http2.git",
  35. from: "1.31.0"
  36. ),
  37. .package(
  38. url: "https://github.com/apple/swift-nio-transport-services.git",
  39. from: "1.15.0"
  40. ),
  41. .package(
  42. url: "https://github.com/apple/swift-nio-extras.git",
  43. from: "1.4.0"
  44. ),
  45. .package(
  46. url: "https://github.com/apple/swift-collections.git",
  47. from: "1.0.5"
  48. ),
  49. .package(
  50. url: "https://github.com/apple/swift-atomics.git",
  51. from: "1.2.0"
  52. ),
  53. .package(
  54. url: "https://github.com/apple/swift-protobuf.git",
  55. from: "1.20.2"
  56. ),
  57. .package(
  58. url: "https://github.com/apple/swift-log.git",
  59. from: "1.4.4"
  60. ),
  61. .package(
  62. url: "https://github.com/apple/swift-argument-parser.git",
  63. // Version is higher than in other Package@swift manifests: 1.1.0 raised the minimum Swift
  64. // version and indluded async support.
  65. from: "1.1.1"
  66. ),
  67. .package(
  68. url: "https://github.com/apple/swift-docc-plugin",
  69. from: "1.0.0"
  70. ),
  71. .package(
  72. url: "https://github.com/apple/swift-distributed-tracing.git",
  73. from: "1.0.0"
  74. ),
  75. ].appending(
  76. .package(
  77. url: "https://github.com/apple/swift-nio-ssl.git",
  78. from: "2.23.0"
  79. ),
  80. if: includeNIOSSL
  81. )
  82. // MARK: - Target Dependencies
  83. extension Target.Dependency {
  84. // Target dependencies; external
  85. static let grpc: Self = .target(name: grpcTargetName)
  86. static let cgrpcZlib: Self = .target(name: cgrpcZlibTargetName)
  87. static let protocGenGRPCSwift: Self = .target(name: "protoc-gen-grpc-swift")
  88. static let performanceWorker: Self = .target(name: "performance-worker")
  89. static let reflectionService: Self = .target(name: "GRPCReflectionService")
  90. static let grpcCodeGen: Self = .target(name: "GRPCCodeGen")
  91. static let grpcProtobuf: Self = .target(name: "GRPCProtobuf")
  92. static let grpcProtobufCodeGen: Self = .target(name: "GRPCProtobufCodeGen")
  93. // Target dependencies; internal
  94. static let grpcSampleData: Self = .target(name: "GRPCSampleData")
  95. static let echoModel: Self = .target(name: "EchoModel")
  96. static let echoImplementation: Self = .target(name: "EchoImplementation")
  97. static let helloWorldModel: Self = .target(name: "HelloWorldModel")
  98. static let routeGuideModel: Self = .target(name: "RouteGuideModel")
  99. static let interopTestModels: Self = .target(name: "GRPCInteroperabilityTestModels")
  100. static let interopTestImplementation: Self =
  101. .target(name: "GRPCInteroperabilityTestsImplementation")
  102. static let interoperabilityTests: Self = .target(name: "InteroperabilityTests")
  103. // Product dependencies
  104. static let argumentParser: Self = .product(
  105. name: "ArgumentParser",
  106. package: "swift-argument-parser"
  107. )
  108. static let nio: Self = .product(name: "NIO", package: "swift-nio")
  109. static let nioConcurrencyHelpers: Self = .product(
  110. name: "NIOConcurrencyHelpers",
  111. package: "swift-nio"
  112. )
  113. static let nioCore: Self = .product(name: "NIOCore", package: "swift-nio")
  114. static let nioEmbedded: Self = .product(name: "NIOEmbedded", package: "swift-nio")
  115. static let nioExtras: Self = .product(name: "NIOExtras", package: "swift-nio-extras")
  116. static let nioFoundationCompat: Self = .product(name: "NIOFoundationCompat", package: "swift-nio")
  117. static let nioHTTP1: Self = .product(name: "NIOHTTP1", package: "swift-nio")
  118. static let nioHTTP2: Self = .product(name: "NIOHTTP2", package: "swift-nio-http2")
  119. static let nioPosix: Self = .product(name: "NIOPosix", package: "swift-nio")
  120. static let nioSSL: Self = .product(name: "NIOSSL", package: "swift-nio-ssl")
  121. static let nioTLS: Self = .product(name: "NIOTLS", package: "swift-nio")
  122. static let nioTransportServices: Self = .product(
  123. name: "NIOTransportServices",
  124. package: "swift-nio-transport-services"
  125. )
  126. static let nioTestUtils: Self = .product(name: "NIOTestUtils", package: "swift-nio")
  127. static let nioFileSystem: Self = .product(name: "_NIOFileSystem", package: "swift-nio")
  128. static let logging: Self = .product(name: "Logging", package: "swift-log")
  129. static let protobuf: Self = .product(name: "SwiftProtobuf", package: "swift-protobuf")
  130. static let protobufPluginLibrary: Self = .product(
  131. name: "SwiftProtobufPluginLibrary",
  132. package: "swift-protobuf"
  133. )
  134. static let dequeModule: Self = .product(name: "DequeModule", package: "swift-collections")
  135. static let atomics: Self = .product(name: "Atomics", package: "swift-atomics")
  136. static let tracing: Self = .product(name: "Tracing", package: "swift-distributed-tracing")
  137. static let grpcCore: Self = .target(name: "GRPCCore")
  138. static let grpcInProcessTransport: Self = .target(name: "GRPCInProcessTransport")
  139. static let grpcInterceptors: Self = .target(name: "GRPCInterceptors")
  140. static let grpcHTTP2Core: Self = .target(name: "GRPCHTTP2Core")
  141. static let grpcHTTP2TransportNIOPosix: Self = .target(name: "GRPCHTTP2TransportNIOPosix")
  142. static let grpcHTTP2TransportNIOTransportServices: Self = .target(name: "GRPCHTTP2TransportNIOTransportServices")
  143. }
  144. // MARK: - Targets
  145. extension Target {
  146. static let grpc: Target = .target(
  147. name: grpcTargetName,
  148. dependencies: [
  149. .cgrpcZlib,
  150. .nio,
  151. .nioCore,
  152. .nioPosix,
  153. .nioEmbedded,
  154. .nioFoundationCompat,
  155. .nioTLS,
  156. .nioTransportServices,
  157. .nioHTTP1,
  158. .nioHTTP2,
  159. .nioExtras,
  160. .logging,
  161. .protobuf,
  162. .dequeModule,
  163. ].appending(
  164. .nioSSL, if: includeNIOSSL
  165. ),
  166. path: "Sources/GRPC"
  167. )
  168. static let grpcCore: Target = .target(
  169. name: "GRPCCore",
  170. dependencies: [
  171. .dequeModule,
  172. .atomics
  173. ],
  174. path: "Sources/GRPCCore"
  175. )
  176. static let grpcInProcessTransport: Target = .target(
  177. name: "GRPCInProcessTransport",
  178. dependencies: [
  179. .grpcCore
  180. ]
  181. )
  182. static let grpcInterceptors: Target = .target(
  183. name: "GRPCInterceptors",
  184. dependencies: [
  185. .grpcCore,
  186. .tracing
  187. ]
  188. )
  189. static let grpcHTTP2Core: Target = .target(
  190. name: "GRPCHTTP2Core",
  191. dependencies: [
  192. .grpcCore,
  193. .nioCore,
  194. .nioHTTP2,
  195. .cgrpcZlib,
  196. .dequeModule,
  197. .atomics
  198. ]
  199. )
  200. static let grpcHTTP2TransportNIOPosix: Target = .target(
  201. name: "GRPCHTTP2TransportNIOPosix",
  202. dependencies: [
  203. .grpcHTTP2Core,
  204. .nioExtras
  205. ]
  206. )
  207. static let grpcHTTP2TransportNIOTransportServices: Target = .target(
  208. name: "GRPCHTTP2TransportNIOTransportServices",
  209. dependencies: [
  210. .grpcHTTP2Core
  211. ]
  212. )
  213. static let cgrpcZlib: Target = .target(
  214. name: cgrpcZlibTargetName,
  215. path: "Sources/CGRPCZlib",
  216. linkerSettings: [
  217. .linkedLibrary("z"),
  218. ]
  219. )
  220. static let protocGenGRPCSwift: Target = .executableTarget(
  221. name: "protoc-gen-grpc-swift",
  222. dependencies: [
  223. .protobuf,
  224. .protobufPluginLibrary,
  225. .grpcCodeGen,
  226. .grpcProtobufCodeGen
  227. ],
  228. exclude: [
  229. "README.md",
  230. ]
  231. )
  232. static let performanceWorker: Target = .executableTarget(
  233. name: "performance-worker",
  234. dependencies: [
  235. .grpcCore,
  236. .grpcProtobuf,
  237. .nioCore,
  238. .nioFileSystem
  239. ]
  240. )
  241. static let grpcSwiftPlugin: Target = .plugin(
  242. name: "GRPCSwiftPlugin",
  243. capability: .buildTool(),
  244. dependencies: [
  245. .protocGenGRPCSwift,
  246. ]
  247. )
  248. static let grpcTests: Target = .testTarget(
  249. name: "GRPCTests",
  250. dependencies: [
  251. .grpc,
  252. .echoModel,
  253. .echoImplementation,
  254. .helloWorldModel,
  255. .interopTestModels,
  256. .interopTestImplementation,
  257. .grpcSampleData,
  258. .nioCore,
  259. .nioConcurrencyHelpers,
  260. .nioPosix,
  261. .nioTLS,
  262. .nioHTTP1,
  263. .nioHTTP2,
  264. .nioEmbedded,
  265. .nioTransportServices,
  266. .logging,
  267. .reflectionService
  268. ].appending(
  269. .nioSSL, if: includeNIOSSL
  270. ),
  271. exclude: [
  272. "Codegen/Serialization/echo.grpc.reflection"
  273. ]
  274. )
  275. static let grpcCoreTests: Target = .testTarget(
  276. name: "GRPCCoreTests",
  277. dependencies: [
  278. .grpcCore,
  279. .grpcInProcessTransport,
  280. .dequeModule,
  281. .atomics,
  282. .protobuf,
  283. ]
  284. )
  285. static let grpcInProcessTransportTests: Target = .testTarget(
  286. name: "GRPCInProcessTransportTests",
  287. dependencies: [
  288. .grpcCore,
  289. .grpcInProcessTransport
  290. ]
  291. )
  292. static let grpcInterceptorsTests: Target = .testTarget(
  293. name: "GRPCInterceptorsTests",
  294. dependencies: [
  295. .grpcCore,
  296. .tracing,
  297. .nioCore,
  298. .grpcInterceptors
  299. ]
  300. )
  301. static let grpcHTTP2CoreTests: Target = .testTarget(
  302. name: "GRPCHTTP2CoreTests",
  303. dependencies: [
  304. .grpcHTTP2Core,
  305. .nioCore,
  306. .nioHTTP2,
  307. .nioEmbedded,
  308. .nioTestUtils,
  309. ]
  310. )
  311. static let grpcHTTP2TransportNIOPosixTests: Target = .testTarget(
  312. name: "GRPCHTTP2TransportNIOPosixTests",
  313. dependencies: [
  314. .grpcHTTP2TransportNIOPosix
  315. ]
  316. )
  317. static let grpcHTTP2TransportNIOTransportServicesTests: Target = .testTarget(
  318. name: "GRPCHTTP2TransportNIOTransportServicesTests",
  319. dependencies: [
  320. .grpcHTTP2TransportNIOTransportServices
  321. ]
  322. )
  323. static let grpcCodeGenTests: Target = .testTarget(
  324. name: "GRPCCodeGenTests",
  325. dependencies: [
  326. .grpcCodeGen
  327. ]
  328. )
  329. static let grpcProtobufTests: Target = .testTarget(
  330. name: "GRPCProtobufTests",
  331. dependencies: [
  332. .grpcProtobuf,
  333. .grpcCore,
  334. .protobuf
  335. ]
  336. )
  337. static let grpcProtobufCodeGenTests: Target = .testTarget(
  338. name: "GRPCProtobufCodeGenTests",
  339. dependencies: [
  340. .grpcCodeGen,
  341. .grpcProtobufCodeGen,
  342. .protobuf,
  343. .protobufPluginLibrary
  344. ]
  345. )
  346. static let inProcessInteroperabilityTests: Target = .testTarget(
  347. name: "InProcessInteroperabilityTests",
  348. dependencies: [
  349. .grpcInProcessTransport,
  350. .interoperabilityTests,
  351. .grpcCore
  352. ]
  353. )
  354. static let interopTestModels: Target = .target(
  355. name: "GRPCInteroperabilityTestModels",
  356. dependencies: [
  357. .grpc,
  358. .nio,
  359. .protobuf,
  360. ],
  361. exclude: [
  362. "README.md",
  363. "generate.sh",
  364. "src/proto/grpc/testing/empty.proto",
  365. "src/proto/grpc/testing/empty_service.proto",
  366. "src/proto/grpc/testing/messages.proto",
  367. "src/proto/grpc/testing/test.proto",
  368. "unimplemented_call.patch",
  369. ]
  370. )
  371. static let interoperabilityTestImplementation: Target = .target(
  372. name: "InteroperabilityTests",
  373. dependencies: [
  374. .grpcCore,
  375. .grpcProtobuf
  376. ]
  377. )
  378. static let interopTestImplementation: Target = .target(
  379. name: "GRPCInteroperabilityTestsImplementation",
  380. dependencies: [
  381. .grpc,
  382. .interopTestModels,
  383. .nioCore,
  384. .nioPosix,
  385. .nioHTTP1,
  386. .logging,
  387. ].appending(
  388. .nioSSL, if: includeNIOSSL
  389. )
  390. )
  391. static let interopTests: Target = .executableTarget(
  392. name: "GRPCInteroperabilityTests",
  393. dependencies: [
  394. .grpc,
  395. .interopTestImplementation,
  396. .nioCore,
  397. .nioPosix,
  398. .logging,
  399. .argumentParser,
  400. ]
  401. )
  402. static let backoffInteropTest: Target = .executableTarget(
  403. name: "GRPCConnectionBackoffInteropTest",
  404. dependencies: [
  405. .grpc,
  406. .interopTestModels,
  407. .nioCore,
  408. .nioPosix,
  409. .logging,
  410. .argumentParser,
  411. ],
  412. exclude: [
  413. "README.md",
  414. ]
  415. )
  416. static let perfTests: Target = .executableTarget(
  417. name: "GRPCPerformanceTests",
  418. dependencies: [
  419. .grpc,
  420. .grpcSampleData,
  421. .nioCore,
  422. .nioEmbedded,
  423. .nioPosix,
  424. .nioHTTP2,
  425. .argumentParser,
  426. ]
  427. )
  428. static let grpcSampleData: Target = .target(
  429. name: "GRPCSampleData",
  430. dependencies: includeNIOSSL ? [.nioSSL] : [],
  431. exclude: [
  432. "bundle.p12",
  433. ]
  434. )
  435. static let echoModel: Target = .target(
  436. name: "EchoModel",
  437. dependencies: [
  438. .grpc,
  439. .nio,
  440. .protobuf,
  441. ],
  442. path: "Sources/Examples/Echo/Model"
  443. )
  444. static let echoImplementation: Target = .target(
  445. name: "EchoImplementation",
  446. dependencies: [
  447. .echoModel,
  448. .grpc,
  449. .nioCore,
  450. .nioHTTP2,
  451. .protobuf,
  452. ],
  453. path: "Sources/Examples/Echo/Implementation"
  454. )
  455. static let echo: Target = .executableTarget(
  456. name: "Echo",
  457. dependencies: [
  458. .grpc,
  459. .echoModel,
  460. .echoImplementation,
  461. .grpcSampleData,
  462. .nioCore,
  463. .nioPosix,
  464. .logging,
  465. .argumentParser,
  466. ].appending(
  467. .nioSSL, if: includeNIOSSL
  468. ),
  469. path: "Sources/Examples/Echo/Runtime"
  470. )
  471. static let helloWorldModel: Target = .target(
  472. name: "HelloWorldModel",
  473. dependencies: [
  474. .grpc,
  475. .nio,
  476. .protobuf,
  477. ],
  478. path: "Sources/Examples/HelloWorld/Model"
  479. )
  480. static let helloWorldClient: Target = .executableTarget(
  481. name: "HelloWorldClient",
  482. dependencies: [
  483. .grpc,
  484. .helloWorldModel,
  485. .nioCore,
  486. .nioPosix,
  487. .argumentParser,
  488. ],
  489. path: "Sources/Examples/HelloWorld/Client"
  490. )
  491. static let helloWorldServer: Target = .executableTarget(
  492. name: "HelloWorldServer",
  493. dependencies: [
  494. .grpc,
  495. .helloWorldModel,
  496. .nioCore,
  497. .nioPosix,
  498. .argumentParser,
  499. ],
  500. path: "Sources/Examples/HelloWorld/Server"
  501. )
  502. static let routeGuideModel: Target = .target(
  503. name: "RouteGuideModel",
  504. dependencies: [
  505. .grpc,
  506. .nio,
  507. .protobuf,
  508. ],
  509. path: "Sources/Examples/RouteGuide/Model"
  510. )
  511. static let routeGuideClient: Target = .executableTarget(
  512. name: "RouteGuideClient",
  513. dependencies: [
  514. .grpc,
  515. .routeGuideModel,
  516. .nioCore,
  517. .nioPosix,
  518. .argumentParser,
  519. ],
  520. path: "Sources/Examples/RouteGuide/Client"
  521. )
  522. static let routeGuideServer: Target = .executableTarget(
  523. name: "RouteGuideServer",
  524. dependencies: [
  525. .grpc,
  526. .routeGuideModel,
  527. .nioCore,
  528. .nioConcurrencyHelpers,
  529. .nioPosix,
  530. .argumentParser,
  531. ],
  532. path: "Sources/Examples/RouteGuide/Server"
  533. )
  534. static let packetCapture: Target = .executableTarget(
  535. name: "PacketCapture",
  536. dependencies: [
  537. .grpc,
  538. .echoModel,
  539. .nioCore,
  540. .nioPosix,
  541. .nioExtras,
  542. .argumentParser,
  543. ],
  544. path: "Sources/Examples/PacketCapture",
  545. exclude: [
  546. "README.md",
  547. ]
  548. )
  549. static let reflectionService: Target = .target(
  550. name: "GRPCReflectionService",
  551. dependencies: [
  552. .grpc,
  553. .nio,
  554. .protobuf,
  555. ],
  556. path: "Sources/GRPCReflectionService"
  557. )
  558. static let reflectionServer: Target = .executableTarget(
  559. name: "ReflectionServer",
  560. dependencies: [
  561. .grpc,
  562. .reflectionService,
  563. .helloWorldModel,
  564. .nioCore,
  565. .nioPosix,
  566. .argumentParser,
  567. .echoModel,
  568. .echoImplementation
  569. ],
  570. path: "Sources/Examples/ReflectionService",
  571. resources: [
  572. .copy("Generated")
  573. ]
  574. )
  575. static let grpcCodeGen: Target = .target(
  576. name: "GRPCCodeGen",
  577. path: "Sources/GRPCCodeGen"
  578. )
  579. static let grpcProtobuf: Target = .target(
  580. name: "GRPCProtobuf",
  581. dependencies: [
  582. .grpcCore,
  583. .protobuf,
  584. ],
  585. path: "Sources/GRPCProtobuf"
  586. )
  587. static let grpcProtobufCodeGen: Target = .target(
  588. name: "GRPCProtobufCodeGen",
  589. dependencies: [
  590. .protobuf,
  591. .protobufPluginLibrary,
  592. .grpcCodeGen
  593. ],
  594. path: "Sources/GRPCProtobufCodeGen"
  595. )
  596. }
  597. // MARK: - Products
  598. extension Product {
  599. static let grpc: Product = .library(
  600. name: grpcProductName,
  601. targets: [grpcTargetName]
  602. )
  603. static let grpcCore: Product = .library(
  604. name: "_GRPCCore",
  605. targets: ["GRPCCore"]
  606. )
  607. static let cgrpcZlib: Product = .library(
  608. name: cgrpcZlibProductName,
  609. targets: [cgrpcZlibTargetName]
  610. )
  611. static let grpcReflectionService: Product = .library(
  612. name: "GRPCReflectionService",
  613. targets: ["GRPCReflectionService"]
  614. )
  615. static let protocGenGRPCSwift: Product = .executable(
  616. name: "protoc-gen-grpc-swift",
  617. targets: ["protoc-gen-grpc-swift"]
  618. )
  619. static let grpcSwiftPlugin: Product = .plugin(
  620. name: "GRPCSwiftPlugin",
  621. targets: ["GRPCSwiftPlugin"]
  622. )
  623. }
  624. // MARK: - Package
  625. let package = Package(
  626. name: grpcPackageName,
  627. products: [
  628. .grpc,
  629. .grpcCore,
  630. .cgrpcZlib,
  631. .grpcReflectionService,
  632. .protocGenGRPCSwift,
  633. .grpcSwiftPlugin,
  634. ],
  635. dependencies: packageDependencies,
  636. targets: [
  637. // Products
  638. .grpc,
  639. .cgrpcZlib,
  640. .protocGenGRPCSwift,
  641. .grpcSwiftPlugin,
  642. .reflectionService,
  643. // Tests etc.
  644. .grpcTests,
  645. .interopTestModels,
  646. .interopTestImplementation,
  647. .interopTests,
  648. .backoffInteropTest,
  649. .perfTests,
  650. .grpcSampleData,
  651. // Examples
  652. .echoModel,
  653. .echoImplementation,
  654. .echo,
  655. .helloWorldModel,
  656. .helloWorldClient,
  657. .helloWorldServer,
  658. .routeGuideModel,
  659. .routeGuideClient,
  660. .routeGuideServer,
  661. .packetCapture,
  662. .reflectionServer,
  663. // v2
  664. .grpcCore,
  665. .grpcInProcessTransport,
  666. .grpcCodeGen,
  667. .grpcInterceptors,
  668. .grpcHTTP2Core,
  669. .grpcHTTP2TransportNIOPosix,
  670. .grpcHTTP2TransportNIOTransportServices,
  671. .grpcProtobuf,
  672. .grpcProtobufCodeGen,
  673. .interoperabilityTestImplementation,
  674. .performanceWorker,
  675. // v2 tests
  676. .grpcCoreTests,
  677. .grpcInProcessTransportTests,
  678. .grpcCodeGenTests,
  679. .grpcInterceptorsTests,
  680. .grpcHTTP2CoreTests,
  681. .grpcHTTP2TransportNIOPosixTests,
  682. .grpcHTTP2TransportNIOTransportServicesTests,
  683. .grpcProtobufTests,
  684. .grpcProtobufCodeGenTests,
  685. .inProcessInteroperabilityTests
  686. ]
  687. )
  688. extension Array {
  689. func appending(_ element: Element, if condition: Bool) -> [Element] {
  690. if condition {
  691. return self + [element]
  692. } else {
  693. return self
  694. }
  695. }
  696. }