Package.swift 5.6 KB

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