Live data from Hacker News

Scaling Rust Builds with Bazel

mmapped.blog

31–40 of 133 posts

Re: Scaling Rust Builds with Bazel

#31
post #12

Hey, what a surprise, ex-google engineers dragging everyone into bazel... Maybe you have some really complicated use case that makes cargo insufficient, but really, it's pretty damn nice and it's integrated with everything. There are languages that need bazel, rust isn't one of them

Lol, Googler here, I can't deny that I have he urge to force Bazel into the world. It's just, when I joined Google I found a build system I didn't hate. This was the first time. I don't actually love Bazel (Blaze internally), but I love that I don't hate it. Every time I have to learn a new build system in open source work I groan. Why are there so many systems for essentially the same thing?

That begs the question: which build systems have you used before?

Re: Scaling Rust Builds with Bazel

#32
post #13
post #9

Earlier quoted context omitted.

You basically have to declare all those dependencies in Bazel. For instance, if you look at rules for Go, they declare the whole dependency graph (Modules, their relations) in Bazel. There is tooling to generate that for you, so it's not really that bad. Where it gets harder is when this language feature is integrated with an existing build system. C# is normally build with it's own build system, and to build it with…

Have you got any more information on how to use Bazel with C#?

There are open-source rules for that, but at my place of work, we found those lacking. We had to write our own set of rules which would basically take all the source files for a given target, generate MSbuild files depending on the target type and call it from Bazel to build the code in this isolated environment. Another problem are nugets: you have to wrap each in a Bazel target in order to make it available during build, and analyze them beforehand to understand what kind of outputs (like .dlls) will they generate during build. It's a bit of a mess, sadly.

Re: Scaling Rust Builds with Bazel

#33
post #12

Hey, what a surprise, ex-google engineers dragging everyone into bazel... Maybe you have some really complicated use case that makes cargo insufficient, but really, it's pretty damn nice and it's integrated with everything. There are languages that need bazel, rust isn't one of them

Cargo's build scripts are a black box, especially when they are used to compile C/C++ libraries.

Re: Scaling Rust Builds with Bazel

#34
post #12

Hey, what a surprise, ex-google engineers dragging everyone into bazel... Maybe you have some really complicated use case that makes cargo insufficient, but really, it's pretty damn nice and it's integrated with everything. There are languages that need bazel, rust isn't one of them

At the only job I've had where Bazel was in use, we had a team of 4-5 engineers dedicated to maintaining Bazel for a larger team of about 25.

Bazel is a nightmare. I wouldn't wish it on my worst enemy.

Re: Scaling Rust Builds with Bazel

#35
post #32
post #13

Earlier quoted context omitted.

Have you got any more information on how to use Bazel with C#?

There are open-source rules for that, but at my place of work, we found those lacking. We had to write our own set of rules which would basically take all the source files for a given target, generate MSbuild files depending on the target type and call it from Bazel to build the code in this isolated environment. Another problem are nugets: you have to wrap each in a Bazel target in order to make it available during…

That's what I feared. Have you got any solution to make this play nicely with Visual Studio?

Re: Scaling Rust Builds with Bazel

#36
post #23

Earlier quoted context omitted.

Lol, Googler here, I can't deny that I have he urge to force Bazel into the world. It's just, when I joined Google I found a build system I didn't hate. This was the first time. I don't actually love Bazel (Blaze internally), but I love that I don't hate it. Every time I have to learn a new build system in open source work I groan. Why are there so many systems for essentially the same thing?

Question for an insider. Bazel code coverage seems to be one of the roughest edges. At least when running C++ tests. Only lcov is supported, and due to the sandboxing it's impossible to get other tools working since they always spit out extra instrumentation data that's neither cached nor available on the next sandbox. Does blaze support code coverage properly? Does Google just not care about code coverage? Am I just…

Hmm sorry I'm quite ignorant about that.

Code coverage is pretty well supported in the internal ecosystem but I would not be surprised to hear this is because we designed Bazel around the system Google was already using for coverage.

Re: Scaling Rust Builds with Bazel

#37
post #12

Hey, what a surprise, ex-google engineers dragging everyone into bazel... Maybe you have some really complicated use case that makes cargo insufficient, but really, it's pretty damn nice and it's integrated with everything. There are languages that need bazel, rust isn't one of them

Lol, Googler here, I can't deny that I have he urge to force Bazel into the world. It's just, when I joined Google I found a build system I didn't hate. This was the first time. I don't actually love Bazel (Blaze internally), but I love that I don't hate it. Every time I have to learn a new build system in open source work I groan. Why are there so many systems for essentially the same thing?

Because the outside world is diverse and open source does not have the ressources to write bazel rules. Nor does it fit their history.

There is definitely a need for better (and Meson is the foss answer, as well as Shake). But Bazel need a context that OpenSource do not have. Time and a clean slate of dependencies cooperating.

Also noone fund tools for DX for OpenSource devs :) only for JS and even that...

Re: Scaling Rust Builds with Bazel

#39
post #12

Hey, what a surprise, ex-google engineers dragging everyone into bazel... Maybe you have some really complicated use case that makes cargo insufficient, but really, it's pretty damn nice and it's integrated with everything. There are languages that need bazel, rust isn't one of them

The article explains why Cargo was insufficient for them.

Re: Scaling Rust Builds with Bazel

#40
post #3

If you want something similar thats written in Rust instead of Java, look at Buck2 https://github.com/facebook/buck2

I would rather have a look at Pants since it's now developed for the needs of Toolchain's customers, and not following the roadmap of a big company with a pretty unique infra. Its engine was also rewritten from Java to Rust.
Post reply on HN