chore(release): Prepare 0.1.0-alpha.1 release (#24)
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# 0.1.0-alpha.1 (October 1, 2019)
|
||||
|
||||
- Initial release
|
||||
+11
-1
@@ -1,8 +1,18 @@
|
||||
[package]
|
||||
name = "tonic-build"
|
||||
version = "0.1.0"
|
||||
version = "0.1.0-alpha.1"
|
||||
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
|
||||
edition = "2018"
|
||||
documentation = "https://docs.rs/tonic/0.1.0-alpha.1/tonic/"
|
||||
repository = "https://github.com/hyperium/tonic"
|
||||
homepage = "https://github.com/hyperium/tonic"
|
||||
description = """
|
||||
Codegen module of `tonic` gRPC implementation.
|
||||
"""
|
||||
readme = "README.md"
|
||||
categories = ["network-programming", "asynchronous"]
|
||||
keywords = ["rpc", "grpc", "async", "codegen", "protobuf"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
prost-build = "0.5"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# tonic-build
|
||||
|
||||
Compiles proto files via prost and generates service stubs and proto definitiones for use with tonic.
|
||||
|
||||
## Features
|
||||
|
||||
- rustfmt: This feature enables the use of rustfmt to format the output code this makes the code readable and the error messages nice. This requires that rustfmt is installed. This is enabled by default.
|
||||
|
||||
Required dependencies
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
bytes = <bytes-version>
|
||||
tonic = <tonic-version>
|
||||
prost = <prost-version>
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = <tonic-version>
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple
|
||||
|
||||
```rust
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::compile_protos("proto/service.proto")?;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
```rust
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::configure()
|
||||
.build_server(false)
|
||||
.compile(
|
||||
&["proto/helloworld/helloworld.proto"],
|
||||
&["proto/helloworld"],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
+20
-4
@@ -3,8 +3,9 @@
|
||||
//!
|
||||
//! # Features
|
||||
//!
|
||||
//! `tonic-build` only comes with one `rustfmt` feature which enables the usage of
|
||||
//! the `rustfmt` binary to format the generated code. This is enabled by default.
|
||||
//! - `rustfmt`: This feature enables the use of `rustfmt` to format the output code
|
||||
//! this makes the code readable and the error messages nice. This requires that `rustfmt`
|
||||
//! is installed. This is enabled by default.
|
||||
//!
|
||||
//! # Required dependencies
|
||||
//!
|
||||
@@ -42,6 +43,20 @@
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#![recursion_limit = "256"]
|
||||
#![warn(
|
||||
missing_debug_implementations,
|
||||
missing_docs,
|
||||
rust_2018_idioms,
|
||||
unreachable_pub
|
||||
)]
|
||||
#![doc(
|
||||
html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png"
|
||||
)]
|
||||
#![doc(html_root_url = "https://docs.rs/tonic/0.1.0-alpha.1")]
|
||||
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
|
||||
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
|
||||
|
||||
use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream};
|
||||
use prost_build::Config;
|
||||
use quote::TokenStreamExt;
|
||||
@@ -56,7 +71,8 @@ use std::{
|
||||
mod client;
|
||||
mod service;
|
||||
|
||||
#[derive(Clone)]
|
||||
/// Service generator builder.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Builder {
|
||||
build_client: bool,
|
||||
build_server: bool,
|
||||
@@ -152,7 +168,7 @@ fn fmt(out_dir: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ServiceGenerator {
|
||||
struct ServiceGenerator {
|
||||
builder: Builder,
|
||||
clients: TokenStream,
|
||||
servers: TokenStream,
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ edition = "2018"
|
||||
license = "MIT"
|
||||
documentation = "https://docs.rs/tonic/0.1.0-alpha.1/tonic/"
|
||||
repository = "https://github.com/hyperium/tonic"
|
||||
homepage = "https://tokio.rs"
|
||||
homepage = "https://github.com/hyperium/tonic"
|
||||
description = """
|
||||
A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.
|
||||
"""
|
||||
|
||||
+4
-1
@@ -48,15 +48,18 @@
|
||||
//! [gRPC]: https://grpc.io
|
||||
//! [`tonic`]: https://github.com/hyperium/tonic
|
||||
//! [`tokio`]: https://docs.rs/tokio
|
||||
//! [`prost`]: https://docs.rs/prost
|
||||
//! [`hyper`]: https://docs.rs/hyper
|
||||
//! [`tower`]: https://docs.rs/tower
|
||||
//! [`tonic-build`]: https://docs.rs/tonic-build
|
||||
//! [`tonic-examples`]: https://github.com/hyperium/tonic/tree/master/tonic-examples/src
|
||||
//! [`tonic-examples`]: https://github.com/hyperium/tonic/tree/master/tonic-examples
|
||||
//! [`Codec`]: codec/trait.Codec.html
|
||||
//! [`Channel`]: transport/struct.Channel.html
|
||||
//! [`Server`]: transport/struct.Server.html
|
||||
//! [`rustls`]: https://docs.rs/rustls
|
||||
//! [`openssl`]: https://www.openssl.org
|
||||
//! [`client`]: client/index.html
|
||||
//! [`transport`]: transport/index.html
|
||||
|
||||
#![recursion_limit = "256"]
|
||||
#![warn(
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
/// Include generated proto server and client items.
|
||||
///
|
||||
/// You must specify the gRPC package name.
|
||||
///
|
||||
/// ```rust,ignore
|
||||
/// mod pb {
|
||||
/// tonic::include_proto("hellworld");
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! include_proto {
|
||||
($package: tt) => {
|
||||
|
||||
Reference in New Issue
Block a user