Package.swift 5.8 KB

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