-
Notifications
You must be signed in to change notification settings - Fork 29
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
gens, protos: initialize rust codegen #83
gens, protos: initialize rust codegen #83
Conversation
gen/pb-rust/codegen/Cargo.toml
Outdated
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.
This is the most KISS method I could come up with for AOT codegen. This has a downside of decoupling the build steps -- the codegen uses the top-level Dockerfile
, but packaging uses gen/pb-rust/Cargo.toml
. However, a make all
for any new .proto
s should cover this case.
Making sure I understand how this works:
Am I getting that right? If so, that seems reasonable and this LGTM; CI needs fixing 🙂 |
Suggestion: squash down to a single commit and do a sign-off from there, to get DCO passing. You could also rebase and sign-off for each commit separately, but that seems painful given that we'll probably just squash it anyways 🙂 |
cd8bab7
to
0409c7a
Compare
Yep,
and the |
c246b89
to
814d996
Compare
Signed-off-by: Jack Leightcap <[email protected]>
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, nice work!
CC @kommendorkapten and @haydentherapper for review/approval as well, since I can't merge. |
Thanks! Can you also update https://github.com/sigstore/protobuf-specs/blob/main/RELEASE.md? |
Oh yeah, we'll also need a publishing workflow for this. I can add that after the initial merge here. |
apt-get install -y --no-install-recommends \ | ||
curl \ | ||
build-essential | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y |
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.
Isn't there a better way to install the rust toolchain than curl | bash
as root?
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.
We could probably install the Debian/Ubuntu distribution instead, but IMO this will serve us better over time: the system distribution tends to lag behind the latest stable, and the Rust dependency ecosystem (unfortunately?) tends to adopt stabilized features relatively quickly.
I think the risk of doing so is similar to the risk of installing a bunch of Python development dependencies as root, which we do immediately below as well 🙂
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.
For better or worse this is the default recommended installation per https://www.rust-lang.org/tools/install. cargo
is available, but not rustup
, from apt
. However, the cargo
version is out of date:
this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.
And the only method of updating cargo
AFAIK is via rustup
.
rust: docker-image | ||
@echo "Generating rust protobuf files" | ||
docker run \ | ||
--platform linux/amd64 \ |
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'm not super familiar with Rust yet, but I assume this would only create a package for linux/amd64
? Would we want to support other OS/architectures too?
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.
Oh, reading more it seems this is just the target OS/arch for the codegen, so when the docker image has run successfully, only Rust source code is being generated, no object files?
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.
Oh, reading more it seems this is just the target OS/arch for the codegen, so when the docker image has run successfully, only Rust source code is being generated, no object files?
Correct! I think that --platform
option actually shouldn't be needed at all; @jleightcap may have added it because of his local development environment.
(Rust package distributions are always source only, so the environment that creates them should have no effect on their buildability across other platforms.)
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.
Ah, this is a copy-paste from the other targets (python, typescript, &c).
The pb-rust
crate itself is architecture agnostic.
Signed-off-by: Jack Leightcap <[email protected]>
814d996
to
ae23636
Compare
Signed-off-by: Jack Leightcap <[email protected]>
CC @kommendorkapten and @haydentherapper for re-review 🙂 |
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.
@kommendorkapten for approval and merge
Thanks all! Great work here @jleightcap. |
+1, thank you for your contribution! |
Summary
Towards Bundle support in sigstore-rs, per sigstore/sigstore-rs#280 (comment).
Release Note
Adds rust codegen.
Documentation