Package.swift 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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: "InteroperabilityTestRunner", targets: ["GRPCInteroperabilityTests"]),
  24. .executable(name: "ConnectionBackoffInteropTestRunner", targets: ["GRPCConnectionBackoffInteropTest"]),
  25. .executable(name: "PerformanceTestRunner", targets: ["GRPCPerformanceTests"]),
  26. .executable(name: "Echo", targets: ["Echo"]),
  27. ],
  28. dependencies: [
  29. // GRPC dependencies:
  30. // Main SwiftNIO package
  31. .package(url: "https://github.com/apple/swift-nio.git", from: "2.2.0"),
  32. // HTTP2 via SwiftNIO
  33. .package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.5.0"),
  34. // TLS via SwiftNIO
  35. .package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.4.0"),
  36. // Support for Network.framework where possible.
  37. .package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.1.0"),
  38. // Official SwiftProtobuf library, for [de]serializing data to send on the wire.
  39. .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.5.0"),
  40. // Logging API.
  41. .package(url: "https://github.com/apple/swift-log", from: "1.0.0"),
  42. // Command line argument parser for our auxiliary command line tools.
  43. .package(url: "https://github.com/kylef/Commander.git", from: "0.8.0"),
  44. ],
  45. targets: [
  46. // The main GRPC module.
  47. .target(
  48. name: "GRPC",
  49. dependencies: [
  50. "NIO",
  51. "NIOFoundationCompat",
  52. "NIOTransportServices",
  53. "NIOHTTP1",
  54. "NIOHTTP2",
  55. "NIOSSL",
  56. "SwiftProtobuf",
  57. "Logging"
  58. ]
  59. ), // and its tests.
  60. .testTarget(
  61. name: "GRPCTests",
  62. dependencies: [
  63. "GRPC",
  64. "EchoModel",
  65. "EchoImplementation",
  66. "GRPCSampleData",
  67. "GRPCInteroperabilityTestsImplementation"
  68. ]
  69. ),
  70. // The `protoc` plugin.
  71. .target(
  72. name: "protoc-gen-swiftgrpc",
  73. dependencies: [
  74. "SwiftProtobuf",
  75. "SwiftProtobufPluginLibrary",
  76. "protoc-gen-swift"
  77. ]
  78. ),
  79. // Interoperability tests implementation.
  80. .target(
  81. name: "GRPCInteroperabilityTestsImplementation",
  82. dependencies: [
  83. "GRPC",
  84. "GRPCInteroperabilityTestModels"
  85. ]
  86. ),
  87. // Generated interoperability test models.
  88. .target(
  89. name: "GRPCInteroperabilityTestModels",
  90. dependencies: [
  91. "GRPC",
  92. "NIO",
  93. "NIOHTTP1",
  94. "SwiftProtobuf"
  95. ]
  96. ),
  97. // The CLI for the interoperability tests.
  98. .target(
  99. name: "GRPCInteroperabilityTests",
  100. dependencies: [
  101. "GRPCInteroperabilityTestsImplementation",
  102. "Commander",
  103. "Logging",
  104. ]
  105. ),
  106. // The connection backoff interoperability test.
  107. .target(
  108. name: "GRPCConnectionBackoffInteropTest",
  109. dependencies: [
  110. "GRPC",
  111. "GRPCInteroperabilityTestModels",
  112. "Logging",
  113. ]
  114. ),
  115. // Performance tests implementation and CLI.
  116. .target(
  117. name: "GRPCPerformanceTests",
  118. dependencies: [
  119. "GRPC",
  120. "EchoModel",
  121. "EchoImplementation",
  122. "NIO",
  123. "NIOSSL",
  124. "Commander",
  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. "Commander"
  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. ]
  167. )