ソースを参照

Update tutorial docs (#1889)

Clinton Nkwocha 1 年間 前
コミット
c596dfb5ec
3 ファイル変更18 行追加16 行削除
  1. 3 2
      Sources/Examples/RouteGuide/README.md
  2. 9 8
      docs/basic-tutorial.md
  3. 6 6
      docs/quick-start.md

+ 3 - 2
Sources/Examples/RouteGuide/README.md

@@ -22,11 +22,12 @@ $ swift run RouteGuideClient
 
 ## Regenerating client and server code
 
-For simplicity, a Makefile is provided in the root of this package with a target
+For simplicity, a shell script ([grpc-swift/Protos/generate.sh][run-protoc]) is provided
 to generate client and server code:
 
 ```sh
-$ make generate-route-guide
+$ Protos/generate.sh
 ```
 
 [basic-tutorial]: ../../../docs/basic-tutorial.md
+[run-protoc]: ../../../Protos/generate.sh

+ 9 - 8
docs/basic-tutorial.md

@@ -55,7 +55,7 @@ $ cd grpc-swift/Sources/Examples/RouteGuide
 Our first step (as you'll know from the [Overview][grpc-docs]) is to
 define the gRPC *service* and the method *request* and *response* types using
 [protocol buffers][protocol-buffers]. You can see the complete .proto file in
-[`grpc-swift/Sources/Examples/RouteGuide/Model/route_guide.proto`][routeguide-proto].
+[`grpc-swift/Protos/examples/route_guide/route_guide.proto`][routeguide-proto].
 
 To define a service, we specify a named `service` in the .proto file:
 
@@ -142,12 +142,12 @@ Protobuf][swift-protobuf]) and the other for gRPC. You need to use the
 [proto3][protobuf-releases] compiler (which supports both proto2 and proto3
 syntax) in order to generate gRPC services.
 
-For simplicity, we've provided a Makefile in the `grpc-swift` directory that
+For simplicity, we've provided a shell script ([grpc-swift/Protos/generate.sh][run-protoc]) that
 runs protoc for you with the appropriate plugin, input, and output (if you want
 to run this yourself, make sure you've installed protoc first):
 
 ```sh
-$ make generate-route-guide
+$ Protos/generate.sh
 ```
 
 Running this command generates the following files in the
@@ -161,8 +161,8 @@ Running this command generates the following files in the
 Let's look at how to run the same command manually:
 
 ```sh
-$ protoc Sources/Examples/RouteGuide/Model/route_guide.proto \
-    --proto_path=Sources/Examples/RouteGuide/Model \
+$ protoc Protos/examples/route_guide/route_guide.proto \
+    --proto_path=Protos/examples/route_guide \
     --plugin=./.build/debug/protoc-gen-swift \
     --swift_opt=Visibility=Public \
     --swift_out=Sources/Examples/RouteGuide/Model \
@@ -455,7 +455,7 @@ program from exiting (since `close()` is never called on the server).
 
 In this section, we'll look at creating a Swift client for our `RouteGuide`
 service. You can see our complete example client code in
-[grpc-swift/Sources/Examples/RouteGuide/Client/main.swift][routeguide-client].
+[grpc-swift/Sources/Examples/RouteGuide/Client/RouteGuideClient.swift][routeguide-client].
 
 #### Creating a stub
 
@@ -604,10 +604,11 @@ Follow the instructions in the Route Guide example directory
 [protobuf-docs]: https://developers.google.com/protocol-buffers/docs/proto3
 [protobuf-releases]: https://github.com/google/protobuf/releases
 [protocol-buffers]: https://developers.google.com/protocol-buffers/docs/overview
-[routeguide-client]: ../Sources/Examples/RouteGuide/Client/main.swift
-[routeguide-proto]: ../Sources/Examples/RouteGuide/Model/route_guide.proto
+[routeguide-client]: ../Sources/Examples/RouteGuide/Client/RouteGuideClient.swift
+[routeguide-proto]: ../Protos/examples/route_guide/route_guide.proto
 [routeguide-provider]: ../Sources/Examples/RouteGuide/Server/RouteGuideProvider.swift
 [routeguide-readme]: ../Sources/Examples/RouteGuide/README.md
 [routeguide-source]: ../Sources/Examples/RouteGuide
+[run-protoc]: ../Protos/generate.sh
 [swift-protobuf-guide]: https://github.com/apple/swift-protobuf/blob/main/Documentation/API.md
 [swift-protobuf]: https://github.com/apple/swift-protobuf

+ 6 - 6
docs/quick-start.md

@@ -6,9 +6,9 @@
 
 #### Swift Version
 
-gRPC requires Swift 5.0 or higher.
+gRPC requires Swift 5.8 or higher.
 
-#### Install Protocol Buffers v3
+#### Install Protocol Buffers
 
 Install the protoc compiler that is used to generate gRPC service code. The
 simplest way to do this is to download pre-compiled binaries for your
@@ -27,8 +27,8 @@ clones the entire repository, but you just need the examples for this quickstart
 and other tutorials):
 
 ```sh
-$ # Clone the repository at the latest release to get the example code:
-$ git clone -b 1.13.0 https://github.com/grpc/grpc-swift
+$ # Clone the repository at the latest release to get the example code (replacing x.y.z with the latest release, for example 1.13.0):
+$ git clone -b x.y.z https://github.com/grpc/grpc-swift
 $ # Navigate to the repository
 $ cd grpc-swift/
 ```
@@ -81,7 +81,7 @@ message HelloReply {
 ```
 
 Let's update this so that the `Greeter` service has two methods. Edit
-`Sources/Examples/HelloWorld/Model/helloworld.proto` and update it with a new
+`Protos/upstream/grpc/examples/helloworld.proto` and update it with a new
 `SayHelloAgain` method, with the same request and response types:
 
 ```proto
@@ -115,7 +115,7 @@ contains our generated gRPC client and server classes.
 From the `grpc-swift` directory run
 
 ```sh
-make generate-helloworld
+$ Protos/generate.sh
 ```
 
 This also regenerates classes for populating, serializing, and retrieving our