Package.swift 3.3 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: "GRPCProtobuf",
  21. targets: ["GRPCProtobuf"]
  22. ),
  23. .executable(
  24. name: "protoc-gen-grpc-swift",
  25. targets: ["protoc-gen-grpc-swift"]
  26. ),
  27. ]
  28. let dependencies: [Package.Dependency] = [
  29. .package(
  30. url: "https://github.com/grpc/grpc-swift.git",
  31. exact: "2.0.0-beta.3"
  32. ),
  33. .package(
  34. url: "https://github.com/apple/swift-protobuf.git",
  35. from: "1.28.1"
  36. ),
  37. ]
  38. let defaultSwiftSettings: [SwiftSetting] = [
  39. .swiftLanguageMode(.v6),
  40. .enableUpcomingFeature("ExistentialAny"),
  41. .enableUpcomingFeature("InternalImportsByDefault"),
  42. .enableUpcomingFeature("MemberImportVisibility"),
  43. ]
  44. let targets: [Target] = [
  45. // protoc plugin for grpc-swift
  46. .executableTarget(
  47. name: "protoc-gen-grpc-swift",
  48. dependencies: [
  49. .target(name: "GRPCProtobufCodeGen"),
  50. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  51. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  52. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  53. ],
  54. swiftSettings: defaultSwiftSettings
  55. ),
  56. // Runtime serialization components
  57. .target(
  58. name: "GRPCProtobuf",
  59. dependencies: [
  60. .product(name: "GRPCCore", package: "grpc-swift"),
  61. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  62. ],
  63. swiftSettings: defaultSwiftSettings
  64. ),
  65. .testTarget(
  66. name: "GRPCProtobufTests",
  67. dependencies: [
  68. .target(name: "GRPCProtobuf"),
  69. .product(name: "GRPCCore", package: "grpc-swift"),
  70. .product(name: "GRPCInProcessTransport", package: "grpc-swift"),
  71. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  72. ],
  73. swiftSettings: defaultSwiftSettings
  74. ),
  75. // Code generator library for protoc-gen-grpc-swift
  76. .target(
  77. name: "GRPCProtobufCodeGen",
  78. dependencies: [
  79. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  80. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  81. ],
  82. swiftSettings: defaultSwiftSettings
  83. ),
  84. .testTarget(
  85. name: "GRPCProtobufCodeGenTests",
  86. dependencies: [
  87. .target(name: "GRPCProtobufCodeGen"),
  88. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  89. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  90. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  91. ],
  92. resources: [
  93. .copy("Generated")
  94. ],
  95. swiftSettings: defaultSwiftSettings
  96. ),
  97. ]
  98. let package = Package(
  99. name: "grpc-swift-protobuf",
  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. )