2
0

Package.swift 5.8 KB

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