Package.swift 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. branch: "main"
  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. ]
  43. let targets: [Target] = [
  44. // protoc plugin for grpc-swift
  45. .executableTarget(
  46. name: "protoc-gen-grpc-swift",
  47. dependencies: [
  48. .target(name: "GRPCProtobufCodeGen"),
  49. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  50. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  51. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  52. ],
  53. swiftSettings: defaultSwiftSettings
  54. ),
  55. // Runtime serialization components
  56. .target(
  57. name: "GRPCProtobuf",
  58. dependencies: [
  59. .product(name: "GRPCCore", package: "grpc-swift"),
  60. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  61. ],
  62. swiftSettings: defaultSwiftSettings
  63. ),
  64. .testTarget(
  65. name: "GRPCProtobufTests",
  66. dependencies: [
  67. .target(name: "GRPCProtobuf"),
  68. .product(name: "GRPCCore", package: "grpc-swift"),
  69. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  70. ],
  71. swiftSettings: defaultSwiftSettings
  72. ),
  73. // Code generator library for protoc-gen-grpc-swift
  74. .target(
  75. name: "GRPCProtobufCodeGen",
  76. dependencies: [
  77. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  78. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  79. ],
  80. swiftSettings: defaultSwiftSettings
  81. ),
  82. .testTarget(
  83. name: "GRPCProtobufCodeGenTests",
  84. dependencies: [
  85. .target(name: "GRPCProtobufCodeGen"),
  86. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  87. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  88. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  89. ],
  90. resources: [
  91. .copy("Generated")
  92. ],
  93. swiftSettings: defaultSwiftSettings
  94. ),
  95. ]
  96. let package = Package(
  97. name: "grpc-swift-protobuf",
  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. )