Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hyperium/tonic
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.9.2
Choose a base ref
...
head repository: hyperium/tonic
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.10.0
Choose a head ref

Commits on Apr 17, 2023

  1. Copy the full SHA
    7aa4d4f View commit details
  2. Copy the full SHA
    f276934 View commit details

Commits on Apr 19, 2023

  1. Copy the full SHA
    8e506df View commit details
  2. tonic-build: option to emit Arc<Self> as server receiver (#1352)

    This implements an option to emit `Arc<Self>` instead of `&self` in
    server traits. This enables implementor to reference `Self` data for
    indefinite duration, which may be useful for streaming requests.
    
    Fixes: #1351
    h33p authored Apr 19, 2023
    Copy the full SHA
    4942dd4 View commit details

Commits on Apr 24, 2023

  1. Copy the full SHA
    c09fc23 View commit details
  2. Copy the full SHA
    30b8f07 View commit details
  3. chore: Fix ci tests

    LucioFranco committed Apr 24, 2023
    Copy the full SHA
    1934825 View commit details

Commits on Jun 22, 2023

  1. Copy the full SHA
    39d14bd View commit details
  2. chore: Use cargo-udeps to check unused dependencies (#1364)

    * chore: Use cargo-udeps to check unused dependencies
    
    * Exclude uds example on windows
    
    * Revert to use tokio_stream::Stream instead of futures_core::Stream
    
    * Replace all futures_core:Stream with tokio_stream::Stream
    
    * chore(web): Replace futures_core::Stream with tokio_stream::Stream
    
    * chore(web): Use std version ready instead of futures-core version
    
    * chore(tonic): Use futures-core via futures-util
    
    * Revert "chore(web): Use std version ready instead of futures-core version"
    
    This reverts commit 9d9458d.
    
    * chore(examples): Refactor dependencies
    
    * chore(tonic): Use tokio-stream::iter
    
    * chore(reflection): Use tokio-stream::iter
    
    ---------
    
    Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
    tottoto and LucioFranco authored Jun 22, 2023
    Copy the full SHA
    c9c4acb View commit details
  3. Copy the full SHA
    d72818e View commit details
  4. chore: Remove OptionPin (#1377)

    Use Option::as_pin_mut instead.
    taiki-e authored Jun 22, 2023
    Copy the full SHA
    0d86e36 View commit details

Commits on Jul 24, 2023

  1. chore: Fix warnings (#1434)

    * chore: Fix warnings
    
    * Update msrv/deny config
    
    * Ignore webpki upgrade
    LucioFranco authored Jul 24, 2023
    Copy the full SHA
    f39a4e8 View commit details

Commits on Jul 25, 2023

  1. Copy the full SHA
    2ccdfac View commit details
  2. Copy the full SHA
    1fea823 View commit details
  3. Copy the full SHA
    a5eb625 View commit details
  4. Copy the full SHA
    cf1cebc View commit details
  5. chore: Reduce futures-util in favor of tokio-stream (#1421)

    * chore: Reduce futures-util in favor of tokio-stream
    
    * chore: Replace FuturesUnordered with JoinSet
    tottoto authored Jul 25, 2023
    Copy the full SHA
    1e98d99 View commit details

Commits on Jul 26, 2023

  1. Copy the full SHA
    cef002b View commit details
  2. Copy the full SHA
    8f10a28 View commit details

Commits on Aug 2, 2023

  1. chore(transport): Fix tls roots deprecations (#1443)

    * chore(transport): Fix tls roots deprecations
    
    * fix deny
    LucioFranco authored Aug 2, 2023
    Copy the full SHA
    d44925b View commit details
  2. feat(transport): Add Router::into_router (#1442)

    This adds `into_router` to tonic's `Router` that will convert it into an `axum::Router`.
    LucioFranco authored Aug 2, 2023
    Copy the full SHA
    ea06a1b View commit details
  3. Copy the full SHA
    19e5f39 View commit details
  4. Copy the full SHA
    58d1c28 View commit details
  5. Allow to duplicate GrpcMethod extensions (#1425)

    This is required for (manually) cloning requests, which in turn is
    required for middlewares that retries requests on demand.
    weiznich authored Aug 2, 2023
    Copy the full SHA
    e1bac2b View commit details
  6. Copy the full SHA
    6077896 View commit details
  7. fix(codegen): Use stream type from codegen mod (#1446)

    * fix(codegen): Use stream type from codegen mod
    
    * Add generated code
    LucioFranco authored Aug 2, 2023
    Copy the full SHA
    60d776b View commit details

Commits on Aug 3, 2023

  1. Copy the full SHA
    23602b4 View commit details
  2. Copy the full SHA
    74b079c View commit details

Commits on Aug 4, 2023

  1. Copy the full SHA
    415c7c0 View commit details
  2. Copy the full SHA
    68b24e3 View commit details

Commits on Aug 8, 2023

  1. Copy the full SHA
    4381610 View commit details
  2. Copy the full SHA
    95e81f5 View commit details
  3. Copy the full SHA
    21a9b7b View commit details

Commits on Aug 10, 2023

  1. Copy the full SHA
    4b7a47f View commit details
  2. chore(tonic): Reduce futures-util (#1457)

    * chore(tonic): Reduce futures-util
    
    * chore(transport): Vendor futures_util::future::BoxFuture
    tottoto authored Aug 10, 2023
    Copy the full SHA
    651851a View commit details

Commits on Aug 11, 2023

  1. Copy the full SHA
    928452c View commit details
  2. Copy the full SHA
    cae50b8 View commit details
  3. Copy the full SHA
    67cd687 View commit details
  4. chore: Refactor ci (#1461)

    * chore: Simplify environment variable
    
    * chore: Remove redundant matrix variable
    
    * chore: Reorder steps for uniform order
    
    * chore: Update deprecated cargo option
    
    * chore: Add msrv comment to be easily found by command
    
    * chore: Make check and msrv job next to each other
    tottoto authored Aug 11, 2023
    Copy the full SHA
    6af5bf2 View commit details
  5. build: expose bytes and btree_map config from prost (#1376)

    Note that those two config functions take iterators to paths as input
    and will clear previous configured paths on subsequent calls. This is
    different from the `box` config function.
    
    I personally do not like this inconsistency, but I'll leave them as they
    are so their behaviour match `prost-build`.
    
    Fixes: #908
    
    Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
    stamp711 and LucioFranco authored Aug 11, 2023
    Copy the full SHA
    48bf1c4 View commit details
  6. Allow updating the default buffer size (#1394)

    Co-authored-by: Florian Doyon <florian.doyon@bastionam.io>
    Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
    3 people authored Aug 11, 2023
    Copy the full SHA
    b056308 View commit details
  7. chore(examples): Add h2c example (#1447)

    * chore(examples): Add `h2c` example
    
    * Fix example cargo features
    
    * Make rustls optional
    LucioFranco authored Aug 11, 2023
    Copy the full SHA
    1f820a6 View commit details
  8. Update Cargo.toml (#1414)

    * Update Cargo.toml
    
    * remove unnecessary blank space accidentally added
    
    ---------
    
    Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
    Dylan-DPC and LucioFranco authored Aug 11, 2023
    Copy the full SHA
    fb9afc7 View commit details
  9. Upgrade syn and prettyplease (#1398)

    * Upgrade `syn` and `prettyplease`
    
    * patch prost
    
    * patch prost-types
    
    ---------
    
    Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
    umanwizard and LucioFranco authored Aug 11, 2023
    Copy the full SHA
    69a2aa0 View commit details

Commits on Aug 14, 2023

  1. Copy the full SHA
    35cf1f2 View commit details
  2. feat(build): Add optional default unimplemented stubs (#1344)

    Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
    xanather and LucioFranco authored Aug 14, 2023
    Copy the full SHA
    aff1daf View commit details

Commits on Aug 15, 2023

  1. Copy the full SHA
    62a731b View commit details

Commits on Aug 25, 2023

  1. chore: Bump msrv to 1.64 (#1468)

    * chore: Bump msrv to 1.64
    
    * chore: Add indexmap to deny skip-tree
    tottoto authored Aug 25, 2023
    Copy the full SHA
    6e91db6 View commit details
  2. Copy the full SHA
    388b177 View commit details
  3. feat(web): Add GrpcWebClientService (#1472)

    This adds `grpc-web` support for clients in `tonic-web`. This is done by
    reusing the server side encoding/decoding but wrapping it in different
    directions.
    LucioFranco authored Aug 25, 2023
    Copy the full SHA
    dc29c17 View commit details
Showing with 2,920 additions and 1,153 deletions.
  1. +78 −84 .github/workflows/CI.yml
  2. +26 −0 CHANGELOG.md
  3. +3 −10 CONTRIBUTING.md
  4. +4 −0 Cargo.toml
  5. +1 −1 README.md
  6. +11 −0 codegen/Cargo.toml
  7. +95 −0 codegen/src/main.rs
  8. +6 −8 deny.toml
  9. +37 −13 examples/Cargo.toml
  10. +1 −1 examples/helloworld-tutorial.md
  11. +5 −10 examples/routeguide-tutorial.md
  12. +30 −0 examples/src/cancellation/client.rs
  13. +85 −0 examples/src/cancellation/server.rs
  14. +94 −0 examples/src/dynamic/server.rs
  15. +13 −59 examples/src/grpc-web/client.rs
  16. +86 −0 examples/src/h2c/client.rs
  17. +108 −0 examples/src/h2c/server.rs
  18. +17 −14 examples/src/hyper_warp/server.rs
  19. +17 −14 examples/src/hyper_warp_multiplex/server.rs
  20. +1 −1 examples/src/mock/mock.rs
  21. +1 −2 examples/src/routeguide/client.rs
  22. +1 −2 examples/src/routeguide/server.rs
  23. +1 −2 examples/src/streaming/client.rs
  24. +1 −2 examples/src/streaming/server.rs
  25. +1 −1 examples/src/tls/client.rs
  26. +1 −1 examples/src/tls_client_auth/client.rs
  27. +4 −1 examples/src/tower/server.rs
  28. +3 −10 interop/Cargo.toml
  29. +3 −1 interop/src/bin/client.rs
  30. +6 −6 interop/src/client.rs
  31. +1 −6 interop/src/lib.rs
  32. +4 −4 interop/src/server.rs
  33. +1 −4 tests/ambiguous_methods/Cargo.toml
  34. +2 −5 tests/compression/Cargo.toml
  35. +2 −2 tests/compression/src/bidirectional_stream.rs
  36. +8 −8 tests/compression/src/client_stream.rs
  37. +3 −3 tests/compression/src/compressing_request.rs
  38. +8 −8 tests/compression/src/compressing_response.rs
  39. +3 −3 tests/compression/src/lib.rs
  40. +3 −3 tests/compression/src/server_stream.rs
  41. +1 −2 tests/compression/src/util.rs
  42. +19 −0 tests/default_stubs/Cargo.toml
  43. +9 −0 tests/default_stubs/build.rs
  44. +12 −0 tests/default_stubs/proto/test.proto
  45. +12 −0 tests/default_stubs/proto/test_default.proto
  46. +47 −0 tests/default_stubs/src/lib.rs
  47. +112 −0 tests/default_stubs/src/test_defaults.rs
  48. +2 −5 tests/disable_comments/Cargo.toml
  49. +1 −4 tests/extern_path/my_application/Cargo.toml
  50. +2 −5 tests/extern_path/uuid/Cargo.toml
  51. +1 −4 tests/included_service/Cargo.toml
  52. +3 −8 tests/integration_tests/Cargo.toml
  53. +2 −0 tests/integration_tests/proto/test.proto
  54. +3 −3 tests/integration_tests/src/lib.rs
  55. +3 −4 tests/integration_tests/tests/client_layer.rs
  56. +2 −4 tests/integration_tests/tests/connect_info.rs
  57. +2 −3 tests/integration_tests/tests/connection.rs
  58. +7 −5 tests/integration_tests/tests/extensions.rs
  59. +3 −4 tests/integration_tests/tests/interceptor.rs
  60. +89 −1 tests/integration_tests/tests/max_message_size.rs
  61. +2 −3 tests/integration_tests/tests/origin.rs
  62. +105 −0 tests/integration_tests/tests/routes_builder.rs
  63. +8 −14 tests/integration_tests/tests/status.rs
  64. +18 −8 tests/integration_tests/tests/streams.rs
  65. +1 −2 tests/integration_tests/tests/user_agent.rs
  66. +1 −1 tests/root-crate-path/Cargo.toml
  67. +1 −4 tests/same_name/Cargo.toml
  68. +1 −4 tests/service_named_result/Cargo.toml
  69. +1 −4 tests/service_named_service/Cargo.toml
  70. +1 −4 tests/stream_conflict/Cargo.toml
  71. +18 −0 tests/use_arc_self/Cargo.toml
  72. +19 −0 tests/use_arc_self/LICENSE
  73. +6 −0 tests/use_arc_self/build.rs
  74. +12 −0 tests/use_arc_self/proto/test.proto
  75. +20 −0 tests/use_arc_self/src/lib.rs
  76. +2 −5 tests/wellknown-compiled/Cargo.toml
  77. +2 −5 tests/wellknown/Cargo.toml
  78. +6 −6 tonic-build/Cargo.toml
  79. +0 −24 tonic-build/src/client.rs
  80. +18 −0 tonic-build/src/code_gen.rs
  81. +1 −1 tonic-build/src/lib.rs
  82. +73 −0 tonic-build/src/prost.rs
  83. +129 −41 tonic-build/src/server.rs
  84. +5 −5 tonic-health/Cargo.toml
  85. +7 −3 tonic-health/src/generated/{grpc.health.v1.rs → grpc_health_v1.rs}
  86. +9 −4 tonic-health/src/lib.rs
  87. +0 −30 tonic-health/tests/bootstrap.rs
  88. +6 −9 tonic-reflection/Cargo.toml
  89. +7 −3 tonic-reflection/src/generated/{grpc.reflection.v1alpha.rs → grpc_reflection_v1alpha.rs}
  90. +9 −4 tonic-reflection/src/lib.rs
  91. +0 −30 tonic-reflection/tests/bootstrap.rs
  92. +4 −4 tonic-reflection/tests/server.rs
  93. +5 −8 tonic-types/Cargo.toml
  94. +6 −6 tonic-types/src/generated/{google.rpc.rs → google_rpc.rs}
  95. BIN tonic-types/src/generated/types.bin
  96. +13 −7 tonic-types/src/lib.rs
  97. +201 −65 tonic-types/src/richer_error/mod.rs
  98. +44 −21 tonic-types/src/richer_error/std_messages/bad_request.rs
  99. +26 −7 tonic-types/src/richer_error/std_messages/debug_info.rs
  100. +27 −8 tonic-types/src/richer_error/std_messages/error_info.rs
  101. +44 −21 tonic-types/src/richer_error/std_messages/help.rs
  102. +26 −7 tonic-types/src/richer_error/std_messages/loc_message.rs
  103. +46 −23 tonic-types/src/richer_error/std_messages/prec_failure.rs
  104. +44 −21 tonic-types/src/richer_error/std_messages/quota_failure.rs
  105. +26 −7 tonic-types/src/richer_error/std_messages/request_info.rs
  106. +28 −9 tonic-types/src/richer_error/std_messages/resource_info.rs
  107. +37 −18 tonic-types/src/richer_error/std_messages/retry_info.rs
  108. +0 −29 tonic-types/tests/bootstrap.rs
  109. +4 −4 tonic-web/Cargo.toml
  110. +228 −13 tonic-web/src/call.rs
  111. +113 −0 tonic-web/src/client.rs
  112. +4 −1 tonic-web/src/lib.rs
  113. +1 −2 tonic-web/src/service.rs
  114. +3 −1 tonic-web/tests/integration/Cargo.toml
  115. +15 −16 tonic/Cargo.toml
  116. +5 −6 tonic/src/client/grpc.rs
  117. +3 −3 tonic/src/codec/decode.rs
  118. +169 −42 tonic/src/codec/encode.rs
  119. +7 −8 tonic/src/codec/prost.rs
  120. +2 −3 tonic/src/codegen.rs
  121. +1 −1 tonic/src/extensions.rs
  122. +1 −1 tonic/src/lib.rs
  123. +0 −75 tonic/src/metadata/value.rs
  124. +3 −4 tonic/src/request.rs
  125. +12 −14 tonic/src/server/grpc.rs
  126. +1 −1 tonic/src/server/service.rs
  127. +0 −24 tonic/src/service/interceptor.rs
  128. +1 −2 tonic/src/service/mod.rs
  129. +11 −1 tonic/src/transport/channel/endpoint.rs
  130. +3 −4 tonic/src/transport/channel/mod.rs
  131. +6 −5 tonic/src/transport/mod.rs
  132. +4 −2 tonic/src/transport/server/conn.rs
  133. +15 −18 tonic/src/transport/server/incoming.rs
  134. +49 −10 tonic/src/transport/server/mod.rs
  135. +13 −21 tonic/src/transport/server/recover_error.rs
  136. +1 −1 tonic/src/transport/service/add_origin.rs
  137. +5 −3 tonic/src/transport/service/connection.rs
  138. +7 −3 tonic/src/transport/service/connector.rs
  139. +1 −1 tonic/src/transport/service/executor.rs
  140. +6 −7 tonic/src/transport/service/grpc_timeout.rs
  141. +1 −0 tonic/src/transport/service/mod.rs
  142. +39 −4 tonic/src/transport/service/router.rs
  143. +14 −27 tonic/src/transport/service/tls.rs
  144. +0 −9 tonic/src/util.rs
162 changes: 78 additions & 84 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -6,135 +6,129 @@ on:
- master
pull_request: {}

jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable]
env:
PROTOC_VERSION: 3.23.4
RUSTFLAGS: "-D warnings"

env:
RUSTFLAGS: "-D warnings"
jobs:

rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
components: rustfmt
- uses: actions/checkout@v3
- name: Install cargo-hack
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-hack
- name: Install cargo-machete
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-machete
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
- name: Check fmt
run: cargo fmt -- --check
- name: Check unused dependencies
run: cargo machete
- name: Check features
run: cargo hack check --all --ignore-private --each-feature --no-dev-deps
- name: Check all targets
run: cargo check --all --all-targets --all-features
- run: cargo fmt --all --check

check-docs:
name: check docs
deny-check:
name: cargo-deny check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1

env:
RUSTFLAGS: "-D warnings"

codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: hecrj/setup-rust-action@v1
- name: Install protoc
uses: taiki-e/install-action@v2
with:
rust-version: "1.60"
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: cargo doc
run: cargo doc --workspace --no-deps --exclude examples
- run: cargo run --package codegen
- run: git diff --exit-code

deny-check:
name: cargo-deny check
runs-on: ubuntu-latest
udeps:
name: Check unused dependencies
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- os: windows-latest
option: --exclude-features uds
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-udeps
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: Swatinem/rust-cache@v2
- run: cargo hack udeps --workspace --each-feature ${{ matrix.option }}

check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
- uses: taiki-e/install-action@cargo-hack
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Check features
run: cargo hack check --workspace --ignore-private --each-feature --no-dev-deps
- name: Check all targets
run: cargo check --workspace --all-targets --all-features

msrv:
name: Check MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: "1.60"
- name: Install Protoc
uses: arduino/setup-protoc@v1
rust-version: "1.64" # msrv
- name: Install protoc
uses: taiki-e/install-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check
run: cargo check --all --all-targets --all-features
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace --all-targets --all-features
- run: cargo doc --no-deps --package tonic --package tonic-build --package tonic-health --package tonic-reflection --package tonic-types --package tonic-web
env:
RUSTDOCFLAGS: "-D warnings"

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable]

env:
RUSTFLAGS: "-D warnings"
# run a lot of quickcheck iterations
QUICKCHECK_TESTS: 1000

steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
- name: Install protoc
uses: taiki-e/install-action@v2
with:
rust-version: ${{ matrix.rust }}
components: rustfmt
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
- name: Run tests
run: cargo test --all --all-features
- run: cargo test --workspace --all-features
env:
QUICKCHECK_TESTS: 1000 # run a lot of quickcheck iterations

interop:
name: Interop Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable]

env:
RUSTFLAGS: "-D warnings"

steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
components: rustfmt
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v1
- uses: hecrj/setup-rust-action@v1
- name: Install protoc
uses: taiki-e/install-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Run interop tests
run: ./interop/test.sh
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# [v0.10.0](https://github.com/hyperium/tonic/compare/v0.9.2...v0.10) (2023-09-01)

### Breaking Changes

- Update to `prost` 0.12
- MSRV bumped to 1.64


### Bug Fixes

* **codegen:** Use stream type from codegen mod ([#1446](https://github.com/hyperium/tonic/issues/1446)) ([60d776b](https://github.com/hyperium/tonic/commit/60d776b019854b6a6881d69823a36dcc18b1b4ce))
* **examples:** Use https scheme when using tls ([#1466](https://github.com/hyperium/tonic/issues/1466)) ([388b177](https://github.com/hyperium/tonic/commit/388b177d99e7b0a2c8d5eab1dee65c4dbb671db4))
* **tls:** Don't use tls w/ `http` scheme ([#1454](https://github.com/hyperium/tonic/issues/1454)) ([95e81f5](https://github.com/hyperium/tonic/commit/95e81f51fbbc32a5cf2b94ac0d7005d56b44a8d3))


### Features

* **build:** Add optional default unimplemented stubs ([#1344](https://github.com/hyperium/tonic/issues/1344)) ([aff1daf](https://github.com/hyperium/tonic/commit/aff1daf65d9a0d55b92719318eba2b5a4769c4e1))
* **core:** amortize many ready messages into fewer, larger buffers ([#1423](https://github.com/hyperium/tonic/issues/1423)) ([76eedc1](https://github.com/hyperium/tonic/commit/76eedc13d0dd891892301afa38c3dd8ae6646edf))
* **types:** add ability to extract rich error details from `google.rpc.Status` ([#1430](https://github.com/hyperium/tonic/issues/1430)) ([5fd635a](https://github.com/hyperium/tonic/commit/5fd635a30568ff629c4197c603c45b6b94750e88))
* **transport:** Add `Router::into_router` ([#1442](https://github.com/hyperium/tonic/issues/1442)) ([ea06a1b](https://github.com/hyperium/tonic/commit/ea06a1bb30bc325c7f6d7763fe48bf8b88c1c3ed))
* **transport:** Expose TcpConnectInfo fields ([#1449](https://github.com/hyperium/tonic/issues/1449)) ([74b079c](https://github.com/hyperium/tonic/commit/74b079ce752311fbe760d748804d801c385a5e7a))
* **web:** Add `GrpcWebClientService` ([#1472](https://github.com/hyperium/tonic/issues/1472)) ([dc29c17](https://github.com/hyperium/tonic/commit/dc29c17ae3ef729024e1f80c66566b09d7a01051))
* **transport:** Support for adding services dynamically


# [v0.9.2](https://github.com/hyperium/tonic/compare/v0.9.1...v0.9.2) (2023-04-17)

### Features
13 changes: 3 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -210,18 +210,11 @@ example would explicitly use `Timeout::new`. For example:

When making changes to `tonic-build` that affects the generated code you will
need to ensure that each of the sub crates gets updated as well. Each of the sub
crates like, for example `tonic-health`, generate their gRPC code via a
`bootstrap.rs` test.

The bootstrap tests work by generating the code and then checking git if there
is any uncommitted generated code (there is a difference between the proto files
and the committed generated code). At this point the test will fail telling you
to commit the new code. When the new code is committed, running the test suite
again will cause it to pass as the generated code doesn't create a diff for git
and thus its up to date.
crates like, for example `tonic-health`, generate their gRPC code via `codegen`
crate.

```
cargo test --all
cargo run --package codegen
```

### Commits
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ members = [
"tonic-reflection",
"tonic-web", # Non-published crates
"examples",
"codegen",
"interop", # Tests
"tests/disable_comments",
"tests/included_service",
@@ -23,5 +24,8 @@ members = [
"tests/compression",
"tonic-web/tests/integration",
"tests/service_named_result",
"tests/use_arc_self",
"tests/default_stubs",
]
resolver = "2"

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ For IntelliJ IDEA users, please refer to [this](https://github.com/intellij-rust

### Rust Version

`tonic`'s MSRV is `1.60`.
`tonic`'s MSRV is `1.64`.

```bash
$ rustup update
11 changes: 11 additions & 0 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "codegen"
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
license = "MIT"
edition = "2021"
publish = false
version = "0.1.0"

[dependencies]
tempfile = "3.8.0"
tonic-build = {path = "../tonic-build", default-features = false, features = ["prost", "cleanup-markdown"]}
95 changes: 95 additions & 0 deletions codegen/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
use std::path::PathBuf;

fn main() {
// tonic-health
codegen(
&PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("tonic-health"),
&["proto/health.proto"],
&["proto"],
&PathBuf::from("src/generated"),
&PathBuf::from("src/generated/grpc_health_v1.bin"),
true,
true,
);

// tonic-reflection
codegen(
&PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("tonic-reflection"),
&["proto/reflection.proto"],
&["proto"],
&PathBuf::from("src/generated"),
&PathBuf::from("src/generated/reflection_v1alpha1.bin"),
true,
true,
);

// tonic-types
codegen(
&PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("tonic-types"),
&["proto/status.proto", "proto/error_details.proto"],
&["proto"],
&PathBuf::from("src/generated"),
&PathBuf::from("src/generated/types.bin"),
false,
false,
);
}

fn codegen(
root_dir: &PathBuf,
iface_files: &[&str],
include_dirs: &[&str],
out_dir: &PathBuf,
file_descriptor_set_path: &PathBuf,
build_client: bool,
build_server: bool,
) {
let tempdir = tempfile::Builder::new()
.prefix("tonic-codegen-")
.tempdir()
.unwrap();

let iface_files: Vec<PathBuf> = iface_files
.into_iter()
.map(|&path| root_dir.join(path))
.collect();

let include_dirs: Vec<PathBuf> = include_dirs
.into_iter()
.map(|&path| root_dir.join(path))
.collect();
let out_dir = root_dir.join(out_dir);
let file_descriptor_set_path = root_dir.join(file_descriptor_set_path);

tonic_build::configure()
.build_client(build_client)
.build_server(build_server)
.out_dir(&tempdir)
.file_descriptor_set_path(file_descriptor_set_path)
.compile(&iface_files, &include_dirs)
.unwrap();

for path in std::fs::read_dir(tempdir.path()).unwrap() {
let path = path.unwrap().path();
let to = out_dir.join(
path.file_name()
.unwrap()
.to_str()
.unwrap()
.strip_suffix(".rs")
.unwrap()
.replace('.', "_")
+ ".rs",
);
std::fs::copy(&path, &to).unwrap();
}
}
Loading