Package.swift 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. swiftSettings: defaultSwiftSettings
  68. ),
  69. // In-process client and server transport implementations
  70. .target(
  71. name: "GRPCInProcessTransport",
  72. dependencies: [
  73. .target(name: "GRPCCore")
  74. ],
  75. swiftSettings: defaultSwiftSettings
  76. ),
  77. .testTarget(
  78. name: "GRPCInProcessTransportTests",
  79. dependencies: [
  80. .target(name: "GRPCInProcessTransport")
  81. ],
  82. swiftSettings: defaultSwiftSettings
  83. ),
  84. // Code generator library for protoc-gen-grpc-swift
  85. .target(
  86. name: "GRPCCodeGen",
  87. dependencies: [],
  88. swiftSettings: defaultSwiftSettings
  89. ),
  90. .testTarget(
  91. name: "GRPCCodeGenTests",
  92. dependencies: [
  93. .target(name: "GRPCCodeGen")
  94. ],
  95. swiftSettings: defaultSwiftSettings
  96. ),
  97. ]
  98. let package = Package(
  99. name: "grpc-swift",
  100. platforms: [
  101. .macOS(.v15),
  102. .iOS(.v18),
  103. .tvOS(.v18),
  104. .watchOS(.v11),
  105. .visionOS(.v2),
  106. ],
  107. products: products,
  108. dependencies: dependencies,
  109. targets: targets
  110. )