From a8c3e1cf15479ddc46a3574cf3a48a71f7fd44f9 Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Wed, 13 Nov 2024 18:58:58 +0000 Subject: [PATCH] examples: switch version to last released version As part of https://github.com/hyperium/tonic/pull/2014, the versions of "tonic" and "tonic-build" were changed to "0.13". This breaks the instuctions in the examples documentation with an error like: ``` helloworld_tonic$ cargo run --bin helloworld-server Updating crates.io index error: failed to select a version for the requirement `tonic = "^0.13"` candidate versions found which didn't match: 0.12.3, 0.12.2, 0.12.1, ... location searched: crates.io index required by package `helloworld-tonic v0.1.0 (/usr/local/google/home/easwars/src/rust/projects/helloworld_tonic)` if you are looking for the prerelease package it needs to be specified explicitly tonic = { version = "0.1.0-beta.1" } ``` This PR changes the version of "tonic" and "tonic-build" to "*" which results in the latest version getting picked. Setting it to "*" also has the nice property of not having to update the examples everytime a version bump is required. --- examples/helloworld-tutorial.md | 4 ++-- examples/routeguide-tutorial.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/helloworld-tutorial.md b/examples/helloworld-tutorial.md index 2a2ce4944..2e910a9ca 100644 --- a/examples/helloworld-tutorial.md +++ b/examples/helloworld-tutorial.md @@ -112,12 +112,12 @@ name = "helloworld-client" path = "src/client.rs" [dependencies] -tonic = "0.13" +tonic = "*" prost = "0.13" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } [build-dependencies] -tonic-build = "0.13" +tonic-build = "*" ``` We include `tonic-build` as a useful way to incorporate the generation of our client and server gRPC code into the build process of our application. We will setup this build process now: diff --git a/examples/routeguide-tutorial.md b/examples/routeguide-tutorial.md index e835940af..e3ff6f0ed 100644 --- a/examples/routeguide-tutorial.md +++ b/examples/routeguide-tutorial.md @@ -174,7 +174,7 @@ Edit `Cargo.toml` and add all the dependencies we'll need for this example: ```toml [dependencies] -tonic = "0.13" +tonic = "*" prost = "0.13" tokio = { version = "1.0", features = ["rt-multi-thread", "macros", "sync", "time"] } tokio-stream = "0.1" @@ -185,7 +185,7 @@ serde_json = "1.0" rand = "0.8" [build-dependencies] -tonic-build = "0.13" +tonic-build = "*" ``` Create a `build.rs` file at the root of your crate: