Package.swift 18 KB

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