bazelbuild / examples

Examples for Bazel
http://bazel.build
Apache License 2.0
800 stars 497 forks source link

Rust examples #477

Open marvin-hansen opened 6 days ago

marvin-hansen commented 6 days ago

As discussed with Alex Eagle on Slack recently,

this PR contributes multiple Rust examples that cover roughly the top ten use cases. All examples use the new Bazelmod format. The format follows loosely the great C++ tutorial.

If there is anything that needs adjustment, please let me know.

Formalities:

marvin-hansen commented 6 days ago

Ok, I pushed a bunch of commits resolving you suggestions.

It's possible for me to write some text to go along the tutorial.

However, would you please point me at the source of the C++ and Go tutorial text, as I couldn't find it in this repo? I

I take a look at this at the upcoming weekend.

marvin-hansen commented 6 days ago

I've found the source of the C++ and Go tutorial text in the Bazel main repo.

Just to clarify your question, do you ask for a tutorial similar to the C++ and fill a PR with the main repo to get a Rust getting started tutorial on the Bazel website?

In principal, I am okay with that, I just want to make sure I get this right?

alexeagle commented 5 days ago

The Go tutorial isn't on the Bazel site: https://bazel-contrib.github.io/SIG-rules-authors/go-tutorial.html In the past we have not figured out where this content belongs. Google doesn't staff the project with a tech writer currently so it may be better for tutorials to live in bazel-contrib or in the ruleset repo.

I'm asking about your future plans because you named these folders "tutorial", but without accompanying text they are not part of a tutorial. If they are just examples with a README that's fine too. Writing a real tutorial is a lot of work and also easily goes out-of-date so it's a future commitment as well.

marvin-hansen commented 4 days ago

@alexeagle

I see. Perfectly valid point. And you are right, this is not a tutorial similar to the Go one you shared; not even close. Sorry for the confusion, first time contribution to this project...

However, there is no way I can allocate the time to put something like the Go tutorial together let alone maintain it over time. This is a job for a professional tech writer, not a random contributor. Also, I am really unsure if that kind of overkill tutorial is actually needed because, in my observation, the Rust Bazel community tends to be filled with rather senior engineers and they may not even want a comprehensive first principle tutorial since they already know Bazel and only need to file some Rust specific gaps such as generating proto bindings, cross compiling, patching MUSL together etc. And that's basically the gap I'm filling.

I read so often comments in the rules_rust issue tracker that refer to, well, missing Rust Bazelmod examples. I actually filled another PR over at the rules_rust repo to address at least half a dozen open Bazelmod issues that can be closed with a simple code example or a brief Readme.

What I suggest to resolve this matter is to rename the folder to "rust-examples" and leave it there.