-
Notifications
You must be signed in to change notification settings - Fork 59
continue prost #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jokemanfire
wants to merge
9
commits into
containerd:master
Choose a base branch
from
jokemanfire:prost
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
continue prost #286
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e777fc9
codegen: Introduce a new codegen using prost
justxuewei c8bacbd
ttrpc-rust: Support the new version of codegen
justxuewei da8166f
ci: Add codegen-related ci testing
justxuewei 8e32522
codegen: Fix issues reported by cargo clippy
justxuewei 0ff5ede
fix: prost compile faild.
jokemanfire 5237576
ci: change protoc install script in ci
jokemanfire 23256d3
fix: fix test in protoc async
jokemanfire eadbd7b
fix: fix the rebase caused the error
jokemanfire 735a10e
fix(example2): skip build example2 in windows
jokemanfire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "ttrpc-codegen" | ||
version = "1.0.0" | ||
edition = "2021" | ||
authors = ["The Ant Group Kata Team <[email protected]>"] | ||
license = "Apache-2.0" | ||
keywords = ["codegen", "ttrpc", "protobuf"] | ||
description = "Rust codegen for ttrpc using prost crate" | ||
categories = ["network-programming", "development-tools::build-utils"] | ||
repository = "https://github.com/containerd/ttrpc-rust/tree/master/codegen" | ||
homepage = "https://github.com/containerd/ttrpc-rust/tree/master/codegen" | ||
readme = "README.md" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
prost = "0.11" | ||
prost-types = "0.11" | ||
prost-build = "0.11" | ||
proc-macro2 = "1.0" | ||
quote = "1.0" | ||
anyhow = "^1.0" | ||
lazy_static = "1.4" | ||
regex = "1.7" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
all: debug test | ||
|
||
# | ||
# Build | ||
# | ||
|
||
.PHONY: debug | ||
debug: | ||
cargo build --verbose --all-targets | ||
|
||
.PHONY: release | ||
release: | ||
cargo build --release | ||
|
||
.PHONY: build | ||
build: debug | ||
|
||
# | ||
# Tests and linters | ||
# | ||
|
||
.PHONY: test | ||
test: | ||
cargo test --verbose | ||
|
||
.PHONY: check | ||
check: | ||
cargo fmt --all -- --check | ||
cargo clippy --all-targets --all-features -- -D warnings | ||
|
||
.PHONY: deps | ||
deps: | ||
rustup update stable | ||
rustup default stable | ||
rustup component add rustfmt clippy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Ttrpc-rust Codegen | ||
|
||
## Getting started | ||
|
||
Please ensure that the protoc has been installed on your local environment. Then | ||
write the following code into "build.rs". | ||
|
||
```rust | ||
let mut protos = vec![ | ||
"protocols/protos/health.proto", | ||
"protocols/protos/agent.proto", | ||
"protocols/protos/oci.proto", | ||
]; | ||
|
||
let includes = vec!["protocols/protos"]; | ||
|
||
let codegen = CodegenBuilder::new() | ||
.set_out_dir(&"protocols/sync") | ||
.set_protos(&protos) | ||
.set_includes(&includes) | ||
.set_serde(true) | ||
.set_async_mode(AsyncMode::None) | ||
.set_generate_service(true) | ||
.build() | ||
.unwrap(); | ||
codegen.generate().unwrap(); | ||
``` | ||
|
||
Add ttrpc-codegen to "build-dependencies" section in "Cargo.toml". | ||
|
||
```toml | ||
[build-dependencies] | ||
ttrpc-codegen = "1.0" | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get unified internal APIs which was defined in ttrpc.proto, how about keeping build script untouched?
I think we can try to avoid so many condition compiling sentences like #[cfg(not(feature = "prost"))] in code.