|
| 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 | + |
| 18 | +import PackageDescription |
| 19 | + |
| 20 | +let products: [Product] = [ |
| 21 | + .library( |
| 22 | + name: "GRPCHealthService", |
| 23 | + targets: ["GRPCHealthService"] |
| 24 | + ), |
| 25 | + .library( |
| 26 | + name: "GRPCInterceptors", |
| 27 | + targets: ["GRPCInterceptors"] |
| 28 | + ), |
| 29 | + .library( |
| 30 | + name: "GRPCInteropTests", |
| 31 | + targets: ["GRPCInteropTests"] |
| 32 | + ), |
| 33 | +] |
| 34 | + |
| 35 | +let dependencies: [Package.Dependency] = [ |
| 36 | + .package( |
| 37 | + url: "https://github.com/grpc/grpc-swift.git", |
| 38 | + branch: "main" |
| 39 | + ), |
| 40 | + .package( |
| 41 | + url: "https://github.com/grpc/grpc-swift-protobuf.git", |
| 42 | + branch: "main" |
| 43 | + ), |
| 44 | + .package( |
| 45 | + url: "https://github.com/apple/swift-protobuf.git", |
| 46 | + from: "1.28.1" |
| 47 | + ), |
| 48 | + .package( |
| 49 | + url: "https://github.com/apple/swift-distributed-tracing.git", |
| 50 | + from: "1.0.0" |
| 51 | + ), |
| 52 | +] |
| 53 | + |
| 54 | +let defaultSwiftSettings: [SwiftSetting] = [ |
| 55 | + .swiftLanguageMode(.v6), |
| 56 | + .enableUpcomingFeature("ExistentialAny"), |
| 57 | + .enableUpcomingFeature("InternalImportsByDefault") |
| 58 | +] |
| 59 | + |
| 60 | +let targets: [Target] = [ |
| 61 | + // An implementation of the gRPC Health service. |
| 62 | + .target( |
| 63 | + name: "GRPCHealthService", |
| 64 | + dependencies: [ |
| 65 | + .product(name: "GRPCCore", package: "grpc-swift"), |
| 66 | + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), |
| 67 | + .product(name: "SwiftProtobuf", package: "swift-protobuf"), |
| 68 | + ], |
| 69 | + swiftSettings: defaultSwiftSettings |
| 70 | + ), |
| 71 | + .testTarget( |
| 72 | + name: "GRPCHealthServiceTests", |
| 73 | + dependencies: [ |
| 74 | + .target(name: "GRPCHealthService"), |
| 75 | + .product(name: "GRPCInProcessTransport", package: "grpc-swift"), |
| 76 | + ] |
| 77 | + ), |
| 78 | + |
| 79 | + // Common interceptors for gRPC. |
| 80 | + .target( |
| 81 | + name: "GRPCInterceptors", |
| 82 | + dependencies: [ |
| 83 | + .product(name: "GRPCCore", package: "grpc-swift"), |
| 84 | + .product(name: "Tracing", package: "swift-distributed-tracing"), |
| 85 | + ], |
| 86 | + swiftSettings: defaultSwiftSettings |
| 87 | + ), |
| 88 | + .testTarget( |
| 89 | + name: "GRPCInterceptorsTests", |
| 90 | + dependencies: [ |
| 91 | + .target(name: "GRPCInterceptors"), |
| 92 | + .product(name: "GRPCCore", package: "grpc-swift"), |
| 93 | + .product(name: "Tracing", package: "swift-distributed-tracing") |
| 94 | + ] |
| 95 | + ), |
| 96 | + |
| 97 | + // gRPC interop test implementation. |
| 98 | + .target( |
| 99 | + name: "GRPCInteropTests", |
| 100 | + dependencies: [ |
| 101 | + .product(name: "GRPCCore", package: "grpc-swift"), |
| 102 | + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), |
| 103 | + ], |
| 104 | + swiftSettings: defaultSwiftSettings |
| 105 | + ), |
| 106 | + // gRPC interop tests run with the in-process transport. |
| 107 | + .testTarget( |
| 108 | + name: "InProcessInteropTests", |
| 109 | + dependencies: [ |
| 110 | + .target(name: "GRPCInteropTests"), |
| 111 | + .product(name: "GRPCCore", package: "grpc-swift"), |
| 112 | + .product(name: "GRPCInProcessTransport", package: "grpc-swift"), |
| 113 | + ] |
| 114 | + ) |
| 115 | +] |
| 116 | + |
| 117 | +let package = Package( |
| 118 | + name: "grpc-swift-extras", |
| 119 | + products: products, |
| 120 | + dependencies: dependencies, |
| 121 | + targets: targets |
| 122 | +) |
0 commit comments