-
Notifications
You must be signed in to change notification settings - Fork 10
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: update to http 1.x crates #86
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
44b8938
to
de2a37d
Compare
@cbrewster helped me out on finishing this :-) hyper doesn't use tokio types anymore, so an adapter from hyper_utils has to be used: https://github.com/hyperium/hyper/blob/master/CHANGELOG.md#breaking-changes-3 / hyperium/hyper@f9f65b7 |
de2a37d
to
1818355
Compare
This now also includes the |
This bumps bigtable_rs to liufuyang/bigtable_rs#86, allowing us to drop our second set of prost/tonic/http/axum crates. Change-Id: I70f9150289c3e8611ebe8a7d99490e3dfd085a6e Reviewed-on: https://cl.tvl.fyi/c/depot/+/12384 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster <cbrewster@hey.com> Autosubmit: flokli <flokli@flokli.de>
Thanks a lot. I tried your change locally and it works. Besides a small fix I mentioned above, if you want, you can also try uncommenting all the commented lines in the build.rs Looks like they finally fixed an issue with the newer prost-build, so the generated google proto rust code can handle the text block in the comment nicely, then we do not need to comment build.rs script anymore. Previously I had to run build.rs, then manually fix the problem in some comments part of the generated code, then comment out the section in build.rs (otherwise next time building overrides and brings the problem back again). So if you want, you can also bring the updated google proto rs after enabling build.rs. |
1818355
to
7ee5ed1
Compare
This requires updating prost crates to 0.13.x, tonic to 0.12.x and prost-wkt-* to 0.6.*. Only the examples still pull in http 0.x, due to seanmonstar/warp#1090, but that shouldn't affect consumers of bigtable_rs. Co-Authored-By: Connor Brewster <cbrewster@hey.com>
7ee5ed1
to
4fd1b21
Compare
Sure! I removed the out-commenting in |
.compile( | ||
&[ | ||
"../googleapis/google/bigtable/v2/bigtable.proto", | ||
"../googleapis/test/bigtable_test.proto", // only works with fork https://github.com/liufuyang/googleapis |
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.
Not sure about this comment. The git submodule is pointing to upstream.
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.
Yeah that is a patched proto so the submodule is pointing to my patched googleapis repo.
@flokli Thanks a lot. This looks good, however the diff looks a bit different from my local branch. I also just tried to checkout your branch, run
So if you run |
Interesting, the build script result seems can be cached. Do you mind doing these on your side (otherwise I can take it over if you want).
ignore = [
"src/google",
] Do not add rustfmt.toml mentioned above, but update build.rs, see my comment blow.
Let me know if it works for you. |
Well, I just realized the ignore option in rustfmt.toml is not stable, so it does not work directly on stable rustc.... That is a bit annoying... Maybe we should still fall back to the idea of commenting out the build script... 😞 |
Okay, I've got an idea, we can do a cargo fmt in the end of the build script, so add these in the build.rs will do: use std::process::Command;
fn main() -> Result<(), Box<dyn std::error::Error>> {
...
...
...
Command::new("cargo")
.arg("fmt")
.output()
.expect("failed to execute cargo fmt");
Ok(())
} Then we do not need rustmft.toml anymore. I have an almost identical PR here, which you can follow or copy, but I am using that one to test CI failing if git is dirty after build (I manually added a small line change in the generated file to test this). #91 The difference of the generated file on my side can be seen here c57655c, not sure why those |
Isn't adding a shelling out to I ran An inserted test comment further up got removed, so the file is recreated (and the I'm using cargo/rustc |
That is a bit strange. Perhaps also try Yes we can invoke rustfmt as well, I never used it directly, so feel free to implement in that way. Otherwise, do you mind do a simple rebase of your branch to the current main branch in the upstream, and push again here? I would like to see if the build works. |
What's the reason behind committing the files back to the repo in first place? Wouldn't we better off just not set Requiring a runtime dependency on |
The reason was the generated file could not be compiled and needed a manual fix. I think we can move on to let those files be generated at build time (essentially we will be doing this after we uncomment the build.rs), after we know the generated file will stay the same. But the problem is that I cannot verify that. It differs from your build and my build, so I am curious how the CI will do, or what code will be generated on the CI. |
I tried to use your branch, rebased on main, and let the CI generates the files and also format those, still, there is a diff, so the build failed on CI (see the second commit build message from #92) So removing those Not sure why you cannot have the exact same file generated in your environment. Thinking there is a chance users will generate those file differently, I think the best is probably just make the build.rs run conditionally, for example, only runs with an environment parameter set, so that only runs on CI for checking git dirty, and it will not run for any user's usual cargo build. If you do not mind I will just take this over and fix it up with #92 and merge there. If I merge your PR right now, it will fail the CI, unless we remove the generated code in the repo. As I explained, if there is a chance that the generated code can differ, I think perhaps it is less confusing to just commit those in for now. Also, the good part is anyone else who is building this repo does not really need protoc installed. |
I'm not quite sure why my generated code differs, but feel free to go on and take over this PR!
I'd assume this might be due to some rust version differences or something. It's only allows for clippy warnings and formatting, so it really shouldn't matter for functionality. I'd personally prefer to not check in the files, to be more consistent with other crates dealing with the same - especially if the alternative is postprocessing the results and introduce dependencies to cargo or rustfmt at build time, and try to ensure it always runs, which also doesn't seem very reliable. |
Whatever we do here, we'd better we make sure that anyone checkout the repo can do I have made some changes and can go like this #92 Do you want to take a look perhaps? It does not introduce dependencies to cargo/rustfmt/protoc, those are only needed if one builds it with |
Thanks. Ideally, I think there should be a config for rustfmt to ignore a folder (it has but not in stable rust... strangely). Later perhaps we can move onto not checkin those generated files, especially when the generating toolchains are more mature, with stable APIs and no manual fix needed. |
Ok, with #92 merged, nothing to be done here. Thanks! |
This requires updating prost crates to 0.13.x, tonic to 0.12.x and prost-wkt-* to 0.6.*.
Only the examples still pull in http 0.x, due to
seanmonstar/warp#1090, but that shouldn't affect consumers of bigtable_rs.
Closes #70
Closes #77
Closes #78
Closes #79
Closes #80
Closes #81
Closes #82
Closes #84
Closes #85
Closes #87
Closes #88