Skip to content
Merged
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
38 changes: 19 additions & 19 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ let products: [Product] = [

let dependencies: [Package.Dependency] = [
.package(
url: "https://github.com/grpc/grpc-swift.git",
from: "2.2.0"
url: "https://github.com/grpc/grpc-swift-2.git",
from: "2.0.0"
),
.package(
url: "https://github.com/grpc/grpc-swift-protobuf.git",
from: "1.3.0"
from: "2.0.0"
),
.package(
url: "https://github.com/apple/swift-protobuf.git",
Expand All @@ -65,12 +65,12 @@ let dependencies: [Package.Dependency] = [

// -------------------------------------------------------------------------------------------------

// This adds some build settings which allow us to map "@available(gRPCSwiftExtras 1.x, *)" to
// This adds some build settings which allow us to map "@available(gRPCSwiftExtras 2.x, *)" to
// the appropriate OS platforms.
let nextMinorVersion = 1
let availabilitySettings: [SwiftSetting] = (0 ... nextMinorVersion).map { minor in
let name = "gRPCSwiftExtras"
let version = "1.\(minor)"
let version = "2.\(minor)"
let platforms = "macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0"
let setting = "AvailabilityMacro=\(name) \(version):\(platforms)"
return .enableExperimentalFeature(setting)
Expand All @@ -91,7 +91,7 @@ let targets: [Target] = [
.target(
name: "GRPCHealthService",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
],
Expand All @@ -101,8 +101,8 @@ let targets: [Target] = [
name: "GRPCHealthServiceTests",
dependencies: [
.target(name: "GRPCHealthService"),
.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"),
],
swiftSettings: defaultSwiftSettings
),
Expand All @@ -111,7 +111,7 @@ let targets: [Target] = [
.target(
name: "GRPCReflectionService",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
],
Expand All @@ -121,8 +121,8 @@ let targets: [Target] = [
name: "GRPCReflectionServiceTests",
dependencies: [
.target(name: "GRPCReflectionService"),
.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: "SwiftProtobuf", package: "swift-protobuf"),
],
resources: [
Expand All @@ -135,7 +135,7 @@ let targets: [Target] = [
.target(
name: "GRPCOTelTracingInterceptors",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "Tracing", package: "swift-distributed-tracing"),
],
swiftSettings: defaultSwiftSettings
Expand All @@ -144,7 +144,7 @@ let targets: [Target] = [
name: "GRPCOTelTracingInterceptorsTests",
dependencies: [
.target(name: "GRPCOTelTracingInterceptors"),
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "Tracing", package: "swift-distributed-tracing"),
],
swiftSettings: defaultSwiftSettings
Expand All @@ -154,7 +154,7 @@ let targets: [Target] = [
.target(
name: "GRPCServiceLifecycle",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
],
swiftSettings: defaultSwiftSettings
Expand All @@ -163,9 +163,9 @@ let targets: [Target] = [
name: "GRPCServiceLifecycleTests",
dependencies: [
.target(name: "GRPCServiceLifecycle"),
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "ServiceLifecycleTestKit", package: "swift-service-lifecycle"),
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
.product(name: "GRPCInProcessTransport", package: "grpc-swift-2"),
],
swiftSettings: defaultSwiftSettings
),
Expand All @@ -174,7 +174,7 @@ let targets: [Target] = [
.target(
name: "GRPCInteropTests",
dependencies: [
.product(name: "GRPCCore", package: "grpc-swift"),
.product(name: "GRPCCore", package: "grpc-swift-2"),
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
],
swiftSettings: defaultSwiftSettings
Expand All @@ -184,8 +184,8 @@ let targets: [Target] = [
name: "InProcessInteropTests",
dependencies: [
.target(name: "GRPCInteropTests"),
.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"),
],
swiftSettings: defaultSwiftSettings
),
Expand Down
6 changes: 3 additions & 3 deletions Sources/GRPCHealthService/HealthService+Service.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
internal import GRPCCore
private import Synchronization

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension HealthService {
internal struct Service: Grpc_Health_V1_Health.ServiceProtocol {
private let state = Self.State()
}
}

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension HealthService.Service {
func check(
request: ServerRequest<Grpc_Health_V1_HealthCheckRequest>,
Expand Down Expand Up @@ -71,7 +71,7 @@ extension HealthService.Service {
}
}

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension HealthService.Service {
private final class State: Sendable {
// The state of each service keyed by the fully qualified service name.
Expand Down
6 changes: 3 additions & 3 deletions Sources/GRPCHealthService/HealthService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public import GRPCCore
/// // ...
/// }
/// ```
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public struct HealthService: Sendable, RegistrableRPCService {
/// An implementation of the `grpc.health.v1.Health` service.
private let service: Service
Expand All @@ -63,7 +63,7 @@ public struct HealthService: Sendable, RegistrableRPCService {
}
}

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension HealthService {
/// Provides status updates to ``HealthService``.
public struct Provider: Sendable {
Expand Down Expand Up @@ -107,7 +107,7 @@ extension HealthService {
}
}

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension Grpc_Health_V1_HealthCheckResponse.ServingStatus {
package init(_ status: ServingStatus) {
switch status.value {
Expand Down
2 changes: 1 addition & 1 deletion Sources/GRPCHealthService/ServingStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
///
/// - ``ServingStatus/serving`` indicates that a service is healthy.
/// - ``ServingStatus/notServing`` indicates that a service is unhealthy.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public struct ServingStatus: Sendable, Hashable {
internal enum Value: Sendable, Hashable {
case serving
Expand Down
6 changes: 3 additions & 3 deletions Sources/GRPCInteropTests/AssertionFailure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// Failure assertion for interoperability testing.
///
/// This is required because the tests must be able to run without XCTest.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public struct AssertionFailure: Error {
public var message: String
public var file: String
Expand All @@ -31,7 +31,7 @@ public struct AssertionFailure: Error {
}

/// Asserts that the value of an expression is `true`.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public func assertTrue(
_ expression: @autoclosure () throws -> Bool,
_ message: String = "The statement is not true.",
Expand All @@ -44,7 +44,7 @@ public func assertTrue(
}

/// Asserts that the two given values are equal.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public func assertEqual<T: Equatable>(
_ value1: T,
_ value2: T,
Expand Down
6 changes: 3 additions & 3 deletions Sources/GRPCInteropTests/InteroperabilityTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
public import GRPCCore

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public protocol InteroperabilityTest {
/// Run a test case using the given connection.
///
Expand Down Expand Up @@ -48,7 +48,7 @@ public protocol InteroperabilityTest {
/// Note: Tests for compression have not been implemented yet as compression is
/// not supported. Once the API which allows for compression will be implemented
/// these tests should be added.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public enum InteroperabilityTestCase: String, CaseIterable, Sendable {
case emptyUnary = "empty_unary"
case largeUnary = "large_unary"
Expand All @@ -70,7 +70,7 @@ public enum InteroperabilityTestCase: String, CaseIterable, Sendable {
}
}

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension InteroperabilityTestCase {
/// Return a new instance of the test case.
public func makeTest() -> any InteroperabilityTest {
Expand Down
28 changes: 14 additions & 14 deletions Sources/GRPCInteropTests/InteroperabilityTestCases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private import struct Foundation.Data
/// Client asserts:
/// - call was successful
/// - response is non-null
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct EmptyUnary: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -70,7 +70,7 @@ struct EmptyUnary: InteroperabilityTest {
/// - response payload body is 314159 bytes in size
/// - clients are free to assert that the response payload body contents are zero and comparing
/// the entire response message against a golden response
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct LargeUnary: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -146,7 +146,7 @@ struct LargeUnary: InteroperabilityTest {
/// - Response payload body is 314159 bytes in size.
/// - Clients are free to assert that the response payload body contents are zeros and comparing the
/// entire response message against a golden response.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
class ClientCompressedUnary: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -256,7 +256,7 @@ class ClientCompressedUnary: InteroperabilityTest {
/// - response payload body is 314159 bytes in size in both cases.
/// - clients are free to assert that the response payload body contents are zero and comparing the
/// entire response message against a golden response
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
class ServerCompressedUnary: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -346,7 +346,7 @@ class ServerCompressedUnary: InteroperabilityTest {
/// Client asserts:
/// - call was successful
/// - response aggregated_payload_size is 74922
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct ClientStreaming: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -397,7 +397,7 @@ struct ClientStreaming: InteroperabilityTest {
/// - response payload bodies are sized (in order): 31415, 9, 2653, 58979
/// - clients are free to assert that the response payload body contents are zero and
/// comparing the entire response messages against golden responses
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct ServerStreaming: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -473,7 +473,7 @@ struct ServerStreaming: InteroperabilityTest {
/// - response payload bodies are sized (in order): 31415, 92653
/// - clients are free to assert that the response payload body contents are zero and comparing the
/// entire response messages against golden responses
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
class ServerCompressedStreaming: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -586,7 +586,7 @@ class ServerCompressedStreaming: InteroperabilityTest {
/// - response payload bodies are sized (in order): 31415, 9, 2653, 58979
/// - clients are free to assert that the response payload body contents are zero and
/// comparing the entire response messages against golden responses
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct PingPong: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -653,7 +653,7 @@ struct PingPong: InteroperabilityTest {
/// Client asserts:
/// - call was successful
/// - exactly zero responses
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct EmptyStream: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -709,7 +709,7 @@ struct EmptyStream: InteroperabilityTest {
/// received in the initial metadata for calls in Procedure steps 1 and 2.
/// - metadata with key "x-grpc-test-echo-trailing-bin" and value 0xababab is received in the
/// trailing metadata for calls in Procedure steps 1 and 2.
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct CustomMetadata: InteroperabilityTest {
let initialMetadataName = "x-grpc-test-echo-initial"
let initialMetadataValue = "test_initial_metadata_value"
Expand Down Expand Up @@ -830,7 +830,7 @@ struct CustomMetadata: InteroperabilityTest {
/// Client asserts:
/// - received status code is the same as the sent code for both Procedure steps 1 and 2
/// - received status message is the same as the sent message for both Procedure steps 1 and 2
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct StatusCodeAndMessage: InteroperabilityTest {
let expectedCode = 2
let expectedMessage = "test status message"
Expand Down Expand Up @@ -908,7 +908,7 @@ struct StatusCodeAndMessage: InteroperabilityTest {
/// - received status code is the same as the sent code for Procedure step 1
/// - received status message is the same as the sent message for Procedure step 1, including all
/// whitespace characters
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct SpecialStatusMessage: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -951,7 +951,7 @@ struct SpecialStatusMessage: InteroperabilityTest {
///
/// Client asserts:
/// - received status code is 12 (UNIMPLEMENTED)
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct UnimplementedMethod: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
Expand Down Expand Up @@ -984,7 +984,7 @@ struct UnimplementedMethod: InteroperabilityTest {
///
/// Client asserts:
/// - received status code is 12 (UNIMPLEMENTED)
@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
struct UnimplementedService: InteroperabilityTest {
func run<Transport: ClientTransport>(client: GRPCClient<Transport>) async throws {
let unimplementedServiceClient = Grpc_Testing_UnimplementedService.Client(wrapping: client)
Expand Down
4 changes: 2 additions & 2 deletions Sources/GRPCInteropTests/TestService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private import struct FoundationEssentials.Data
private import struct Foundation.Data
#endif

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
public struct TestService: Grpc_Testing_TestService.ServiceProtocol {
public init() {}

Expand Down Expand Up @@ -234,7 +234,7 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol {
}
}

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
extension Metadata {
fileprivate func makeInitialAndTrailingMetadata() -> (Metadata, Metadata) {
var initialMetadata = Metadata()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

@available(gRPCSwiftExtras 1.0, *)
@available(gRPCSwiftExtras 2.0, *)
internal struct HookedRPCAsyncSequence<Wrapped: AsyncSequence & Sendable>: AsyncSequence, Sendable
where Wrapped.Element: Sendable {
private let wrapped: Wrapped
Expand Down
Loading