Skip to content

Commit

Permalink
examples: switch version to last released version
Browse files Browse the repository at this point in the history
As part of hyperium#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.
  • Loading branch information
easwars committed Nov 13, 2024
1 parent d3da369 commit a8c3e1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/helloworld-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions examples/routeguide-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:
Expand Down

0 comments on commit a8c3e1c

Please sign in to comment.