From 62d52039e6a75c813f48aa207b1c1ab7583b5718 Mon Sep 17 00:00:00 2001 From: Jorge Prendes Date: Thu, 3 Apr 2025 09:04:02 +0100 Subject: [PATCH 1/5] Add a cargo workspace Add a cargo workspace that links all the crates in the project together. This should make publishing easier when "package-workspace" stabilises. Signed-off-by: Jorge Prendes --- Cargo.toml | 43 +++++++++++++++++++++++++++++++++------- compiler/Cargo.toml | 12 +++++------ ttrpc-codegen/Cargo.toml | 14 ++++++------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3f1bd75f..689a1be1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,47 @@ -[package] -name = "ttrpc" -version = "0.8.4" -authors = ["The AntFin Kata Team "] +[workspace] +members = [ + "./compiler", + "./ttrpc-codegen", + "./example", + "./" +] +resolver = "2" + +[workspace.package] edition = "2018" license = "Apache-2.0" -keywords = ["ttrpc", "protobuf", "rpc"] readme = "README.md" repository = "https://github.com/containerd/ttrpc-rust" homepage = "https://github.com/containerd/ttrpc-rust" +authors = ["The AntFin Kata Team "] + +[workspace.dependencies] +# The dependencies in this section can be used by the crates in this +# workspace by specifying `workspace = true` instead of the crate +# version. For example, for protobuf: +# protobuf = { workspace = true } +ttrpc = { version = "0.8.4", path = "./" } +ttrpc-codegen = { version = "0.5.0", path = "./ttrpc-codegen" } +ttrpc-compiler = { version = "0.7.0", path = "./compiler" } +protobuf = "3.7.2" +protobuf-codegen = "3.7.2" +protobuf-support = "3.7.2" + +[package] +name = "ttrpc" +version = "0.8.4" +authors = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +keywords = ["ttrpc", "protobuf", "rpc"] +readme = "README.md" description = "A Rust version of ttrpc." rust-version = "1.70" [dependencies] -protobuf = { version = "3.7.2" } +protobuf = { workspace = true } libc = { version = "0.2.59", features = [ "extra_traits" ] } nix = "0.26.2" log = "0.4" @@ -33,7 +62,7 @@ tokio-vsock = { version = "0.7.0", optional = true } [build-dependencies] # lock home to avoid conflict with latest version home = "=0.5.9" -protobuf-codegen = "3.7.2" +protobuf-codegen = { workspace = true } [features] default = ["sync"] diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 8d947dd5..67b83be4 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -1,21 +1,21 @@ [package] name = "ttrpc-compiler" version = "0.7.0" -edition = "2018" -authors = ["The AntFin Kata Team "] -license = "Apache-2.0" +edition = { workspace = true } +license = { workspace = true } +authors = { workspace = true } +readme = "README.md" keywords = ["compiler", "ttrpc", "protobuf"] description = "ttRPC compiler for ttrpc" categories = ["network-programming"] repository = "https://github.com/containerd/ttrpc-rust/tree/master/compiler" homepage = "https://github.com/containerd/ttrpc-rust/tree/master/compiler" -readme = "README.md" [dependencies] # lock home to avoid conflict with latest version home = "=0.5.9" -protobuf = "3.7.2" -protobuf-codegen = "3.7.2" +protobuf = { workspace = true } +protobuf-codegen = { workspace = true } prost = "0.8" prost-build = "0.8" prost-types = "0.8" diff --git a/ttrpc-codegen/Cargo.toml b/ttrpc-codegen/Cargo.toml index 046dd674..d248836f 100644 --- a/ttrpc-codegen/Cargo.toml +++ b/ttrpc-codegen/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "ttrpc-codegen" version = "0.5.0" -edition = "2018" -authors = ["The AntFin Kata Team "] -license = "Apache-2.0" +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } keywords = ["codegen", "ttrpc", "protobuf"] description = "Rust codegen for ttrpc using ttrpc-compiler crate" categories = ["network-programming", "development-tools::build-utils"] @@ -15,7 +15,7 @@ readme = "README.md" [dependencies] # lock home to avoid conflict with latest version home = "=0.5.9" -protobuf-support = "3.7.2" -protobuf = "3.7.2" -protobuf-codegen = "3.7.2" -ttrpc-compiler = { version = "0.7.0", path = "../compiler" } +protobuf-support = { workspace = true } +protobuf = { workspace = true } +protobuf-codegen = { workspace = true } +ttrpc-compiler = { workspace = true } From e2ec568a02eaba899190a7a52a1d23c9820817a1 Mon Sep 17 00:00:00 2001 From: Jorge Prendes Date: Thu, 3 Apr 2025 09:43:18 +0100 Subject: [PATCH 2/5] Skip rustfmt in examples generated code Skip running rustfmt on the code generated by the examples Signed-off-by: Jorge Prendes --- example/protocols/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example/protocols/mod.rs b/example/protocols/mod.rs index 7c7af6c8..ded83f71 100644 --- a/example/protocols/mod.rs +++ b/example/protocols/mod.rs @@ -2,5 +2,9 @@ // // SPDX-License-Identifier: Apache-2.0 // + +#[rustfmt::skip] pub mod asynchronous; + +#[rustfmt::skip] pub mod sync; From f4bf9fed7046cdab60ab2b15ecf116c068ad2ff2 Mon Sep 17 00:00:00 2001 From: Jorge Prendes Date: Wed, 9 Apr 2025 11:59:19 +0100 Subject: [PATCH 3/5] mark ttrpc-example as non-publishable add publish = false to ttrpc-example to avoid publishing it by mistake Signed-off-by: Jorge Prendes --- example/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/example/Cargo.toml b/example/Cargo.toml index 50dbaf11..1bb96195 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -9,6 +9,7 @@ readme = "README.md" repository = "https://github.com/alipay/ttrpc-rust" homepage = "https://github.com/alipay/ttrpc-rust" description = "An example of ttrpc." +publish = false [dev-dependencies] protobuf = "3.7.2" From 318b8ee6647d4226ddc46a51e09820ed7d8d6c26 Mon Sep 17 00:00:00 2001 From: Jorge Prendes Date: Wed, 9 Apr 2025 12:00:58 +0100 Subject: [PATCH 4/5] Add release instructions Add RELEASE.md with release intructions Signed-off-by: Jorge Prendes --- RELEASE.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..092fbf2e --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,27 @@ +# Release Process + +This document describes the steps to release a new version of the crate or wasi-demo-app images. + +## Crate Release Process + +### Release Steps + +1. Bump package and dependency versions in: + * `./compiler/Cargo.toml`: Bump the package version as needed. + * `./ttrpc-codegen/Cargo.toml`: Bump the package version as needed. + * `./Cargo.toml`: Bump package version as needed. Then bump the workspace dependencies version to match the respective crates versions. +2. Commit the changes and get them merged in the repo. +2. Dry run the `cargo publish` command as follow + ```bash + cargo +nightly publish \ + -Z package-workspace \ + --dry-run \ + --locked \ + -p ttrpc \ + -p ttrpc-codegen \ + -p ttrpc-compiler + ``` +2. If the dry run succeeds, publish the crates that need publishing using `cargo publihs -p ` in the following order + 1. `ttrpc-compiler` + 2. `ttrpc-codegen` + 3. `ttrpc` \ No newline at end of file From 7c064a38447d0fe2102ef1d72731806e9d9dcce2 Mon Sep 17 00:00:00 2001 From: Jorge Prendes Date: Thu, 3 Apr 2025 09:09:52 +0100 Subject: [PATCH 5/5] Bump crate versions Bump crate versions for publishing. The compiler crate needs a major version bump after breaking changes introduced by PR #291 The codegen crate needs a major version bump because it exports an item from the compiler crate. The main crate needs a major version bump after the braking changes introduced by PR #290 Signed-off-by: Jorge Prendes --- Cargo.toml | 8 ++++---- compiler/Cargo.toml | 2 +- ttrpc-codegen/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 689a1be1..e1b5058d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,16 +20,16 @@ authors = ["The AntFin Kata Team "] # workspace by specifying `workspace = true` instead of the crate # version. For example, for protobuf: # protobuf = { workspace = true } -ttrpc = { version = "0.8.4", path = "./" } -ttrpc-codegen = { version = "0.5.0", path = "./ttrpc-codegen" } -ttrpc-compiler = { version = "0.7.0", path = "./compiler" } +ttrpc = { version = "0.9.0", path = "./" } +ttrpc-codegen = { version = "0.6.0", path = "./ttrpc-codegen" } +ttrpc-compiler = { version = "0.8.0", path = "./compiler" } protobuf = "3.7.2" protobuf-codegen = "3.7.2" protobuf-support = "3.7.2" [package] name = "ttrpc" -version = "0.8.4" +version = "0.9.0" authors = { workspace = true } edition = { workspace = true } license = { workspace = true } diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 67b83be4..c155d2c6 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ttrpc-compiler" -version = "0.7.0" +version = "0.8.0" edition = { workspace = true } license = { workspace = true } authors = { workspace = true } diff --git a/ttrpc-codegen/Cargo.toml b/ttrpc-codegen/Cargo.toml index d248836f..8695ab56 100644 --- a/ttrpc-codegen/Cargo.toml +++ b/ttrpc-codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ttrpc-codegen" -version = "0.5.0" +version = "0.6.0" edition = { workspace = true } authors = { workspace = true } license = { workspace = true }