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

Consolidate proto-compiler logic into main.rs #317

Merged
merged 7 commits into from
Oct 19, 2020
Merged

Conversation

romac
Copy link
Member

@romac romac commented Oct 16, 2020

Closes: #241

Description

This PR consolidates the proto-compiler crate into a single binary.

Cloning the SDK, compiling the .proto files to Rust, and copying them to the appropriate location now only happen at runtime, whereas it was previously split between build time (via build.rs) and runtime (via main.rs).

This should let us improve on the UX of the proto-compiler binary in the future, eg. by introducing a proper CLI, etc.


For contributor use:

  • Unit tests written
  • Added test to CI if applicable
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer

@codecov-io

This comment has been minimized.

@ancazamfir
Copy link
Collaborator

Would it be possible to add a README.md in proto-compiler that describes the steps to take for a new version to be generated up to the proto crate publishing? Also will the compiled files still be dropped in the proto crate?

@romac
Copy link
Member Author

romac commented Oct 16, 2020

Would it be possible to add a README.md in proto-compiler […]?

Done.

Also will the compiled files still be dropped in the proto crate?

Yes!

Copy link
Member

@greg-szabo greg-szabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added one minor documentation clarification annoyment but I feel this is good to go.

proto-compiler/README.md Outdated Show resolved Hide resolved
pub(crate) fn main() {
let ibc_proto_path = "../proto/src/prost";
fn main() {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

println!("[info ] Cloning cosmos/cosmos-sdk repository...");

let url = "https://github.com/cosmos/cosmos-sdk";
Repository::clone(url, &sdk_dir).unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a more robust solution to this in the tendermint-proto crate. Later, for a next update.

Co-authored-by: Greg Szabo <16846635+greg-szabo@users.noreply.github.com>
@romac romac merged commit 750a87b into master Oct 19, 2020
@romac romac deleted the romac/proto-build branch October 19, 2020 08:53
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.

Consolidate proto-compiler logic into main.rs
4 participants