Package.swift 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. // swift-tools-version:5.7
  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.58.0"
  32. ),
  33. .package(
  34. url: "https://github.com/apple/swift-nio-http2.git",
  35. from: "1.24.1"
  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 reflectionService: Self = .target(name: "GRPCReflectionService")
  89. static let grpcCodeGen: Self = .target(name: "GRPCCodeGen")
  90. static let grpcProtobuf: Self = .target(name: "GRPCProtobuf")
  91. static let grpcProtobufCodeGen: Self = .target(name: "GRPCProtobufCodeGen")
  92. // Target dependencies; internal
  93. static let grpcSampleData: Self = .target(name: "GRPCSampleData")
  94. static let echoModel: Self = .target(name: "EchoModel")
  95. static let echoImplementation: Self = .target(name: "EchoImplementation")
  96. static let helloWorldModel: Self = .target(name: "HelloWorldModel")
  97. static let routeGuideModel: Self = .target(name: "RouteGuideModel")
  98. static let interopTestModels: Self = .target(name: "GRPCInteroperabilityTestModels")
  99. static let interopTestImplementation: Self =
  100. .target(name: "GRPCInteroperabilityTestsImplementation")
  101. static let interoperabilityTests: Self = .target(name: "InteroperabilityTests")
  102. // Product dependencies
  103. static let argumentParser: Self = .product(
  104. name: "ArgumentParser",
  105. package: "swift-argument-parser"
  106. )
  107. static let nio: Self = .product(name: "NIO", package: "swift-nio")
  108. static let nioConcurrencyHelpers: Self = .product(
  109. name: "NIOConcurrencyHelpers",
  110. package: "swift-nio"
  111. )
  112. static let nioCore: Self = .product(name: "NIOCore", package: "swift-nio")
  113. static let nioEmbedded: Self = .product(name: "NIOEmbedded", package: "swift-nio")
  114. static let nioExtras: Self = .product(name: "NIOExtras", package: "swift-nio-extras")
  115. static let nioFoundationCompat: Self = .product(name: "NIOFoundationCompat", package: "swift-nio")
  116. static let nioHTTP1: Self = .product(name: "NIOHTTP1", package: "swift-nio")
  117. static let nioHTTP2: Self = .product(name: "NIOHTTP2", package: "swift-nio-http2")
  118. static let nioPosix: Self = .product(name: "NIOPosix", package: "swift-nio")
  119. static let nioSSL: Self = .product(name: "NIOSSL", package: "swift-nio-ssl")
  120. static let nioTLS: Self = .product(name: "NIOTLS", package: "swift-nio")
  121. static let nioTransportServices: Self = .product(
  122. name: "NIOTransportServices",
  123. package: "swift-nio-transport-services"
  124. )
  125. static let nioTestUtils: Self = .product(name: "NIOTestUtils", package: "swift-nio")
  126. static let logging: Self = .product(name: "Logging", package: "swift-log")
  127. static let protobuf: Self = .product(name: "SwiftProtobuf", package: "swift-protobuf")
  128. static let protobufPluginLibrary: Self = .product(
  129. name: "SwiftProtobufPluginLibrary",
  130. package: "swift-protobuf"
  131. )
  132. static let dequeModule: Self = .product(name: "DequeModule", package: "swift-collections")
  133. static let atomics: Self = .product(name: "Atomics", package: "swift-atomics")
  134. static let tracing: Self = .product(name: "Tracing", package: "swift-distributed-tracing")
  135. static let grpcCore: Self = .target(name: "GRPCCore")
  136. static let grpcInProcessTransport: Self = .target(name: "GRPCInProcessTransport")
  137. static let grpcInterceptors: Self = .target(name: "GRPCInterceptors")
  138. static let grpcHTTP2Core: Self = .target(name: "GRPCHTTP2Core")
  139. static let grpcHTTP2TransportNIOPosix: Self = .target(name: "GRPCHTTP2TransportNIOPosix")
  140. static let grpcHTTP2TransportNIOTransportServices: Self = .target(name: "GRPCHTTP2TransportNIOTransportServices")
  141. }
  142. // MARK: - Targets
  143. extension Target {
  144. static let grpc: Target = .target(
  145. name: grpcTargetName,
  146. dependencies: [
  147. .cgrpcZlib,
  148. .nio,
  149. .nioCore,
  150. .nioPosix,
  151. .nioEmbedded,
  152. .nioFoundationCompat,
  153. .nioTLS,
  154. .nioTransportServices,
  155. .nioHTTP1,
  156. .nioHTTP2,
  157. .nioExtras,
  158. .logging,
  159. .protobuf,
  160. .dequeModule,
  161. ].appending(
  162. .nioSSL, if: includeNIOSSL
  163. ),
  164. path: "Sources/GRPC"
  165. )
  166. static let grpcCore: Target = .target(
  167. name: "GRPCCore",
  168. dependencies: [
  169. .dequeModule,
  170. .atomics
  171. ],
  172. path: "Sources/GRPCCore"
  173. )
  174. static let grpcInProcessTransport: Target = .target(
  175. name: "GRPCInProcessTransport",
  176. dependencies: [
  177. .grpcCore
  178. ]
  179. )
  180. static let grpcInterceptors: Target = .target(
  181. name: "GRPCInterceptors",
  182. dependencies: [
  183. .grpcCore,
  184. .tracing
  185. ]
  186. )
  187. static let grpcHTTP2Core: Target = .target(
  188. name: "GRPCHTTP2Core",
  189. dependencies: [
  190. .grpcCore,
  191. .nioCore,
  192. .nioHTTP2,
  193. .cgrpcZlib,
  194. .dequeModule
  195. ]
  196. )
  197. static let grpcHTTP2TransportNIOPosix: Target = .target(
  198. name: "GRPCHTTP2TransportNIOPosix",
  199. dependencies: [
  200. .grpcHTTP2Core
  201. ]
  202. )
  203. static let grpcHTTP2TransportNIOTransportServices: Target = .target(
  204. name: "GRPCHTTP2TransportNIOTransportServices",
  205. dependencies: [
  206. .grpcHTTP2Core
  207. ]
  208. )
  209. static let cgrpcZlib: Target = .target(
  210. name: cgrpcZlibTargetName,
  211. path: "Sources/CGRPCZlib",
  212. linkerSettings: [
  213. .linkedLibrary("z"),
  214. ]
  215. )
  216. static let protocGenGRPCSwift: Target = .executableTarget(
  217. name: "protoc-gen-grpc-swift",
  218. dependencies: [
  219. .protobuf,
  220. .protobufPluginLibrary,
  221. .grpcCodeGen,
  222. .grpcProtobufCodeGen
  223. ],
  224. exclude: [
  225. "README.md",
  226. ]
  227. )
  228. static let grpcSwiftPlugin: Target = .plugin(
  229. name: "GRPCSwiftPlugin",
  230. capability: .buildTool(),
  231. dependencies: [
  232. .protocGenGRPCSwift,
  233. ]
  234. )
  235. static let grpcTests: Target = .testTarget(
  236. name: "GRPCTests",
  237. dependencies: [
  238. .grpc,
  239. .echoModel,
  240. .echoImplementation,
  241. .helloWorldModel,
  242. .interopTestModels,
  243. .interopTestImplementation,
  244. .grpcSampleData,
  245. .nioCore,
  246. .nioConcurrencyHelpers,
  247. .nioPosix,
  248. .nioTLS,
  249. .nioHTTP1,
  250. .nioHTTP2,
  251. .nioEmbedded,
  252. .nioTransportServices,
  253. .logging,
  254. .reflectionService
  255. ].appending(
  256. .nioSSL, if: includeNIOSSL
  257. ),
  258. exclude: [
  259. "Codegen/Serialization/echo.grpc.reflection"
  260. ]
  261. )
  262. static let grpcCoreTests: Target = .testTarget(
  263. name: "GRPCCoreTests",
  264. dependencies: [
  265. .grpcCore,
  266. .grpcInProcessTransport,
  267. .dequeModule,
  268. .atomics,
  269. .protobuf,
  270. ]
  271. )
  272. static let grpcInProcessTransportTests: Target = .testTarget(
  273. name: "GRPCInProcessTransportTests",
  274. dependencies: [
  275. .grpcCore,
  276. .grpcInProcessTransport
  277. ]
  278. )
  279. static let grpcInterceptorsTests: Target = .testTarget(
  280. name: "GRPCInterceptorsTests",
  281. dependencies: [
  282. .grpcCore,
  283. .tracing,
  284. .nioCore,
  285. .grpcInterceptors
  286. ]
  287. )
  288. static let grpcHTTP2CoreTests: Target = .testTarget(
  289. name: "GRPCHTTP2CoreTests",
  290. dependencies: [
  291. .grpcHTTP2Core,
  292. .nioCore,
  293. .nioHTTP2,
  294. .nioEmbedded,
  295. .nioTestUtils,
  296. ]
  297. )
  298. static let grpcHTTP2TransportNIOPosixTests: Target = .testTarget(
  299. name: "GRPCHTTP2TransportNIOPosixTests",
  300. dependencies: [
  301. .grpcHTTP2TransportNIOPosix
  302. ]
  303. )
  304. static let grpcHTTP2TransportNIOTransportServicesTests: Target = .testTarget(
  305. name: "GRPCHTTP2TransportNIOTransportServicesTests",
  306. dependencies: [
  307. .grpcHTTP2TransportNIOTransportServices
  308. ]
  309. )
  310. static let grpcCodeGenTests: Target = .testTarget(
  311. name: "GRPCCodeGenTests",
  312. dependencies: [
  313. .grpcCodeGen
  314. ]
  315. )
  316. static let grpcProtobufTests: Target = .testTarget(
  317. name: "GRPCProtobufTests",
  318. dependencies: [
  319. .grpcProtobuf,
  320. .grpcCore,
  321. .protobuf
  322. ]
  323. )
  324. static let grpcProtobufCodeGenTests: Target = .testTarget(
  325. name: "GRPCProtobufCodeGenTests",
  326. dependencies: [
  327. .grpcCodeGen,
  328. .grpcProtobufCodeGen,
  329. .protobuf,
  330. .protobufPluginLibrary
  331. ]
  332. )
  333. static let interopTestModels: Target = .target(
  334. name: "GRPCInteroperabilityTestModels",
  335. dependencies: [
  336. .grpc,
  337. .nio,
  338. .protobuf,
  339. ],
  340. exclude: [
  341. "README.md",
  342. "generate.sh",
  343. "src/proto/grpc/testing/empty.proto",
  344. "src/proto/grpc/testing/empty_service.proto",
  345. "src/proto/grpc/testing/messages.proto",
  346. "src/proto/grpc/testing/test.proto",
  347. "unimplemented_call.patch",
  348. ]
  349. )
  350. static let interoperabilityTestImplementation: Target = .target(
  351. name: "InteroperabilityTests",
  352. dependencies: [
  353. .grpcCore,
  354. .grpcProtobuf
  355. ]
  356. )
  357. static let interopTestImplementation: Target = .target(
  358. name: "GRPCInteroperabilityTestsImplementation",
  359. dependencies: [
  360. .grpc,
  361. .interopTestModels,
  362. .nioCore,
  363. .nioPosix,
  364. .nioHTTP1,
  365. .logging,
  366. ].appending(
  367. .nioSSL, if: includeNIOSSL
  368. )
  369. )
  370. static let interopTests: Target = .executableTarget(
  371. name: "GRPCInteroperabilityTests",
  372. dependencies: [
  373. .grpc,
  374. .interopTestImplementation,
  375. .nioCore,
  376. .nioPosix,
  377. .logging,
  378. .argumentParser,
  379. ]
  380. )
  381. static let backoffInteropTest: Target = .executableTarget(
  382. name: "GRPCConnectionBackoffInteropTest",
  383. dependencies: [
  384. .grpc,
  385. .interopTestModels,
  386. .nioCore,
  387. .nioPosix,
  388. .logging,
  389. .argumentParser,
  390. ],
  391. exclude: [
  392. "README.md",
  393. ]
  394. )
  395. static let perfTests: Target = .executableTarget(
  396. name: "GRPCPerformanceTests",
  397. dependencies: [
  398. .grpc,
  399. .grpcSampleData,
  400. .nioCore,
  401. .nioEmbedded,
  402. .nioPosix,
  403. .nioHTTP2,
  404. .argumentParser,
  405. ]
  406. )
  407. static let grpcSampleData: Target = .target(
  408. name: "GRPCSampleData",
  409. dependencies: includeNIOSSL ? [.nioSSL] : [],
  410. exclude: [
  411. "bundle.p12",
  412. ]
  413. )
  414. static let echoModel: Target = .target(
  415. name: "EchoModel",
  416. dependencies: [
  417. .grpc,
  418. .nio,
  419. .protobuf,
  420. ],
  421. path: "Sources/Examples/Echo/Model"
  422. )
  423. static let echoImplementation: Target = .target(
  424. name: "EchoImplementation",
  425. dependencies: [
  426. .echoModel,
  427. .grpc,
  428. .nioCore,
  429. .nioHTTP2,
  430. .protobuf,
  431. ],
  432. path: "Sources/Examples/Echo/Implementation"
  433. )
  434. static let echo: Target = .executableTarget(
  435. name: "Echo",
  436. dependencies: [
  437. .grpc,
  438. .echoModel,
  439. .echoImplementation,
  440. .grpcSampleData,
  441. .nioCore,
  442. .nioPosix,
  443. .logging,
  444. .argumentParser,
  445. ].appending(
  446. .nioSSL, if: includeNIOSSL
  447. ),
  448. path: "Sources/Examples/Echo/Runtime"
  449. )
  450. static let helloWorldModel: Target = .target(
  451. name: "HelloWorldModel",
  452. dependencies: [
  453. .grpc,
  454. .nio,
  455. .protobuf,
  456. ],
  457. path: "Sources/Examples/HelloWorld/Model"
  458. )
  459. static let helloWorldClient: Target = .executableTarget(
  460. name: "HelloWorldClient",
  461. dependencies: [
  462. .grpc,
  463. .helloWorldModel,
  464. .nioCore,
  465. .nioPosix,
  466. .argumentParser,
  467. ],
  468. path: "Sources/Examples/HelloWorld/Client"
  469. )
  470. static let helloWorldServer: Target = .executableTarget(
  471. name: "HelloWorldServer",
  472. dependencies: [
  473. .grpc,
  474. .helloWorldModel,
  475. .nioCore,
  476. .nioPosix,
  477. .argumentParser,
  478. ],
  479. path: "Sources/Examples/HelloWorld/Server"
  480. )
  481. static let routeGuideModel: Target = .target(
  482. name: "RouteGuideModel",
  483. dependencies: [
  484. .grpc,
  485. .nio,
  486. .protobuf,
  487. ],
  488. path: "Sources/Examples/RouteGuide/Model"
  489. )
  490. static let routeGuideClient: Target = .executableTarget(
  491. name: "RouteGuideClient",
  492. dependencies: [
  493. .grpc,
  494. .routeGuideModel,
  495. .nioCore,
  496. .nioPosix,
  497. .argumentParser,
  498. ],
  499. path: "Sources/Examples/RouteGuide/Client"
  500. )
  501. static let routeGuideServer: Target = .executableTarget(
  502. name: "RouteGuideServer",
  503. dependencies: [
  504. .grpc,
  505. .routeGuideModel,
  506. .nioCore,
  507. .nioConcurrencyHelpers,
  508. .nioPosix,
  509. .argumentParser,
  510. ],
  511. path: "Sources/Examples/RouteGuide/Server"
  512. )
  513. static let packetCapture: Target = .executableTarget(
  514. name: "PacketCapture",
  515. dependencies: [
  516. .grpc,
  517. .echoModel,
  518. .nioCore,
  519. .nioPosix,
  520. .nioExtras,
  521. .argumentParser,
  522. ],
  523. path: "Sources/Examples/PacketCapture",
  524. exclude: [
  525. "README.md",
  526. ]
  527. )
  528. static let reflectionService: Target = .target(
  529. name: "GRPCReflectionService",
  530. dependencies: [
  531. .grpc,
  532. .nio,
  533. .protobuf,
  534. ],
  535. path: "Sources/GRPCReflectionService"
  536. )
  537. static let reflectionServer: Target = .executableTarget(
  538. name: "ReflectionServer",
  539. dependencies: [
  540. .grpc,
  541. .reflectionService,
  542. .helloWorldModel,
  543. .nioCore,
  544. .nioPosix,
  545. .argumentParser,
  546. .echoModel,
  547. .echoImplementation
  548. ],
  549. path: "Sources/Examples/ReflectionService",
  550. resources: [
  551. .copy("Generated")
  552. ]
  553. )
  554. static let grpcCodeGen: Target = .target(
  555. name: "GRPCCodeGen",
  556. path: "Sources/GRPCCodeGen"
  557. )
  558. static let grpcProtobuf: Target = .target(
  559. name: "GRPCProtobuf",
  560. dependencies: [
  561. .grpcCore,
  562. .protobuf,
  563. ],
  564. path: "Sources/GRPCProtobuf"
  565. )
  566. static let grpcProtobufCodeGen: Target = .target(
  567. name: "GRPCProtobufCodeGen",
  568. dependencies: [
  569. .protobuf,
  570. .protobufPluginLibrary,
  571. .grpcCodeGen
  572. ],
  573. path: "Sources/GRPCProtobufCodeGen"
  574. )
  575. }
  576. // MARK: - Products
  577. extension Product {
  578. static let grpc: Product = .library(
  579. name: grpcProductName,
  580. targets: [grpcTargetName]
  581. )
  582. static let grpcCore: Product = .library(
  583. name: "_GRPCCore",
  584. targets: ["GRPCCore"]
  585. )
  586. static let cgrpcZlib: Product = .library(
  587. name: cgrpcZlibProductName,
  588. targets: [cgrpcZlibTargetName]
  589. )
  590. static let grpcReflectionService: Product = .library(
  591. name: "GRPCReflectionService",
  592. targets: ["GRPCReflectionService"]
  593. )
  594. static let protocGenGRPCSwift: Product = .executable(
  595. name: "protoc-gen-grpc-swift",
  596. targets: ["protoc-gen-grpc-swift"]
  597. )
  598. static let grpcSwiftPlugin: Product = .plugin(
  599. name: "GRPCSwiftPlugin",
  600. targets: ["GRPCSwiftPlugin"]
  601. )
  602. }
  603. // MARK: - Package
  604. let package = Package(
  605. name: grpcPackageName,
  606. products: [
  607. .grpc,
  608. .grpcCore,
  609. .cgrpcZlib,
  610. .grpcReflectionService,
  611. .protocGenGRPCSwift,
  612. .grpcSwiftPlugin,
  613. ],
  614. dependencies: packageDependencies,
  615. targets: [
  616. // Products
  617. .grpc,
  618. .cgrpcZlib,
  619. .protocGenGRPCSwift,
  620. .grpcSwiftPlugin,
  621. .reflectionService,
  622. // Tests etc.
  623. .grpcTests,
  624. .interopTestModels,
  625. .interopTestImplementation,
  626. .interopTests,
  627. .backoffInteropTest,
  628. .perfTests,
  629. .grpcSampleData,
  630. // Examples
  631. .echoModel,
  632. .echoImplementation,
  633. .echo,
  634. .helloWorldModel,
  635. .helloWorldClient,
  636. .helloWorldServer,
  637. .routeGuideModel,
  638. .routeGuideClient,
  639. .routeGuideServer,
  640. .packetCapture,
  641. .reflectionServer,
  642. // v2
  643. .grpcCore,
  644. .grpcInProcessTransport,
  645. .grpcCodeGen,
  646. .grpcInterceptors,
  647. .grpcHTTP2Core,
  648. .grpcHTTP2TransportNIOPosix,
  649. .grpcHTTP2TransportNIOTransportServices,
  650. .grpcProtobuf,
  651. .grpcProtobufCodeGen,
  652. .interoperabilityTestImplementation,
  653. // v2 tests
  654. .grpcCoreTests,
  655. .grpcInProcessTransportTests,
  656. .grpcCodeGenTests,
  657. .grpcInterceptorsTests,
  658. .grpcHTTP2CoreTests,
  659. .grpcHTTP2TransportNIOPosixTests,
  660. .grpcHTTP2TransportNIOTransportServicesTests,
  661. .grpcProtobufTests,
  662. .grpcProtobufCodeGenTests,
  663. ]
  664. )
  665. extension Array {
  666. func appending(_ element: Element, if condition: Bool) -> [Element] {
  667. if condition {
  668. return self + [element]
  669. } else {
  670. return self
  671. }
  672. }
  673. }