Package.swift 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // swift-tools-version:6.0
  2. /*
  3. * Copyright 2024, 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 products: [Product] = [
  19. .library(
  20. name: "GRPCCore",
  21. targets: ["GRPCCore"]
  22. ),
  23. .library(
  24. name: "GRPCCodeGen",
  25. targets: ["GRPCCodeGen"]
  26. ),
  27. .library(
  28. name: "GRPCInProcessTransport",
  29. targets: ["GRPCInProcessTransport"]
  30. ),
  31. ]
  32. let dependencies: [Package.Dependency] = [
  33. .package(
  34. url: "https://github.com/apple/swift-collections.git",
  35. from: "1.1.3"
  36. ),
  37. // Test-only dependencies:
  38. .package(
  39. url: "https://github.com/apple/swift-protobuf.git",
  40. from: "1.28.1"
  41. ),
  42. ]
  43. let defaultSwiftSettings: [SwiftSetting] = [
  44. .swiftLanguageMode(.v6),
  45. .enableUpcomingFeature("ExistentialAny"),
  46. .enableUpcomingFeature("InternalImportsByDefault")
  47. ]
  48. let targets: [Target] = [
  49. // Runtime serialization components
  50. .target(
  51. name: "GRPCCore",
  52. dependencies: [
  53. .product(name: "DequeModule", package: "swift-collections"),
  54. ],
  55. swiftSettings: defaultSwiftSettings
  56. ),
  57. .testTarget(
  58. name: "GRPCCoreTests",
  59. dependencies: [
  60. .target(name: "GRPCCore"),
  61. .target(name: "GRPCInProcessTransport"),
  62. .product(name: "SwiftProtobuf", package: "swift-protobuf")
  63. ],
  64. resources: [
  65. .copy("Configuration/Inputs")
  66. ]
  67. ),
  68. // In-process client and server transport implementations
  69. .target(
  70. name: "GRPCInProcessTransport",
  71. dependencies: [
  72. .target(name: "GRPCCore")
  73. ],
  74. swiftSettings: defaultSwiftSettings
  75. ),
  76. .testTarget(
  77. name: "GRPCInProcessTransportTests",
  78. dependencies: [
  79. .target(name: "GRPCInProcessTransport")
  80. ]
  81. ),
  82. // Code generator library for protoc-gen-grpc-swift
  83. .target(
  84. name: "GRPCCodeGen",
  85. dependencies: [
  86. ],
  87. swiftSettings: defaultSwiftSettings
  88. ),
  89. .testTarget(
  90. name: "GRPCCodeGenTests",
  91. dependencies: [
  92. .target(name: "GRPCCodeGen")
  93. ]
  94. )
  95. ]
  96. let package = Package(
  97. name: "grpc-swift",
  98. platforms: [
  99. .macOS(.v15),
  100. .iOS(.v18),
  101. .tvOS(.v18),
  102. .watchOS(.v11),
  103. .visionOS(.v2),
  104. ],
  105. products: products,
  106. dependencies: dependencies,
  107. targets: targets
  108. )