-
Notifications
You must be signed in to change notification settings - Fork 399
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
Replace script with build script, use features #175
Conversation
@BusyJay @overvenus PTAL |
Diff in /home/travis/build/pingcap/raft-rs/build.rs at line 137: let text = regex.replace_all(
&text,
"if $1 == ::protobuf::wire_format::WireTypeVarint {\
- $3 = $2.read_enum()?;\
+ $3 = $2.read_enum()?;\
} else {\
- return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));\
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));\
}",
); Why? It's asking me to generate some codes that will not pass the fmt check. |
Bug in Rustfmt :-( I think it is best to use |
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.
I think it would be better to share the code between kvproto and raft - we should either pull most of the buildscript out into its own crate, or build the raft proto in kvproto. OTOH if this is meant to just be temporary, then I think it is OK.
Does creating a separated library for sharing the codes in this build script sounds like a good idea? |
It does to me |
Let's listen to @siddontang's idea |
before we finish all things, don't introduce prost in the project. We need to verify in our own forked repo. |
See pingcap/kvproto#349 Signed-off-by: ice1000 <[email protected]>
Signed-off-by: ice1000 <[email protected]>
Signed-off-by: ice1000 <[email protected]>
Signed-off-by: ice1000 <[email protected]>
@siddontang I've removed all prost dependencies, please take a look again. |
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.
LGTM, needs rustfmt-ing
Signed-off-by: ice1000 <[email protected]>
As suggested in tikv/raft-rs#175
I think you can create a |
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.
There are other places use protobuf::
, they also need to #[cfg(feature = "lib-rust-protobuf")]
This is what I'm doing right now. I have a local dev branch dealing with prost and I'm trying my best to reduce prost-related things in this PR. |
Addressed @Hoverbear@'s and @overvenus@'s comments. One task left: rewrite common.sh with rust |
So the current status of this PR is "blocked by protobuf dependency version selection"? |
As suggested in tikv/raft-rs#175
Resolved merge conflicts. |
Signed-off-by: ice1000 <[email protected]>
Signed-off-by: ice1000 <[email protected]>
* Migrate to Rust 2018 * Remove rust-toolchain file The toolchains tested on CI are specified in their own ways, so this is only used for local builds where developers. Its better for developers not to have this file around in case they have their own preferences.
@ice1000 There are new conflicts from #184 . :( There is a merge resolve here: https://github.com/ice1000/raft-rs/pull/1 you can accept. |
Can we have a merge please? Now it's redirected to another branch so no worry about breaking anything. |
@nrc is your LGTM still valid? :) |
@ice1000 could you sort out the commit series please? Would be great to be based on master and not have the merge commits as well as having a coherent set of commits. Could you use protobuf-build? Then we wouldn't need to depend on kvproto or duplicate code. |
Yeah sure |
|
@nrc Is there a plan to publish that? Raft is a published crate, so it's dependencies must be as well. |
Yes, I think once we're ready to merge all the Prost work we can move it to PingCAP org and publish. For now it depends on a modified Prost so we can't. |
As suggested in tikv/raft-rs#175
@nrc So you'd like to depend on it and prevent us from publishing a new release until the prost situation is solved? |
Yeah, I'm hopeful that won't take too long. We can make it work without the Prost dep if we need to publish a release before Prost does. |
As suggested in tikv/raft-rs#175
* rust: use features to support Prost or rust-protobuf * Rust: remove unnecessary `extern crate`s * Use features in generated code * Rename the feature flags and make code generation opt-in * Refactor build script As suggested in tikv/raft-rs#175 * Use kvproto-build crate * Change feature names to match GRPC-rs Also removes use of features in build.rs and use cfg! instead of env var. * Use published protobuf-build
Do you think we can just keep work to this branch while we get there? |
Yes. |
Closing in favour of #201 |
* rust: use features to support Prost or rust-protobuf * Rust: remove unnecessary `extern crate`s * Use features in generated code * Rename the feature flags and make code generation opt-in * Refactor build script As suggested in tikv/raft-rs#175 * Use kvproto-build crate * Change feature names to match GRPC-rs Also removes use of features in build.rs and use cfg! instead of env var. * Use published protobuf-build
See pingcap/kvproto#349
Part of #177
Signed-off-by: ice1000 [email protected]