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

Commit generated protobuf code, only regenerate on-demand #42

Merged
merged 4 commits into from Apr 5, 2024

Conversation

MCOfficer
Copy link
Contributor

@MCOfficer MCOfficer commented Apr 4, 2024

closes #41

Since v0.11 (4fea65b), prost-build requires protoc to be installed while compiling. This means any downstream application / library of bitar also needs it to compile.

This PR adds the generated code directly the repository, and only regenerates it on-demand.

Deciding when to regenerate the code is a bit of a pain - you can't use cargo:rerun-if-changed, since that will run directly after a clean check-out, and thus fail without protoc. The best compromise between elegance and practicality i found was to only regenerate when the generated file has been removed. I've added some comments to clarify this; since the file is rarely changed it shouldn't be too much of a hassle.

Alternative solutions to consider:

Copy link
Contributor Author

@MCOfficer MCOfficer left a comment

Choose a reason for hiding this comment

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

Should also remove protoc from the CI, but i want to hear your thoughts first.

Copy link
Owner

@oll3 oll3 left a comment

Choose a reason for hiding this comment

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

Looks good! Added a single request/question.

Other than that I think the method you've selected seems like the best option given the alternatives you listed. I think it makes it simple enough to regenerate the file when wanted.

Should also remove protoc from the CI, but i want to hear your thoughts first.

The only reason I can think of to keep it would be to validate the checked-in file, but don't know what such a test would be good for really. Anyway, it can be restored if ever needed so let's remove it.

bitar/build.rs Outdated Show resolved Hide resolved
@oll3 oll3 merged commit 7c84b14 into oll3:main Apr 5, 2024
12 checks passed
@oll3
Copy link
Owner

oll3 commented Apr 5, 2024

Thanks @MCOfficer ! ⭐

@MCOfficer MCOfficer deleted the commit_generated branch April 5, 2024 10:13
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.

Commit code generated by prost-build
2 participants