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

chore(build): compile protobufs with protox #2122

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

senekor
Copy link
Contributor

@senekor senekor commented Jun 12, 2024

protox is a pure-rust implementation of the protobuf compiler. Therefore, it can be managed by cargo.

This removes the implicit dependency on protoc being available in the environment for the build.

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

closes #2119

protox is a pure-rust implementation of the protobuf compiler.
Therefore, it can be managed by cargo.

This removes the implicit dependency on protoc being available
in the environment for the build.
.build_server(true)
.file_descriptor_set_path(&file_descriptor_path)
.skip_protoc_run()
.compile(&["root.proto"], &["."])
Copy link
Member

@ellie ellie Jun 12, 2024

Choose a reason for hiding this comment

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

Suggested change
.compile(&["root.proto"], &["."])
.compile(&["history.proto"], &["."])

If I've understood their docs correctly, at least

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh. copypasta. I was wondering why this even worked with the typo, so I dug a bit in the source of prost-build. Turns out when skip_protoc_run is set, this string is used for almost nothing except a cargo:rerun-if-changed directive. So the build works the same, but the copypasta would lead to the build being cached incorrectly if the protobuf definitions are changed.

By the way, do you prefer incremental commits on a PR or clean history with amend / rebase & force-push?

Copy link
Member

Choose a reason for hiding this comment

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

I was also surprised it built ok! That makes sense, thanks for digging into it.

Whichever works best for you. If it's the sort of larger/complex PR where incremental commits tell a better story and are easier to review then it's appreciated, but it's all squashed anyway so not a big deal.

The paths passed to `compile` aren't actually used by the build.
`skip_protoc_run` prevents that.
That's why a clean build succeeds even with this mistake.

However, the paths are passed to a `cargo:rerun-if-changed` directive.
So this mistake would've caused a failed incremental build if the
protobuf definitions were changed.
Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

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

Excellent, thank you!

Seeing as this is your first time contributing, if you would like a holographic contributors-only Atuin sticker, then please fill out this form!

We do also have a Discord if you'd like to ask any questions, or just fancy hanging out!

@ellie ellie merged commit 9fa223e into atuinsh:main Jun 12, 2024
19 checks passed
@senekor
Copy link
Contributor Author

senekor commented Jun 12, 2024

Cool, thanks! 🙂

@ellie
Copy link
Member

ellie commented Jun 12, 2024

Oh! You're also contributor number 200 🥳

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.

Remove protoc build dependency
2 participants