Package.swift 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  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. ]
  205. )
  206. static let grpcHTTP2TransportNIOTransportServices: Target = .target(
  207. name: "GRPCHTTP2TransportNIOTransportServices",
  208. dependencies: [
  209. .grpcHTTP2Core
  210. ]
  211. )
  212. static let cgrpcZlib: Target = .target(
  213. name: cgrpcZlibTargetName,
  214. path: "Sources/CGRPCZlib",
  215. linkerSettings: [
  216. .linkedLibrary("z"),
  217. ]
  218. )
  219. static let protocGenGRPCSwift: Target = .executableTarget(
  220. name: "protoc-gen-grpc-swift",
  221. dependencies: [
  222. .protobuf,
  223. .protobufPluginLibrary,
  224. .grpcCodeGen,
  225. .grpcProtobufCodeGen
  226. ],
  227. exclude: [
  228. "README.md",
  229. ]
  230. )
  231. static let performanceWorker: Target = .executableTarget(
  232. name: "performance-worker",
  233. dependencies: [
  234. .grpcCore,
  235. .grpcProtobuf,
  236. .nioCore,
  237. .nioFileSystem
  238. ]
  239. )
  240. static let grpcSwiftPlugin: Target = .plugin(
  241. name: "GRPCSwiftPlugin",
  242. capability: .buildTool(),
  243. dependencies: [
  244. .protocGenGRPCSwift,
  245. ]
  246. )
  247. static let grpcTests: Target = .testTarget(
  248. name: "GRPCTests",
  249. dependencies: [
  250. .grpc,
  251. .echoModel,
  252. .echoImplementation,
  253. .helloWorldModel,
  254. .interopTestModels,
  255. .interopTestImplementation,
  256. .grpcSampleData,
  257. .nioCore,
  258. .nioConcurrencyHelpers,
  259. .nioPosix,
  260. .nioTLS,
  261. .nioHTTP1,
  262. .nioHTTP2,
  263. .nioEmbedded,
  264. .nioTransportServices,
  265. .logging,
  266. .reflectionService
  267. ].appending(
  268. .nioSSL, if: includeNIOSSL
  269. ),
  270. exclude: [
  271. "Codegen/Serialization/echo.grpc.reflection"
  272. ]
  273. )
  274. static let grpcCoreTests: Target = .testTarget(
  275. name: "GRPCCoreTests",
  276. dependencies: [
  277. .grpcCore,
  278. .grpcInProcessTransport,
  279. .dequeModule,
  280. .atomics,
  281. .protobuf,
  282. ]
  283. )
  284. static let grpcInProcessTransportTests: Target = .testTarget(
  285. name: "GRPCInProcessTransportTests",
  286. dependencies: [
  287. .grpcCore,
  288. .grpcInProcessTransport
  289. ]
  290. )
  291. static let grpcInterceptorsTests: Target = .testTarget(
  292. name: "GRPCInterceptorsTests",
  293. dependencies: [
  294. .grpcCore,
  295. .tracing,
  296. .nioCore,
  297. .grpcInterceptors
  298. ]
  299. )
  300. static let grpcHTTP2CoreTests: Target = .testTarget(
  301. name: "GRPCHTTP2CoreTests",
  302. dependencies: [
  303. .grpcHTTP2Core,
  304. .nioCore,
  305. .nioHTTP2,
  306. .nioEmbedded,
  307. .nioTestUtils,
  308. ]
  309. )
  310. static let grpcHTTP2TransportNIOPosixTests: Target = .testTarget(
  311. name: "GRPCHTTP2TransportNIOPosixTests",
  312. dependencies: [
  313. .grpcHTTP2TransportNIOPosix
  314. ]
  315. )
  316. static let grpcHTTP2TransportNIOTransportServicesTests: Target = .testTarget(
  317. name: "GRPCHTTP2TransportNIOTransportServicesTests",
  318. dependencies: [
  319. .grpcHTTP2TransportNIOTransportServices
  320. ]
  321. )
  322. static let grpcCodeGenTests: Target = .testTarget(
  323. name: "GRPCCodeGenTests",
  324. dependencies: [
  325. .grpcCodeGen
  326. ]
  327. )
  328. static let grpcProtobufTests: Target = .testTarget(
  329. name: "GRPCProtobufTests",
  330. dependencies: [
  331. .grpcProtobuf,
  332. .grpcCore,
  333. .protobuf
  334. ]
  335. )
  336. static let grpcProtobufCodeGenTests: Target = .testTarget(
  337. name: "GRPCProtobufCodeGenTests",
  338. dependencies: [
  339. .grpcCodeGen,
  340. .grpcProtobufCodeGen,
  341. .protobuf,
  342. .protobufPluginLibrary
  343. ]
  344. )
  345. static let inProcessInteroperabilityTests: Target = .testTarget(
  346. name: "InProcessInteroperabilityTests",
  347. dependencies: [
  348. .grpcInProcessTransport,
  349. .interoperabilityTests,
  350. .grpcCore
  351. ]
  352. )
  353. static let interopTestModels: Target = .target(
  354. name: "GRPCInteroperabilityTestModels",
  355. dependencies: [
  356. .grpc,
  357. .nio,
  358. .protobuf,
  359. ],
  360. exclude: [
  361. "README.md",
  362. "generate.sh",
  363. "src/proto/grpc/testing/empty.proto",
  364. "src/proto/grpc/testing/empty_service.proto",
  365. "src/proto/grpc/testing/messages.proto",
  366. "src/proto/grpc/testing/test.proto",
  367. "unimplemented_call.patch",
  368. ]
  369. )
  370. static let interoperabilityTestImplementation: Target = .target(
  371. name: "InteroperabilityTests",
  372. dependencies: [
  373. .grpcCore,
  374. .grpcProtobuf
  375. ]
  376. )
  377. static let interopTestImplementation: Target = .target(
  378. name: "GRPCInteroperabilityTestsImplementation",
  379. dependencies: [
  380. .grpc,
  381. .interopTestModels,
  382. .nioCore,
  383. .nioPosix,
  384. .nioHTTP1,
  385. .logging,
  386. ].appending(
  387. .nioSSL, if: includeNIOSSL
  388. )
  389. )
  390. static let interopTests: Target = .executableTarget(
  391. name: "GRPCInteroperabilityTests",
  392. dependencies: [
  393. .grpc,
  394. .interopTestImplementation,
  395. .nioCore,
  396. .nioPosix,
  397. .logging,
  398. .argumentParser,
  399. ]
  400. )
  401. static let backoffInteropTest: Target = .executableTarget(
  402. name: "GRPCConnectionBackoffInteropTest",
  403. dependencies: [
  404. .grpc,
  405. .interopTestModels,
  406. .nioCore,
  407. .nioPosix,
  408. .logging,
  409. .argumentParser,
  410. ],
  411. exclude: [
  412. "README.md",
  413. ]
  414. )
  415. static let perfTests: Target = .executableTarget(
  416. name: "GRPCPerformanceTests",
  417. dependencies: [
  418. .grpc,
  419. .grpcSampleData,
  420. .nioCore,
  421. .nioEmbedded,
  422. .nioPosix,
  423. .nioHTTP2,
  424. .argumentParser,
  425. ]
  426. )
  427. static let grpcSampleData: Target = .target(
  428. name: "GRPCSampleData",
  429. dependencies: includeNIOSSL ? [.nioSSL] : [],
  430. exclude: [
  431. "bundle.p12",
  432. ]
  433. )
  434. static let echoModel: Target = .target(
  435. name: "EchoModel",
  436. dependencies: [
  437. .grpc,
  438. .nio,
  439. .protobuf,
  440. ],
  441. path: "Sources/Examples/Echo/Model"
  442. )
  443. static let echoImplementation: Target = .target(
  444. name: "EchoImplementation",
  445. dependencies: [
  446. .echoModel,
  447. .grpc,
  448. .nioCore,
  449. .nioHTTP2,
  450. .protobuf,
  451. ],
  452. path: "Sources/Examples/Echo/Implementation"
  453. )
  454. static let echo: Target = .executableTarget(
  455. name: "Echo",
  456. dependencies: [
  457. .grpc,
  458. .echoModel,
  459. .echoImplementation,
  460. .grpcSampleData,
  461. .nioCore,
  462. .nioPosix,
  463. .logging,
  464. .argumentParser,
  465. ].appending(
  466. .nioSSL, if: includeNIOSSL
  467. ),
  468. path: "Sources/Examples/Echo/Runtime"
  469. )
  470. static let helloWorldModel: Target = .target(
  471. name: "HelloWorldModel",
  472. dependencies: [
  473. .grpc,
  474. .nio,
  475. .protobuf,
  476. ],
  477. path: "Sources/Examples/HelloWorld/Model"
  478. )
  479. static let helloWorldClient: Target = .executableTarget(
  480. name: "HelloWorldClient",
  481. dependencies: [
  482. .grpc,
  483. .helloWorldModel,
  484. .nioCore,
  485. .nioPosix,
  486. .argumentParser,
  487. ],
  488. path: "Sources/Examples/HelloWorld/Client"
  489. )
  490. static let helloWorldServer: Target = .executableTarget(
  491. name: "HelloWorldServer",
  492. dependencies: [
  493. .grpc,
  494. .helloWorldModel,
  495. .nioCore,
  496. .nioPosix,
  497. .argumentParser,
  498. ],
  499. path: "Sources/Examples/HelloWorld/Server"
  500. )
  501. static let routeGuideModel: Target = .target(
  502. name: "RouteGuideModel",
  503. dependencies: [
  504. .grpc,
  505. .nio,
  506. .protobuf,
  507. ],
  508. path: "Sources/Examples/RouteGuide/Model"
  509. )
  510. static let routeGuideClient: Target = .executableTarget(
  511. name: "RouteGuideClient",
  512. dependencies: [
  513. .grpc,
  514. .routeGuideModel,
  515. .nioCore,
  516. .nioPosix,
  517. .argumentParser,
  518. ],
  519. path: "Sources/Examples/RouteGuide/Client"
  520. )
  521. static let routeGuideServer: Target = .executableTarget(
  522. name: "RouteGuideServer",
  523. dependencies: [
  524. .grpc,
  525. .routeGuideModel,
  526. .nioCore,
  527. .nioConcurrencyHelpers,
  528. .nioPosix,
  529. .argumentParser,
  530. ],
  531. path: "Sources/Examples/RouteGuide/Server"
  532. )
  533. static let packetCapture: Target = .executableTarget(
  534. name: "PacketCapture",
  535. dependencies: [
  536. .grpc,
  537. .echoModel,
  538. .nioCore,
  539. .nioPosix,
  540. .nioExtras,
  541. .argumentParser,
  542. ],
  543. path: "Sources/Examples/PacketCapture",
  544. exclude: [
  545. "README.md",
  546. ]
  547. )
  548. static let reflectionService: Target = .target(
  549. name: "GRPCReflectionService",
  550. dependencies: [
  551. .grpc,
  552. .nio,
  553. .protobuf,
  554. ],
  555. path: "Sources/GRPCReflectionService"
  556. )
  557. static let reflectionServer: Target = .executableTarget(
  558. name: "ReflectionServer",
  559. dependencies: [
  560. .grpc,
  561. .reflectionService,
  562. .helloWorldModel,
  563. .nioCore,
  564. .nioPosix,
  565. .argumentParser,
  566. .echoModel,
  567. .echoImplementation
  568. ],
  569. path: "Sources/Examples/ReflectionService",
  570. resources: [
  571. .copy("Generated")
  572. ]
  573. )
  574. static let grpcCodeGen: Target = .target(
  575. name: "GRPCCodeGen",
  576. path: "Sources/GRPCCodeGen"
  577. )
  578. static let grpcProtobuf: Target = .target(
  579. name: "GRPCProtobuf",
  580. dependencies: [
  581. .grpcCore,
  582. .protobuf,
  583. ],
  584. path: "Sources/GRPCProtobuf"
  585. )
  586. static let grpcProtobufCodeGen: Target = .target(
  587. name: "GRPCProtobufCodeGen",
  588. dependencies: [
  589. .protobuf,
  590. .protobufPluginLibrary,
  591. .grpcCodeGen
  592. ],
  593. path: "Sources/GRPCProtobufCodeGen"
  594. )
  595. }
  596. // MARK: - Products
  597. extension Product {
  598. static let grpc: Product = .library(
  599. name: grpcProductName,
  600. targets: [grpcTargetName]
  601. )
  602. static let grpcCore: Product = .library(
  603. name: "_GRPCCore",
  604. targets: ["GRPCCore"]
  605. )
  606. static let cgrpcZlib: Product = .library(
  607. name: cgrpcZlibProductName,
  608. targets: [cgrpcZlibTargetName]
  609. )
  610. static let grpcReflectionService: Product = .library(
  611. name: "GRPCReflectionService",
  612. targets: ["GRPCReflectionService"]
  613. )
  614. static let protocGenGRPCSwift: Product = .executable(
  615. name: "protoc-gen-grpc-swift",
  616. targets: ["protoc-gen-grpc-swift"]
  617. )
  618. static let grpcSwiftPlugin: Product = .plugin(
  619. name: "GRPCSwiftPlugin",
  620. targets: ["GRPCSwiftPlugin"]
  621. )
  622. }
  623. // MARK: - Package
  624. let package = Package(
  625. name: grpcPackageName,
  626. products: [
  627. .grpc,
  628. .grpcCore,
  629. .cgrpcZlib,
  630. .grpcReflectionService,
  631. .protocGenGRPCSwift,
  632. .grpcSwiftPlugin,
  633. ],
  634. dependencies: packageDependencies,
  635. targets: [
  636. // Products
  637. .grpc,
  638. .cgrpcZlib,
  639. .protocGenGRPCSwift,
  640. .grpcSwiftPlugin,
  641. .reflectionService,
  642. // Tests etc.
  643. .grpcTests,
  644. .interopTestModels,
  645. .interopTestImplementation,
  646. .interopTests,
  647. .backoffInteropTest,
  648. .perfTests,
  649. .grpcSampleData,
  650. // Examples
  651. .echoModel,
  652. .echoImplementation,
  653. .echo,
  654. .helloWorldModel,
  655. .helloWorldClient,
  656. .helloWorldServer,
  657. .routeGuideModel,
  658. .routeGuideClient,
  659. .routeGuideServer,
  660. .packetCapture,
  661. .reflectionServer,
  662. // v2
  663. .grpcCore,
  664. .grpcInProcessTransport,
  665. .grpcCodeGen,
  666. .grpcInterceptors,
  667. .grpcHTTP2Core,
  668. .grpcHTTP2TransportNIOPosix,
  669. .grpcHTTP2TransportNIOTransportServices,
  670. .grpcProtobuf,
  671. .grpcProtobufCodeGen,
  672. .interoperabilityTestImplementation,
  673. .performanceWorker,
  674. // v2 tests
  675. .grpcCoreTests,
  676. .grpcInProcessTransportTests,
  677. .grpcCodeGenTests,
  678. .grpcInterceptorsTests,
  679. .grpcHTTP2CoreTests,
  680. .grpcHTTP2TransportNIOPosixTests,
  681. .grpcHTTP2TransportNIOTransportServicesTests,
  682. .grpcProtobufTests,
  683. .grpcProtobufCodeGenTests,
  684. .inProcessInteroperabilityTests
  685. ]
  686. )
  687. extension Array {
  688. func appending(_ element: Element, if condition: Bool) -> [Element] {
  689. if condition {
  690. return self + [element]
  691. } else {
  692. return self
  693. }
  694. }
  695. }