diff --git a/.circleci/config.yml b/.circleci/config.yml index b3daedd..f6fd133 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,8 +150,8 @@ jobs: steps: - checkout - run: - name: Install protobuf and git - command: pacman -Sy --noconfirm protobuf git && protoc --version + name: Install protobuf and git and dependencies + command: pacman -Sy --noconfirm protobuf git gcc-libs && protoc --version - run: name: Regenerate descriptors working_directory: pbjson-types diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..651a48b --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,23 @@ +# Releasing + +This document describes the release process for [`pbjson`], [`pbjson-types`] and +[`pbjson-build`] to crates.io. + +Note that `pbjson-test` is not released as it is only used for testing. + +[`pbjson`]: https://crates.io/crates/pbjson +[`pbjson-types`]: https://crates.io/crates/pbjson-types +[`pbjson-build`]: https://crates.io/crates/pbjson-build + +## Step 1: Update Version + +First make a PR to update the version (example [#127](https://github.com/influxdata/pbjson/issues/127)) + +## Step 2: Release +Run the following commands to release `pbjson`, `pbjson-types` and `pbjson-build` + +```shell +cargo publish -p pbjson +cargo publish -p pbjson-build +cargo publish -p pbjson-types +``` diff --git a/pbjson-build/Cargo.toml b/pbjson-build/Cargo.toml index 17e766e..3715900 100644 --- a/pbjson-build/Cargo.toml +++ b/pbjson-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pbjson-build" -version = "0.6.2" +version = "0.7.0" authors = ["Raphael Taylor-Davies "] edition = "2021" description = "Generates Serialize and Deserialize implementations for prost message types" @@ -10,10 +10,10 @@ categories = ["encoding"] repository = "https://github.com/influxdata/pbjson" [dependencies] -heck = "0.4" -prost = "0.12" -prost-types = "0.12" -itertools = "0.11" +heck = "0.5" +prost = "0.13" +prost-types = "0.13" +itertools = "0.13" [dev-dependencies] tempfile = "3.1" diff --git a/pbjson-build/src/generator/message.rs b/pbjson-build/src/generator/message.rs index 4203554..2822f56 100644 --- a/pbjson-build/src/generator/message.rs +++ b/pbjson-build/src/generator/message.rs @@ -262,7 +262,7 @@ fn write_serialize_variable( writeln!(writer)?; write!( writer, - "{}}}).collect::, _>>()", + "{}}}).collect::, _>>()", Indent(indent + 1) ) } @@ -316,7 +316,7 @@ fn write_serialize_variable( writeln!(writer, "{}Ok((k, v))", Indent(indent + 2))?; writeln!( writer, - "{}}}).collect::>()?;", + "{}}}).collect::>()?;", Indent(indent + 1) )?; } @@ -380,6 +380,11 @@ fn write_serialize_scalar_variable( "{}#[allow(clippy::needless_borrow)]", Indent(indent) )?; + writeln!( + writer, + "{}#[allow(clippy::needless_borrows_for_generic_args)]", + Indent(indent) + )?; writeln!( writer, "{}struct_ser.serialize_field(\"{}\", {}(&{}).as_str())?;", diff --git a/pbjson-build/src/lib.rs b/pbjson-build/src/lib.rs index eaee816..912bbee 100644 --- a/pbjson-build/src/lib.rs +++ b/pbjson-build/src/lib.rs @@ -186,7 +186,8 @@ impl Builder { self.emit_fields = true; self } - // print integers instead of enum names. + + /// Print integers instead of enum names. pub fn use_integers_for_enums(&mut self) -> &mut Self { self.use_integers_for_enums = true; self diff --git a/pbjson-test/Cargo.toml b/pbjson-test/Cargo.toml index 7113ac5..bbb0951 100644 --- a/pbjson-test/Cargo.toml +++ b/pbjson-test/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "pbjson-test" -version = "0.6.0" +version = "0.7.0" authors = ["Raphael Taylor-Davies "] edition = "2021" description = "Test resources for pbjson converion" repository = "https://github.com/influxdata/pbjson" [dependencies] -prost = "0.12" +prost = "0.13" pbjson = { path = "../pbjson" } pbjson-types = { path = "../pbjson-types" } serde = { version = "1.0", features = ["derive"] } @@ -24,5 +24,5 @@ chrono = "0.4" serde_json = "1.0" [build-dependencies] -prost-build = "0.12" +prost-build = "0.13" pbjson-build = { path = "../pbjson-build" } diff --git a/pbjson-types/Cargo.toml b/pbjson-types/Cargo.toml index 23c1fdf..c0c0896 100644 --- a/pbjson-types/Cargo.toml +++ b/pbjson-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pbjson-types" -version = "0.6.0" +version = "0.7.0" authors = ["Raphael Taylor-Davies "] description = "Protobuf well known types with serde serialization support" edition = "2021" @@ -13,13 +13,13 @@ exclude = ["protos/*"] [dependencies] # In alphabetical order bytes = "1.0" chrono = { version = "0.4", default-features = false, features = ["alloc"] } -pbjson = { path = "../pbjson", version = "0.6" } -prost = "0.12" +pbjson = { path = "../pbjson", version = "0.7" } +prost = "0.13" serde = { version = "1.0", features = ["derive"] } [dev-dependencies] serde_json = "1.0" [build-dependencies] # In alphabetical order -prost-build = "0.12" -pbjson-build = { path = "../pbjson-build", version = "0.6" } +prost-build = "0.13" +pbjson-build = { path = "../pbjson-build", version = "0.7" } diff --git a/pbjson-types/descriptors.bin b/pbjson-types/descriptors.bin index 0e370ea..7757b3d 100644 Binary files a/pbjson-types/descriptors.bin and b/pbjson-types/descriptors.bin differ diff --git a/pbjson-types/src/timestamp.rs b/pbjson-types/src/timestamp.rs index e7a1fc5..a842e13 100644 --- a/pbjson-types/src/timestamp.rs +++ b/pbjson-types/src/timestamp.rs @@ -1,5 +1,5 @@ use crate::Timestamp; -use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; +use chrono::{DateTime, Utc}; use serde::de::Visitor; use serde::Serialize; @@ -8,14 +8,13 @@ impl TryFrom for DateTime { fn try_from(value: Timestamp) -> Result { let Timestamp { seconds, nanos } = value; - let dt = NaiveDateTime::from_timestamp_opt( + Self::from_timestamp( seconds, nanos .try_into() .map_err(|_| "out of range integral type conversion attempted")?, ) - .ok_or("invalid or out-of-range datetime")?; - Ok(Utc.from_utc_datetime(&dt)) + .ok_or("invalid or out-of-range datetime") } } @@ -33,7 +32,7 @@ impl Serialize for Timestamp { where S: serde::Serializer, { - let t: DateTime = self.clone().try_into().map_err(serde::ser::Error::custom)?; + let t: DateTime = (*self).try_into().map_err(serde::ser::Error::custom)?; serializer.serialize_str(t.to_rfc3339().as_str()) } } diff --git a/pbjson/Cargo.toml b/pbjson/Cargo.toml index 95eb06d..2c35e10 100644 --- a/pbjson/Cargo.toml +++ b/pbjson/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pbjson" -version = "0.6.0" +version = "0.7.0" authors = ["Raphael Taylor-Davies "] edition = "2021" description = "Utilities for pbjson conversion" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e724aeb..ba3f7e4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.72" +channel = "1.74" components = ["rustfmt", "clippy"]