Package.swift 18 KB

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