2
0

Package.swift 6.0 KB

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