Skip to content
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

Closed
wants to merge 21 commits into from
Closed

Replace script with build script, use features #175

wants to merge 21 commits into from

Conversation

ice1000
Copy link
Contributor

@ice1000 ice1000 commented Jan 30, 2019

See pingcap/kvproto#349

Part of #177

Signed-off-by: ice1000 [email protected]

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 30, 2019

@BusyJay @overvenus PTAL

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 30, 2019

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.
Ridiculous

@nrc
Copy link
Contributor

nrc commented Jan 30, 2019

Why? It's asking me to generate some codes that will not pass the fmt check.
Ridiculous

Bug in Rustfmt :-(

I think it is best to use #[rustfmt::skip] on this code

Copy link
Contributor

@nrc nrc left a 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.

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 30, 2019

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?

@nrc
Copy link
Contributor

nrc commented Jan 30, 2019

Does creating a separated library for sharing the codes in this build script sounds like a good idea?

It does to me

@ice1000
Copy link
Contributor Author

ice1000 commented Jan 30, 2019

It does to me

Let's listen to @siddontang's idea

@siddontang
Copy link
Contributor

before we finish all things, don't introduce prost in the project.

We need to verify in our own forked repo.

@siddontang siddontang closed this Jan 31, 2019
@siddontang siddontang reopened this Jan 31, 2019
@siddontang siddontang changed the title Replace script with build script, use features [DNM] Replace script with build script, use features Jan 31, 2019
@ice1000
Copy link
Contributor Author

ice1000 commented Jan 31, 2019

@siddontang I've removed all prost dependencies, please take a look again.

Copy link
Contributor

@nrc nrc left a 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

build.rs Outdated Show resolved Hide resolved
build.rs Outdated Show resolved Hide resolved
Signed-off-by: ice1000 <[email protected]>
nrc added a commit to nrc/kvproto that referenced this pull request Feb 4, 2019
build.rs Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
@Hoverbear Hoverbear added this to the 0.6.0 milestone Feb 11, 2019
@siddontang
Copy link
Contributor

@ice1000

I think you can create a prost branch later, then we can introduce prost.

Copy link
Member

@overvenus overvenus left a 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")]

@ice1000
Copy link
Contributor Author

ice1000 commented Feb 13, 2019

@ice1000

I think you can create a prost branch later, then we can introduce prost.

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.

@ice1000
Copy link
Contributor Author

ice1000 commented Feb 15, 2019

Addressed @Hoverbear@'s and @overvenus@'s comments.

One task left: rewrite common.sh with rust

@ice1000
Copy link
Contributor Author

ice1000 commented Feb 21, 2019

So the current status of this PR is "blocked by protobuf dependency version selection"?

nrc added a commit to nrc/kvproto that referenced this pull request Feb 22, 2019
@ice1000
Copy link
Contributor Author

ice1000 commented Feb 22, 2019

Resolved merge conflicts.

ice1000 and others added 4 commits February 21, 2019 22:51
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.
@Hoverbear
Copy link
Contributor

@ice1000 There are new conflicts from #184 . :( There is a merge resolve here: https://github.com/ice1000/raft-rs/pull/1 you can accept.

@ice1000 ice1000 changed the base branch from master to pb February 23, 2019 22:16
@ice1000
Copy link
Contributor Author

ice1000 commented Feb 23, 2019

Can we have a merge please?

Now it's redirected to another branch so no worry about breaking anything.

@Hoverbear
Copy link
Contributor

@nrc is your LGTM still valid? :)

@nrc
Copy link
Contributor

nrc commented Feb 25, 2019

@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.

@ice1000
Copy link
Contributor Author

ice1000 commented Feb 25, 2019

@ice1000 could you sort out the commit series please?

Yeah sure

@ice1000
Copy link
Contributor Author

ice1000 commented Feb 25, 2019

protobuf-build is cool, will do.

@Hoverbear
Copy link
Contributor

@nrc Is there a plan to publish that? Raft is a published crate, so it's dependencies must be as well.

@nrc
Copy link
Contributor

nrc commented Feb 25, 2019

@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.

nrc added a commit to nrc/kvproto that referenced this pull request Feb 25, 2019
@Hoverbear
Copy link
Contributor

@nrc So you'd like to depend on it and prevent us from publishing a new release until the prost situation is solved?

@nrc
Copy link
Contributor

nrc commented Feb 25, 2019

@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.

nrc added a commit to nrc/kvproto that referenced this pull request Mar 3, 2019
ice1000 pushed a commit to pingcap/kvproto that referenced this pull request Mar 5, 2019
* 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
@Hoverbear
Copy link
Contributor

Do you think we can just keep work to this branch while we get there?

@ice1000
Copy link
Contributor Author

ice1000 commented Mar 6, 2019

Yes.

@nrc
Copy link
Contributor

nrc commented Apr 3, 2019

Closing in favour of #201

@nrc nrc closed this Apr 3, 2019
sticnarf pushed a commit to sticnarf/kvproto that referenced this pull request Oct 27, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants