-
Notifications
You must be signed in to change notification settings - Fork 402
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
Pull/expose rustfmt binaries #291
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
I know
You could add a formatting step to one of the codegen rules (ie. protobuf), or write a genrule that invokes rustfmt. It probably makes sense to make rustfmt available on Edit: A more drop-in place to get testing would be to change bindgen.bzl#L54 so that rustfmt_bin falls back to the rust_toolchain rustfmt instead of its own (which was done as a bit of a hack at the time). |
8d6487e
to
0c4a27f
Compare
Couple of changes:
|
Awesome! Is there anything left to do here? |
lgtm, just need to resolve conflicts. (sorry for losing track of this, not sure what happened) |
Pulls in the version of rustfmt that is shipped with Rust 1.39.0. Distribution path/version found in official release channel TOML. See http://static.rust-lang.org/dist/channel-rust-1.39.0.toml, and rust-lang/rust-forge#215 for more information on this. Relates to bazelbuild#87.
The order of `sort`'s output depends on this variable, and different users may have it set differently.
rustfmt is versioned independently of the other Rust tools, which necessitates keeping track of its version separately. Binaries are also not provided for FreeBSD, and so a separate targets list is also used.
0c4a27f
to
df47457
Compare
Hey all, I've fixed the conflicts and brought the branch up to date with master. Let me know if there's anything else to do! |
See #87.
load_arbitrary_tool()
to downloadrustfmt
from its independent package (so no need to pull in the fullrust
archive).bazel run @rust_linux_x86_64//:rustfmt -- --check $PWD/greeter.rs
.rustfmt
hashes infetch_shas.sh
.rustfmt
andrustc
being independently versioned.LC_ALL=C
infetch_shas.sh
.Prebuilt binaries don't seem to be available for FreeBSD, so unfortunately the tool won't be available on that platform.
TODO: What's the easiest way to write tests for this?
TODO: Can the changes to
fetch_shas.sh
be made nicer?