Package.swift 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. // swift-tools-version:5.0
  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. import Foundation
  19. let package = Package(
  20. name: "grpc-swift",
  21. products: [
  22. .library(name: "GRPC", targets: ["GRPC"]),
  23. .executable(name: "protoc-gen-grpc-swift", targets: ["protoc-gen-grpc-swift"]),
  24. ],
  25. dependencies: [
  26. // GRPC dependencies:
  27. // Main SwiftNIO package
  28. .package(url: "https://github.com/apple/swift-nio.git", from: "2.14.0"),
  29. // HTTP2 via SwiftNIO
  30. .package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.8.0"),
  31. // TLS via SwiftNIO
  32. .package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.6.2"),
  33. // Support for Network.framework where possible.
  34. .package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.3.0"),
  35. // Official SwiftProtobuf library, for [de]serializing data to send on the wire.
  36. .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.8.0"),
  37. // Logging API.
  38. .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
  39. ],
  40. targets: [
  41. // The main GRPC module.
  42. .target(
  43. name: "GRPC",
  44. dependencies: [
  45. "NIO",
  46. "NIOFoundationCompat",
  47. "NIOTransportServices",
  48. "NIOHTTP1",
  49. "NIOHTTP2",
  50. "NIOSSL",
  51. "CGRPCZlib",
  52. "SwiftProtobuf",
  53. "Logging"
  54. ]
  55. ), // and its tests.
  56. .testTarget(
  57. name: "GRPCTests",
  58. dependencies: [
  59. "GRPC",
  60. "EchoModel",
  61. "EchoImplementation",
  62. "GRPCSampleData",
  63. "GRPCInteroperabilityTestsImplementation"
  64. ]
  65. ),
  66. .target(
  67. name: "CGRPCZlib",
  68. linkerSettings: [
  69. .linkedLibrary("z")
  70. ]
  71. ),
  72. // The `protoc` plugin.
  73. .target(
  74. name: "protoc-gen-grpc-swift",
  75. dependencies: [
  76. "SwiftProtobuf",
  77. "SwiftProtobufPluginLibrary",
  78. "protoc-gen-swift"
  79. ]
  80. ),
  81. // Interoperability tests implementation.
  82. .target(
  83. name: "GRPCInteroperabilityTestsImplementation",
  84. dependencies: [
  85. "GRPC",
  86. "GRPCInteroperabilityTestModels"
  87. ]
  88. ),
  89. // Generated interoperability test models.
  90. .target(
  91. name: "GRPCInteroperabilityTestModels",
  92. dependencies: [
  93. "GRPC",
  94. "NIO",
  95. "NIOHTTP1",
  96. "SwiftProtobuf"
  97. ]
  98. ),
  99. // The CLI for the interoperability tests.
  100. .target(
  101. name: "GRPCInteroperabilityTests",
  102. dependencies: [
  103. "GRPCInteroperabilityTestsImplementation",
  104. "Logging",
  105. ]
  106. ),
  107. // The connection backoff interoperability test.
  108. .target(
  109. name: "GRPCConnectionBackoffInteropTest",
  110. dependencies: [
  111. "GRPC",
  112. "GRPCInteroperabilityTestModels",
  113. "Logging",
  114. ]
  115. ),
  116. // Performance tests implementation and CLI.
  117. .target(
  118. name: "GRPCPerformanceTests",
  119. dependencies: [
  120. "GRPC",
  121. "EchoModel",
  122. "EchoImplementation",
  123. "NIO",
  124. "NIOSSL",
  125. ]
  126. ),
  127. // Sample data, used in examples and tests.
  128. .target(
  129. name: "GRPCSampleData",
  130. dependencies: ["NIOSSL"]
  131. ),
  132. // Echo example CLI.
  133. .target(
  134. name: "Echo",
  135. dependencies: [
  136. "EchoModel",
  137. "EchoImplementation",
  138. "GRPC",
  139. "GRPCSampleData",
  140. "SwiftProtobuf",
  141. ],
  142. path: "Sources/Examples/Echo/Runtime"
  143. ),
  144. // Echo example service implementation.
  145. .target(
  146. name: "EchoImplementation",
  147. dependencies: [
  148. "EchoModel",
  149. "GRPC",
  150. "SwiftProtobuf"
  151. ],
  152. path: "Sources/Examples/Echo/Implementation"
  153. ),
  154. // Model for Echo example.
  155. .target(
  156. name: "EchoModel",
  157. dependencies: [
  158. "GRPC",
  159. "NIO",
  160. "NIOHTTP1",
  161. "SwiftProtobuf"
  162. ],
  163. path: "Sources/Examples/Echo/Model"
  164. ),
  165. // Model for the HelloWorld example
  166. .target(
  167. name: "HelloWorldModel",
  168. dependencies: [
  169. "GRPC",
  170. "NIO",
  171. "NIOHTTP1",
  172. "SwiftProtobuf"
  173. ],
  174. path: "Sources/Examples/HelloWorld/Model"
  175. ),
  176. // Client for the HelloWorld example
  177. .target(
  178. name: "HelloWorldClient",
  179. dependencies: [
  180. "GRPC",
  181. "HelloWorldModel",
  182. ],
  183. path: "Sources/Examples/HelloWorld/Client"
  184. ),
  185. // Server for the HelloWorld example
  186. .target(
  187. name: "HelloWorldServer",
  188. dependencies: [
  189. "GRPC",
  190. "NIO",
  191. "HelloWorldModel",
  192. ],
  193. path: "Sources/Examples/HelloWorld/Server"
  194. ),
  195. // Model for the RouteGuide example
  196. .target(
  197. name: "RouteGuideModel",
  198. dependencies: [
  199. "GRPC",
  200. "NIO",
  201. "NIOHTTP1",
  202. "SwiftProtobuf"
  203. ],
  204. path: "Sources/Examples/RouteGuide/Model"
  205. ),
  206. // Client for the RouteGuide example
  207. .target(
  208. name: "RouteGuideClient",
  209. dependencies: [
  210. "GRPC",
  211. "RouteGuideModel",
  212. ],
  213. path: "Sources/Examples/RouteGuide/Client"
  214. ),
  215. // Server for the RouteGuide example
  216. .target(
  217. name: "RouteGuideServer",
  218. dependencies: [
  219. "GRPC",
  220. "NIO",
  221. "RouteGuideModel",
  222. ],
  223. path: "Sources/Examples/RouteGuide/Server"
  224. ),
  225. ]
  226. )