Package.swift 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. .enableUpcomingFeature("MemberImportVisibility"),
  48. ]
  49. let targets: [Target] = [
  50. // Runtime serialization components
  51. .target(
  52. name: "GRPCCore",
  53. dependencies: [
  54. .product(name: "DequeModule", package: "swift-collections")
  55. ],
  56. swiftSettings: defaultSwiftSettings
  57. ),
  58. .testTarget(
  59. name: "GRPCCoreTests",
  60. dependencies: [
  61. .target(name: "GRPCCore"),
  62. .target(name: "GRPCInProcessTransport"),
  63. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  64. ],
  65. resources: [
  66. .copy("Configuration/Inputs")
  67. ],
  68. swiftSettings: defaultSwiftSettings
  69. ),
  70. // In-process client and server transport implementations
  71. .target(
  72. name: "GRPCInProcessTransport",
  73. dependencies: [
  74. .target(name: "GRPCCore")
  75. ],
  76. swiftSettings: defaultSwiftSettings
  77. ),
  78. .testTarget(
  79. name: "GRPCInProcessTransportTests",
  80. dependencies: [
  81. .target(name: "GRPCInProcessTransport")
  82. ],
  83. swiftSettings: defaultSwiftSettings
  84. ),
  85. // Code generator library for protoc-gen-grpc-swift
  86. .target(
  87. name: "GRPCCodeGen",
  88. dependencies: [],
  89. swiftSettings: defaultSwiftSettings
  90. ),
  91. .testTarget(
  92. name: "GRPCCodeGenTests",
  93. dependencies: [
  94. .target(name: "GRPCCodeGen")
  95. ],
  96. swiftSettings: defaultSwiftSettings
  97. ),
  98. ]
  99. let package = Package(
  100. name: "grpc-swift",
  101. platforms: [
  102. .macOS(.v15),
  103. .iOS(.v18),
  104. .tvOS(.v18),
  105. .watchOS(.v11),
  106. .visionOS(.v2),
  107. ],
  108. products: products,
  109. dependencies: dependencies,
  110. targets: targets
  111. )