Skip to content

Commit

Permalink
grpcio: pre-generate bindings for common targets (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterlxt authored and disksing committed Aug 5, 2019
1 parent a2f14a2 commit b9e7bd6
Show file tree
Hide file tree
Showing 8 changed files with 6,198 additions and 30 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ sudo: false
language: rust
git:
submodules: false
cache:
directories:
- $HOME/.cargo
- $HOME/.cache
- $HOME/tools
- $TRAVIS_BUILD_DIR/target
before_cache:
- find $TRAVIS_BUILD_DIR/target/debug -maxdepth 1 -type f -delete

env:
global:
Expand Down Expand Up @@ -60,6 +52,7 @@ matrix:

addons:
apt:
update: true
sources:
- llvm-toolchain-xenial-7
packages:
Expand Down Expand Up @@ -100,6 +93,7 @@ before_script:
script:
- if [[ $TRAVIS_OS_NAME == "linux" ]] && [[ $TRAVIS_RUST_VERSION == "stable" ]]; then
rustup component add rustfmt && cargo fmt --all -- --check;
scripts/generate-bindings.sh && git diff --exit-code HEAD;
fi
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then scripts/lint-grpc-sys.sh && git diff-index --quiet HEAD; fi
- if [[ $TRAVIS_RUST_VERSION == "stable" ]]; then rustup component add clippy && cargo clippy --all -- -D clippy::all && cargo clippy --all --no-default-features --features prost-codec -- -D clippy::all; fi
Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ This project is still under development. The following features with the check m
- CMake >= 3.8.0
- Rust >= 1.19.0
- binutils >= 2.22
- LLVM and Clang >= 3.9 recommended by bindgen
- By default, the [secure feature](#feature-secure) is enabled, therefore Go (>=1.7) is required.
- LLVM and Clang >= 3.9 if you need to generate bindings at compile time.
- By default, the [secure feature](#feature-secure) is provided by boringssl, which requires Go (>=1.7) to build. You can also use openssl instead by enabling [openssl feature](#feature-openssl).

For Linux and MacOS, you also need to install gcc (or clang) too.

Bindings are pre-generated for x86_64 Linux. For other platforms, bindings are generated at compile time.

For Windows, you also need to install following software:

- Active State Perl
Expand All @@ -41,7 +43,7 @@ For Windows, you also need to install following software:
## Build

```
$ git submodule update --init --recursive # if you just cloned the repository
$ ./scripts/reset-submodule.cmd # if you just cloned the repository
$ cargo build
```

Expand Down Expand Up @@ -113,11 +115,21 @@ your `Cargo.toml`'s features list for `gprcio`. E.g.:
grpcio = { version = "0.4.4", features = ["openssl"] }
```


## Performance

See [benchmark](https://github.com/pingcap/grpc-rs/tree/master/benchmark) to find out how to run a benchmark by yourself.

Cross Compile
-------------
See [cross_compile](cross_compile.md)

Contributing
------------

Make sure to format and test the code before sending a PR.

If the content in grpc-sys/grpc is updated, you may need to regenerate bindings:

```
$ ./scripts/generate-bindings.sh
```
2 changes: 1 addition & 1 deletion grpc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ cc = "1.0"
cmake = "0.1.40"
pkg-config = "0.3"
walkdir = "2.2.9"
bindgen = { version = "0.50.0", default-features = false }
bindgen = { version = "0.51.0", default-features = false }
Loading

0 comments on commit b9e7bd6

Please sign in to comment.