Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Examples/echo-metadata/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ let package = Package(
name: "echo-metadata",
platforms: [.macOS("15.0")],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
],
targets: [
.executableTarget(
name: "echo-metadata",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
Expand Down
8 changes: 4 additions & 4 deletions Examples/echo/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ let package = Package(
name: "echo",
platforms: [.macOS("15.0")],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
],
targets: [
.executableTarget(
name: "echo",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
Expand Down
8 changes: 4 additions & 4 deletions Examples/error-details/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ let package = Package(
name: "error-details",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
],
targets: [
.executableTarget(
name: "error-details",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCInProcessTransport", package: "grpc-swift-2"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
],
plugins: [
Expand Down
8 changes: 4 additions & 4 deletions Examples/hello-world/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ let package = Package(
name: "hello-world",
platforms: [.macOS("15.0")],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
],
targets: [
.executableTarget(
name: "hello-world",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
Expand Down
10 changes: 5 additions & 5 deletions Examples/reflection-server/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ let package = Package(
name: "reflection-server",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-extras.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-extras.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
],
targets: [
.executableTarget(
name: "reflection-server",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "GRPCReflectionService", package: "grpc-swift-extras"),
Expand Down
8 changes: 4 additions & 4 deletions Examples/route-guide/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ let package = Package(
name: "route-guide",
platforms: [.macOS("15.0")],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
],
targets: [
.executableTarget(
name: "route-guide",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
Expand Down
10 changes: 5 additions & 5 deletions Examples/service-lifecycle/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ let package = Package(
name: "service-lifecycle",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-extras", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-extras.git", from: "2.0.0"),
],
targets: [
.executableTarget(
name: "service-lifecycle",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCInProcessTransport", package: "grpc-swift-2"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "GRPCServiceLifecycle", package: "grpc-swift-extras"),
],
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/Benchmarks/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let package = Package(
name: "GRPCSwiftBenchmark",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
],
path: "Benchmarks/GRPCSwiftBenchmark",
plugins: [
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let dependencies: [Package.Dependency] = [

// This adds some build settings which allow us to map "@available(gRPCSwift 2.x, *)" to
// the appropriate OS platforms.
let nextMinorVersion = 2
let nextMinorVersion = 1
let availabilitySettings: [SwiftSetting] = (0 ... nextMinorVersion).map { minor in
let name = "gRPCSwift"
let version = "2.\(minor)"
Expand Down Expand Up @@ -123,7 +123,7 @@ let targets: [Target] = [
]

let package = Package(
name: "grpc-swift",
name: "grpc-swift-2",
products: products,
dependencies: dependencies,
targets: targets
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ about gRPC on the [gRPC project's website][grpcio].
- 🪪 **License** is Apache 2.0, repeated in [LICENSE](License)
- 🔒 **Security** issues should be reported via the process in [SECURITY.md](SECURITY.md)
- 🔀 **Related Repositories**:
- [`grpc-swift-nio-transport`][grpc-swift-nio-transport] contains high-performance HTTP/2 client and server transport implementations for gRPC Swift built on top of SwiftNIO.
- [`grpc-swift-protobuf`][grpc-swift-protobuf] contains integrations with SwiftProtobuf for gRPC Swift.
- [`grpc-swift-extras`][grpc-swift-extras] contains optional extras for gRPC Swift.
- [`grpc-swift-nio-transport`][grpc-swift-nio-transport] contains
high-performance HTTP/2 client and server transport implementations for gRPC
Swift built on top of SwiftNIO.
- [`grpc-swift-protobuf`][grpc-swift-protobuf] contains integrations with
SwiftProtobuf for gRPC Swift.
- [`grpc-swift-extras`][grpc-swift-extras] contains optional extras for gRPC
Swift.


## Quick Start
Expand All @@ -27,15 +31,15 @@ let package = Package(
name: "Application",
platforms: [.macOS("15.0")],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
],
targets: [
.executableTarget(
name: "Server",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
]
Expand All @@ -46,7 +50,7 @@ let package = Package(

[gh-grpc]: https://github.com/grpc/grpc
[grpcio]: https://grpc.io
[spi-grpc-swift]: https://swiftpackageindex.com/grpc/grpc-swift/documentation
[spi-grpc-swift]: https://swiftpackageindex.com/grpc/grpc-swift-2/documentation
[grpc-swift-nio-transport]: https://github.com/grpc/grpc-swift-nio-transport
[grpc-swift-protobuf]: https://github.com/grpc/grpc-swift-protobuf
[grpc-swift-extras]: https://github.com/grpc/grpc-swift-extras
3 changes: 0 additions & 3 deletions Sources/GRPCCodeGen/CodeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public struct CodeGenerator: Sendable {
/// Whether or not server code should be generated.
public var server: Bool
/// The name of the core gRPC module.
@available(gRPCSwift 2.1, *)
public var grpcCoreModuleName: String
/// The availability annotations to use on the generated code.
@available(gRPCSwift 2.2, *)
public var availability: AvailabilityAnnotations = .default

/// Creates a new configuration.
Expand Down Expand Up @@ -92,7 +90,6 @@ public struct CodeGenerator: Sendable {
}

// The availability that generated code is annotated with.
@available(gRPCSwift 2.2, *)
public struct AvailabilityAnnotations: Sendable, Hashable {
public struct Platform: Sendable, Hashable {
/// The name of the OS, e.g. 'macOS'.
Expand Down
1 change: 0 additions & 1 deletion Sources/GRPCCore/Call/Client/ClientResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ extension StreamingClientResponse {
/// Returns the body parts (i.e. `messages` and `trailingMetadata`) returned from the server.
///
/// For rejected RPCs (in other words, where ``accepted`` is `failure`), the `RPCAsyncSequence` throws a ``RPCError``.
@available(gRPCSwift 2.1, *)
public var bodyParts: RPCAsyncSequence<Contents.BodyPart, any Error> {
switch self.accepted {
case let .success(contents):
Expand Down
2 changes: 0 additions & 2 deletions Sources/GRPCCore/Call/Server/ServerContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
public struct ServerContext: Sendable {

/// Protocol used to help identify transport specific context fields
@available(gRPCSwift 2.2, *)
public protocol TransportSpecific: Sendable {}

/// A description of the method being called.
Expand Down Expand Up @@ -58,7 +57,6 @@ public struct ServerContext: Sendable {
///
/// An example of what this field can be used for, would be to store
/// things like a peer certificate from a mTLS connection
@available(gRPCSwift 2.2, *)
public var transportSpecific: (any TransportSpecific)?

/// A handle for checking the cancellation status of an RPC.
Expand Down
14 changes: 7 additions & 7 deletions Sources/GRPCCore/Documentation.docc/Articles/Migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ you've finished the migration.

Now you need to update your package manifest (`Package.swift`) to use the local
copy rather than the copy from GitHub. Replace your package dependency on
"grpc-swift" with the local dependency, and update any target dependencies to
use "grpc-swift-v1" instead of "grpc-swift":
"grpc-swift-2" with the local dependency, and update any target dependencies to
use "grpc-swift-v1" instead of "grpc-swift-2":

```swift
let package = Package(
Expand Down Expand Up @@ -130,16 +130,16 @@ If there are any other build issues fix them up now and commit the changes.
Now add the following package dependencies for gRPC Swift 2.x:

```
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
```

For each target which was previously importing the `GRPC` module add the
following target dependencies:

```
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
```
Expand Down Expand Up @@ -175,7 +175,7 @@ directory containing your generated code, for example:
One of the patches applied to the local copy of 1.x was to rename
`protoc-gen-grpc-swift` to `protoc-gen-grpc-swift-v1`. If you previously used a
script to generate your code, then run it again, ensuring that the copy of
`protoc-gen-grpc-swift` comes from this package (as it will now be for 2.x).
`protoc-gen-grpc-swift-2` comes from this package (as it will now be for 2.x).

If you didn't use a script to generate your code then refer to the
[documentation][3] to learn how to generate gRPC Swift code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ let package = Package(
name: "RouteGuide",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
],
targets: []
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ let package = Package(
name: "RouteGuide",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
],
targets: [
.executableTarget(
name: "RouteGuide",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ let package = Package(
name: "RouteGuide",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
],
targets: [
.executableTarget(
name: "RouteGuide",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$ swift build --product protoc-gen-swift
$ swift build --product protoc-gen-grpc-swift
$ swift build --product protoc-gen-grpc-swift-2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$ protoc --plugin=.build/debug/protoc-gen-grpc-swift \
$ protoc --plugin=.build/debug/protoc-gen-grpc-swift-2 \
-I Protos \
--grpc-swift_out=Sources/Generated \
Protos/route_guide.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ let package = Package(
name: "RouteGuide",
platforms: [.macOS(.v15)],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"),
],
targets: [
.executableTarget(
name: "RouteGuide",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
],
Expand Down
Loading
Loading