Package.swift 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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-alpha.1"
  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. ),
  54. // Runtime serialization components
  55. .target(
  56. name: "GRPCProtobuf",
  57. dependencies: [
  58. .product(name: "GRPCCore", package: "grpc-swift"),
  59. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  60. ],
  61. swiftSettings: defaultSwiftSettings
  62. ),
  63. .testTarget(
  64. name: "GRPCProtobufTests",
  65. dependencies: [
  66. .target(name: "GRPCProtobuf"),
  67. .product(name: "GRPCCore", package: "grpc-swift"),
  68. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  69. ]
  70. ),
  71. // Code generator library for protoc-gen-grpc-swift
  72. .target(
  73. name: "GRPCProtobufCodeGen",
  74. dependencies: [
  75. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  76. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  77. ],
  78. swiftSettings: defaultSwiftSettings
  79. ),
  80. .testTarget(
  81. name: "GRPCProtobufCodeGenTests",
  82. dependencies: [
  83. .target(name: "GRPCProtobufCodeGen"),
  84. .product(name: "GRPCCodeGen", package: "grpc-swift"),
  85. .product(name: "SwiftProtobuf", package: "swift-protobuf"),
  86. .product(name: "SwiftProtobufPluginLibrary", package: "swift-protobuf"),
  87. ]
  88. )
  89. ]
  90. let package = Package(
  91. name: "grpc-swift-protobuf",
  92. platforms: [
  93. .macOS(.v15),
  94. .iOS(.v18),
  95. .tvOS(.v18),
  96. .watchOS(.v11),
  97. .visionOS(.v2),
  98. ],
  99. products: products,
  100. dependencies: dependencies,
  101. targets: targets
  102. )