Skip to content

Commit 55e39fa

Browse files
authored
Remove '@_exported import GRPCCore' (#2109)
Motivation: We added '@_exported import GRPCCore' to transport modules to make it easier for users as it saves them from adding an import. On reflection we've our position on this has changed and the implicit dependency will likely make things less clear. Modifications: - Remove exported import from in-proc transport - Update tutorials/examples to have explicit 'GRPCCore' imports Result: More explicit dependencies
1 parent 61cc2d1 commit 55e39fa

27 files changed

+33
-23
lines changed

Examples/echo/Package.swift

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ let package = Package(
2121
name: "echo",
2222
platforms: [.macOS("15.0")],
2323
dependencies: [
24+
.package(url: "https://github.com/grpc/grpc-swift", exact: "2.0.0-alpha.1"),
2425
.package(url: "https://github.com/grpc/grpc-swift-protobuf", exact: "1.0.0-alpha.1"),
2526
.package(url: "https://github.com/grpc/grpc-swift-nio-transport", branch: "1.0.0-alpha.1"),
2627
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
@@ -29,6 +30,7 @@ let package = Package(
2930
.executableTarget(
3031
name: "echo",
3132
dependencies: [
33+
.product(name: "GRPCCore", package: "grpc-swift"),
3234
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
3335
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
3436
.product(name: "ArgumentParser", package: "swift-argument-parser"),

Examples/hello-world/Package.swift

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ let package = Package(
2121
name: "hello-world",
2222
platforms: [.macOS("15.0")],
2323
dependencies: [
24+
.package(url: "https://github.com/grpc/grpc-swift", exact: "2.0.0-alpha.1"),
2425
.package(url: "https://github.com/grpc/grpc-swift-protobuf", exact: "1.0.0-alpha.1"),
2526
.package(url: "https://github.com/grpc/grpc-swift-nio-transport", exact: "1.0.0-alpha.1"),
2627
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
@@ -29,6 +30,7 @@ let package = Package(
2930
.executableTarget(
3031
name: "hello-world",
3132
dependencies: [
33+
.product(name: "GRPCCore", package: "grpc-swift"),
3234
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
3335
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
3436
.product(name: "ArgumentParser", package: "swift-argument-parser"),

Examples/hello-world/Sources/Subcommands/Greet.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import ArgumentParser
18+
import GRPCCore
1819
import GRPCNIOTransportHTTP2
1920
import GRPCProtobuf
2021

Examples/hello-world/Sources/Subcommands/Serve.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import ArgumentParser
18+
import GRPCCore
1819
import GRPCNIOTransportHTTP2
1920
import GRPCProtobuf
2021

Examples/route-guide/Package.swift

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ let package = Package(
2121
name: "route-guide",
2222
platforms: [.macOS("15.0")],
2323
dependencies: [
24+
.package(url: "https://github.com/grpc/grpc-swift", exact: "2.0.0-alpha.1"),
2425
.package(url: "https://github.com/grpc/grpc-swift-protobuf", exact: "1.0.0-alpha.1"),
2526
.package(url: "https://github.com/grpc/grpc-swift-nio-transport", exact: "1.0.0-alpha.1"),
2627
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
@@ -29,6 +30,7 @@ let package = Package(
2930
.executableTarget(
3031
name: "route-guide",
3132
dependencies: [
33+
.product(name: "GRPCCore", package: "grpc-swift"),
3234
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
3335
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
3436
.product(name: "ArgumentParser", package: "swift-argument-parser"),

Examples/route-guide/Sources/Subcommands/GetFeature.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import ArgumentParser
18+
import GRPCCore
1819
import GRPCNIOTransportHTTP2
1920

2021
struct GetFeature: AsyncParsableCommand {

Examples/route-guide/Sources/Subcommands/ListFeatures.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import ArgumentParser
18+
import GRPCCore
1819
import GRPCNIOTransportHTTP2
1920

2021
struct ListFeatures: AsyncParsableCommand {

Examples/route-guide/Sources/Subcommands/RecordRoute.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import ArgumentParser
18+
import GRPCCore
1819
import GRPCNIOTransportHTTP2
1920

2021
struct RecordRoute: AsyncParsableCommand {

Examples/route-guide/Sources/Subcommands/RouteChat.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import ArgumentParser
18+
import GRPCCore
1819
import GRPCNIOTransportHTTP2
1920

2021
struct RouteChat: AsyncParsableCommand {

Examples/route-guide/Sources/Subcommands/Serve.swift

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import ArgumentParser
1818
import Foundation
19+
import GRPCCore
1920
import GRPCNIOTransportHTTP2
2021
import GRPCProtobuf
2122
import Synchronization

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ about gRPC on the [gRPC project's website][grpcio].
1717
- [`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.
1818
- [`grpc-swift-protobuf`][grpc-swift-protobuf] contains integrations with SwiftProtobuf for gRPC Swift.
1919
- [`grpc-swift-extras`][grpc-swift-extras] contains optional extras for gRPC Swift.
20-
20+
2121

2222
## Quick Start
2323

@@ -32,13 +32,15 @@ let package = Package(
3232
name: "foo-package",
3333
platforms: [.macOS("15.0")],
3434
dependencies: [
35+
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0-alpha.1"),
3536
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0-alpha.1"),
3637
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"),
3738
],
3839
targets: [
3940
.executableTarget(
4041
name: "bar-target",
4142
dependencies: [
43+
.product(name: "GRPCCore", package: "grpc-swift"),
4244
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
4345
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
4446
]
@@ -52,4 +54,4 @@ let package = Package(
5254
[spi-grpc-swift]: https://swiftpackageindex.com/grpc/grpc-swift/documentation
5355
[grpc-swift-nio-transport]: https://github.com/grpc/grpc-swift-nio-transport
5456
[grpc-swift-protobuf]: https://github.com/grpc/grpc-swift-protobuf
55-
[grpc-swift-extras]: https://github.com/grpc/grpc-swift-extras
57+
[grpc-swift-extras]: https://github.com/grpc/grpc-swift-extras

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step08-description.swift

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let package = Package(
1212
.executableTarget(
1313
name: "RouteGuide",
1414
dependencies: [
15+
.product(name: "GRPCCore", package: "grpc-swift"),
1516
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
1617
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
1718
]

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step00-package.swift

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let package = Package(
1212
.executableTarget(
1313
name: "RouteGuide",
1414
dependencies: [
15+
.product(name: "GRPCCore", package: "grpc-swift"),
1516
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
1617
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
1718
]

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step01-package.swift

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let package = Package(
1212
.executableTarget(
1313
name: "RouteGuide",
1414
dependencies: [
15+
.product(name: "GRPCCore", package: "grpc-swift"),
1516
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
1617
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
1718
],

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step02-package.swift

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ let package = Package(
1313
.executableTarget(
1414
name: "RouteGuide",
1515
dependencies: [
16+
.product(name: "GRPCCore", package: "grpc-swift"),
1617
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
1718
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
1819
.product(name: "ArgumentParser", package: "swift-argument-parser"),

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step07-server.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step08-run.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step02-add-run-client.swift

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import GRPCNIOTransportHTTP2
2-
31
extension RouteGuide {
42
func runClient() async throws {
53
}

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step03-create-client.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step04-run-client.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step05-stub.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import GRPCCore
12
import GRPCNIOTransportHTTP2
23

34
extension RouteGuide {

Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial

+3-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@
7777
Next we can add a target. In this tutorial we'll create a single executable target which
7878
can act as both a client and a server.
7979

80-
We require two gRPC dependencies: `GRPCNIOTransportHTTP2"` provides an implementation of an HTTP/2
81-
client and server, while `GRPCProtobuf` provides the necessary components to serialize
80+
We require three gRPC dependencies: `GRPCCore` provides core abstractions and runtime
81+
components, `GRPCNIOTransportHTTP2` provides an implementation of an HTTP/2
82+
client and server, and `GRPCProtobuf` provides the necessary components to serialize
8283
and deserialize `SwiftProtobuf` messages.
8384

8485
@Code(name: "Package.swift", file: "route-guide-sec01-step08-description.swift")

Sources/GRPCInProcessTransport/Exports.swift

-17
This file was deleted.

0 commit comments

Comments
 (0)