From 1d59e9339f279c6cf30343369142790396c964db Mon Sep 17 00:00:00 2001 From: Nick Santana Date: Fri, 10 Feb 2023 09:27:59 -0800 Subject: [PATCH] Add empty rust crates for protobufs --- crates/.gitignore | 10 +++++++ crates/Cargo.toml | 28 +++++++++++++++++++ crates/README.md | 12 +++++++++ crates/deny.toml | 55 ++++++++++++++++++++++++++++++++++++++ crates/grpcio/Cargo.toml | 15 +++++++++++ crates/grpcio/README.md | 21 +++++++++++++++ crates/grpcio/src/lib.rs | 12 +++++++++ crates/messages/Cargo.toml | 14 ++++++++++ crates/messages/README.md | 21 +++++++++++++++ crates/messages/src/lib.rs | 12 +++++++++ crates/rust-toolchain.toml | 3 +++ crates/rustfmt.toml | 1 + crates/tonic/Cargo.toml | 15 +++++++++++ crates/tonic/README.md | 21 +++++++++++++++ crates/tonic/src/lib.rs | 12 +++++++++ 15 files changed, 252 insertions(+) create mode 100644 crates/.gitignore create mode 100644 crates/Cargo.toml create mode 100644 crates/README.md create mode 100644 crates/deny.toml create mode 100644 crates/grpcio/Cargo.toml create mode 100644 crates/grpcio/README.md create mode 100644 crates/grpcio/src/lib.rs create mode 100644 crates/messages/Cargo.toml create mode 100644 crates/messages/README.md create mode 100644 crates/messages/src/lib.rs create mode 100644 crates/rust-toolchain.toml create mode 100644 crates/rustfmt.toml create mode 100644 crates/tonic/Cargo.toml create mode 100644 crates/tonic/README.md create mode 100644 crates/tonic/src/lib.rs diff --git a/crates/.gitignore b/crates/.gitignore new file mode 100644 index 0000000..088ba6b --- /dev/null +++ b/crates/.gitignore @@ -0,0 +1,10 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk diff --git a/crates/Cargo.toml b/crates/Cargo.toml new file mode 100644 index 0000000..0662042 --- /dev/null +++ b/crates/Cargo.toml @@ -0,0 +1,28 @@ +[workspace] +members = [ + "grpcio", + "messages", + "tonic", +] + +# We need to explicitly specify resolver 2. +# We shouldn't have to per https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html, but that does not appear to be the case +resolver = "2" + +[profile.release] +lto = "thin" + +[workspace.metadata.release] +shared-version = true +dev-version-ext = "beta.0" +consolidate-commits = true +consolidate-pushes = true +tag-name = "v{{version}}" + +# The file names in this key are relative to the each crate that gets released. +# So we only need one `README.md` entry if all the README's follow a +# common format and are always next to the Cargo.toml for their respective +# package. +pre-release-replacements = [ + {file="README.md", search="mc-probufs-[a-z-]+/[0-9.]+", replace="{{crate_name}}/{{version}}"}, +] diff --git a/crates/README.md b/crates/README.md new file mode 100644 index 0000000..fd29523 --- /dev/null +++ b/crates/README.md @@ -0,0 +1,12 @@ +# Rust crates for gRPC interfaces + +This is composed of 3 crates: + +1. `mc-probufs-tonic`: A crate providing a + [Tonic](https://docs.rs/tonic/latest/tonic/) implementation of gRPC client + and server services. +2. `mc-probufs-grpcio`: A crate providing a + [grpcio](https://docs.rs/grpcio/latest/grpcio/) implementation of gRPC client + and server services. +3. `mc-probufs-messages`: A crate providing gRPC messages. This is used by + both of the service implementations, `mc-probufs-tonic` and `mc-probufs-grpcio`. diff --git a/crates/deny.toml b/crates/deny.toml new file mode 100644 index 0000000..cb5a4df --- /dev/null +++ b/crates/deny.toml @@ -0,0 +1,55 @@ +targets = [] + +[advisories] +db-path = "~/.cargo/advisory-db" +db-urls = ["https://github.com/rustsec/advisory-db"] +vulnerability = "deny" +unmaintained = "warn" +yanked = "warn" +notice = "warn" +ignore = [] + +[licenses] +unlicensed = "deny" +allow = [ + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-3-Clause", + "ISC", + "MIT", + "Unicode-DFS-2016", +] +deny = [] +copyleft = "deny" +allow-osi-fsf-free = "neither" +default = "deny" +confidence-threshold = 0.8 +exceptions = [] + +[bans] +multiple-versions = "warn" +# Lint level for when a crate version requirement is `*` +wildcards = "deny" +highlight = "all" +allow = [] +deny = [ + # https://github.com/briansmith/ring/issues/774 + { name = "ring" }, +] +skip = [ + # Workaround for path only dependencies, + # https://github.com/EmbarkStudios/cargo-deny/issues/241 + # { name = "some/dev/only/path" }, +] +skip-tree = [ ] + +[sources] +unknown-registry = "warn" +unknown-git = "warn" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] +allow-git = [] + +[sources.allow-org] +github = [] +gitlab = [] +bitbucket = [] diff --git a/crates/grpcio/Cargo.toml b/crates/grpcio/Cargo.toml new file mode 100644 index 0000000..cc8fa01 --- /dev/null +++ b/crates/grpcio/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "mc-probufs-grpcio" +version = "0.1.0" +edition = "2021" +authors = ["MobileCoin"] +rust-version = "1.65" +license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/mobilecoinfoundation/probufs" +description = "grpcio protobufs client and server" +categories = ["api-bindings", "encoding"] +keywords = ["grpc", "protobuf", "rpc"] + +[dependencies] +mc-probufs-messages = { path = "../messages", version = "0.1.0" } diff --git a/crates/grpcio/README.md b/crates/grpcio/README.md new file mode 100644 index 0000000..0f02ccb --- /dev/null +++ b/crates/grpcio/README.md @@ -0,0 +1,21 @@ +# MobileCoin: grpcio protobufs services + +[![Project Chat][chat-image]][chat-link]![License][license-image]![Target][target-image][![Crates.io][crate-image]][crate-link][![Docs Status][docs-image]][docs-link][![Dependency Status][deps-image]][deps-link] + +[grpcio](https://docs.rs/grpcio/latest/grpcio/) implementation of protobufs services. + +[chat-image]: https://img.shields.io/discord/844353360348971068?style=flat-square +[chat-link]: https://mobilecoin.chat +[license-image]: https://img.shields.io/crates/l/mc-probufs-grpcio?style=flat-square +[target-image]: https://img.shields.io/badge/target-x86__64-blue?style=flat-square +[crate-image]: https://img.shields.io/crates/v/mc-probufs-grpcio.svg?style=flat-square +[crate-link]: https://crates.io/crates/mc-probufs-grpcio +[docs-image]: https://img.shields.io/docsrs/mc-probufs-grpcio?style=flat-square +[docs-link]: https://docs.rs/crate/mc-probufs-grpcio +[deps-image]: https://deps.rs/crate/mc-probufs-grpcio/0.1.0/status.svg?style=flat-square +[deps-link]: https://deps.rs/crate/mc-probufs-grpcio/0.1.0 diff --git a/crates/grpcio/src/lib.rs b/crates/grpcio/src/lib.rs new file mode 100644 index 0000000..90b9378 --- /dev/null +++ b/crates/grpcio/src/lib.rs @@ -0,0 +1,12 @@ +// Copyright (c) 2023 The MobileCoin Foundation + +#![doc = include_str!("../README.md")] +#![deny(missing_docs, missing_debug_implementations, unsafe_code)] + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/crates/messages/Cargo.toml b/crates/messages/Cargo.toml new file mode 100644 index 0000000..79c7b07 --- /dev/null +++ b/crates/messages/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "mc-probufs-messages" +version = "0.1.0" +edition = "2021" +authors = ["MobileCoin"] +rust-version = "1.65" +license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/mobilecoinfoundation/probufs" +description = "Common grpc messages" +categories = ["encoding"] +keywords = ["protobuf"] + +[dependencies] diff --git a/crates/messages/README.md b/crates/messages/README.md new file mode 100644 index 0000000..9bd341c --- /dev/null +++ b/crates/messages/README.md @@ -0,0 +1,21 @@ +# MobileCoin: Common protobuf messages + +[![Project Chat][chat-image]][chat-link]![License][license-image]![Target][target-image][![Crates.io][crate-image]][crate-link][![Docs Status][docs-image]][docs-link][![Dependency Status][deps-image]][deps-link] + +Common protobuf messages. [prost](https://docs.rs/prost/latest/prost/) is used for the message format. + +[chat-image]: https://img.shields.io/discord/844353360348971068?style=flat-square +[chat-link]: https://mobilecoin.chat +[license-image]: https://img.shields.io/crates/l/mc-probufs-messages?style=flat-square +[target-image]: https://img.shields.io/badge/target-x86__64-blue?style=flat-square +[crate-image]: https://img.shields.io/crates/v/mc-probufs-messages.svg?style=flat-square +[crate-link]: https://crates.io/crates/mc-probufs-messages +[docs-image]: https://img.shields.io/docsrs/mc-probufs-messages?style=flat-square +[docs-link]: https://docs.rs/crate/mc-probufs-messages +[deps-image]: https://deps.rs/crate/mc-probufs-messages/0.1.0/status.svg?style=flat-square +[deps-link]: https://deps.rs/crate/mc-probufs-messages/0.1.0 diff --git a/crates/messages/src/lib.rs b/crates/messages/src/lib.rs new file mode 100644 index 0000000..90b9378 --- /dev/null +++ b/crates/messages/src/lib.rs @@ -0,0 +1,12 @@ +// Copyright (c) 2023 The MobileCoin Foundation + +#![doc = include_str!("../README.md")] +#![deny(missing_docs, missing_debug_implementations, unsafe_code)] + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/crates/rust-toolchain.toml b/crates/rust-toolchain.toml new file mode 100644 index 0000000..2b9b1f1 --- /dev/null +++ b/crates/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +components = [ "clippy", "rustfmt" ] diff --git a/crates/rustfmt.toml b/crates/rustfmt.toml new file mode 100644 index 0000000..3a26366 --- /dev/null +++ b/crates/rustfmt.toml @@ -0,0 +1 @@ +edition = "2021" diff --git a/crates/tonic/Cargo.toml b/crates/tonic/Cargo.toml new file mode 100644 index 0000000..17e1bbe --- /dev/null +++ b/crates/tonic/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "mc-probufs-tonic" +version = "0.1.0" +edition = "2021" +authors = ["MobileCoin"] +rust-version = "1.65" +license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/mobilecoinfoundation/probufs" +description = "Tonic protobufs client and server" +categories = ["api-bindings", "encoding"] +keywords = ["grpc", "protobuf", "rpc"] + +[dependencies] +mc-probufs-messages = { path = "../messages", version = "0.1.0" } diff --git a/crates/tonic/README.md b/crates/tonic/README.md new file mode 100644 index 0000000..b77e9d0 --- /dev/null +++ b/crates/tonic/README.md @@ -0,0 +1,21 @@ +# MobileCoin: Tonic protobufs services + +[![Project Chat][chat-image]][chat-link]![License][license-image]![Target][target-image][![Crates.io][crate-image]][crate-link][![Docs Status][docs-image]][docs-link][![Dependency Status][deps-image]][deps-link] + +[Tonic](https://docs.rs/tonic/latest/tonic/) implementation of gRPC client + +[chat-image]: https://img.shields.io/discord/844353360348971068?style=flat-square +[chat-link]: https://mobilecoin.chat +[license-image]: https://img.shields.io/crates/l/mc-probufs-tonic?style=flat-square +[target-image]: https://img.shields.io/badge/target-x86__64-blue?style=flat-square +[crate-image]: https://img.shields.io/crates/v/mc-probufs-tonic.svg?style=flat-square +[crate-link]: https://crates.io/crates/mc-probufs-tonic +[docs-image]: https://img.shields.io/docsrs/mc-probufs-tonic?style=flat-square +[docs-link]: https://docs.rs/crate/mc-probufs-tonic +[deps-image]: https://deps.rs/crate/mc-probufs-tonic/0.1.0/status.svg?style=flat-square +[deps-link]: https://deps.rs/crate/mc-probufs-tonic/0.1.0 diff --git a/crates/tonic/src/lib.rs b/crates/tonic/src/lib.rs new file mode 100644 index 0000000..90b9378 --- /dev/null +++ b/crates/tonic/src/lib.rs @@ -0,0 +1,12 @@ +// Copyright (c) 2023 The MobileCoin Foundation + +#![doc = include_str!("../README.md")] +#![deny(missing_docs, missing_debug_implementations, unsafe_code)] + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +}