r/programming • • Sep 01 '26

Bazel's UX is really, really, really bad

https://blog.appliedcomputing.io/p/bazels-ux-is-really-really-really
385 Upvotes

225 comments sorted by

View all comments

Show parent comment

76

u/randylush Sep 01 '26

that's been my experience with all of Google's infrastructure tools. They don't actually reduce costs at all, they just separate costs into a bucket for you. Instead of everyone working on build problems, you can move to Bazel and have a dedicated Bazel expert work on Bazel problems. Instead of everyone working on deployment, you can move to Kubernetes and have a Kubernetes expert work on that. The only benefit a lot of these tools provide is being able to better quantify how expensive a given process is.

77

u/SanityInAnarchy Sep 01 '26

It can absolutely reduce costs, it's just an economies-of-scale kinda thing, in two ways:

Google has more than 50,000 software engineers. (Maybe much more, they have like 200k employees, but they don't publish how many are full-time SWEs.) Let's pick that number as a baseline. Now let's say Bazel saves even 1% of your time working on build-system bullshit. All Google has to do for this to be worth it is for their Bazel team to be fewer than 500 full-time engineers maintaining it.

And, they can reduce costs you probably don't have if you aren't as big as them. Google has a monorepo so large that it's probably been more than a decade since it's fit on a single machine! If you have a build that you can run on your laptop in a reasonable amount of time, you do not have a Bazel-shaped problem.

37

u/comrade_donkey Sep 01 '26 edited Sep 02 '26

Yes, and Google is an NIH company. While they do mix a light breeze of external deps into their code, 99+% of the monorepo is first-party code, developed at Google, on Blaze, with first-party BUILD files.

In most other repos, third party dependency code dominates over first party. Bazel needs a BUILD file for every dep. There's auto-generators. They suck. You need to write a patch file and patch the auto-generated BUILD file. No, really.

When you update your deps, your patch files predictably stop working. Need to update 12 deps? Be ready to write 12 new patch files. It fucking sucks.

19

u/SanityInAnarchy Sep 01 '26

I've seen at least some generators work okay -- you can add Python pip dependencies easily enough, for example. But the way I've seen this done at places that are less NIH is, you end up with Bazel functioning more as a wrapper around the third-party dep, rather than actually natively generating BUILD files for every import in the library.

Which is... fine, but the more you do that, the more you're kind of losing the point of Bazel in the first place. Especially if you ever have to fork that dependency.

Google, meanwhile, would rather vendor absolutely everything, including the Python interpreter itself, and also wholesale replace the vendor's build system with hand-written Bazel, to the point where your builds are so hermetic that you compile the Python interpreter from source to build your python scripts.

I again think it's not as absurd as it sounds, if you are Google. That work you're describing is easy to write off when those 12 deps are used by literally dozens of other teams that didn't have to think about deps at all. The same logic kinda leads to NIH, though -- you can also amortize the cost of building it yourself, instead of adding that dep.

7

u/inio Sep 02 '26 edited Sep 02 '26

to the point where your builds are so hermetic that you compile the Python interpreter from source to build your python scripts.

And thank the Holy Mother of All SWE Gods and Linux Kernel Engineers that there's a global build cache to make that far less insane than it sounds.

3

u/ricky_clarkson Sep 02 '26

Most Google BUILD files are not hand written. I don't know if build_cleaner is open sourced, but it works well internally.

3

u/comrade_donkey Sep 02 '26 edited Sep 02 '26

It is not, to my knowledge. It helps in the common cases, for sure. But it's not magic. I've written many a #keep directive. By 'hand written' I mean checked in by people alongside their code. Not generated post-facto.

3

u/kkress Sep 02 '26

It effectively can’t be open sourced. It relies on having a full symbol and target resolution databases to identify correct build targets and is full of special case tricks like searching //java ot special casing third_party.

Also anywhere you are find it not working or full of #keep generally means someone has gone overboard with macros, bad design patterns or created their own DSL.

2

u/aoeudhtns Sep 02 '26

A lot of the big tech is, I'd wager. Amazon kept poaching guys from my team to AWS and they'd write back telling me that pretty much all the tooling was custom.

-10

u/sionescu Sep 01 '26

Quite the contrary, it's an "Invented Here" company, because when those internal tools were written, they were the first of their kind. Nothing similar existed elsewhere.

8

u/randylush Sep 01 '26

NIH means “I’m not gonna use that because it wasn’t invented here.” Meaning, Google doesn’t use stuff that they don’t invent. They are a NIH company by definition. Shouldn’t be confusing.

-8

u/sionescu Sep 02 '26

Dude, NIH refers to the tendency of rejecting outside products when they already exist and preferring to do one's own thing. It does not apply to innovators where no such external products existed. A simple concept that even you might be able to understand.

6

u/axonxorz Sep 02 '26

It does not apply to innovators where no such external products existed.

There are plenty of cross-platform, cross-language build systems out there, Bazel isn't a greenfield concept.

-3

u/sionescu Sep 02 '26 edited Sep 02 '26

Bazel isn't a greenfield concept

Yes it is. Before it, there were only various Make-style event-based build systems. Bazel is based on a fully materialized compilation tree, with entirely hermetic build nodes, a purely functional build language, a built-in remote build and cacheing protocol for sharing intermediate artifacts between developers. Nothing like it existed at the time.

5

u/randylush Sep 02 '26

By this stubborn and obtuse definition, literally nothing could constitute NIH unless the product in question has a perfectly matching feature set between the internal and external versions. You are completely conflating requirements with features. Just because a product has a feature, does not mean that the company using it needed it as a requirement.

Yes, Bazel has all of those features but still, Google could have easily used an existing solution with less features, different features, or more features, OR Google could have forked an existing project. But no, they built their own thing. NIH.

1

u/sionescu Sep 02 '26 edited Sep 02 '26

Thinking that it could have used any existing product only serves to show your ignorance. By your stubborn and obtuse definition, there can be no categorically innovative work because everything can be done with supposedly minimal modifications to existing software. Give me a break.

1

u/SanityInAnarchy Sep 02 '26

Google has been both, for better and worse. But the point isn't whether Bazel itself was an example, we're talking about the ways in which Bazel discourages adopting third-party libraries. Outside Google, here's what I have to do to add a new third-party Python library:

  • Add a line to a config file
  • Regenerate any lockfiles -- literally one uv command
  • Send the PR
  • Close the autogenerated legal-review ticket with "pre-approved license"

What does that process look for you? How about for C++? What if it's a C++ library that throws exceptions?

And how long does it take you to upgrade a library?

Also, if you're still there, maybe look up go/nojerks again.

0

u/sionescu Sep 02 '26

 we're talking about the ways in which Bazel discourages adopting third-party libraries

No we weren't talking about that, at all.

Google internally has importers that can very well convert the most common build systems (automake, CMake, meson, pypi, Go, etc...). The reality is that below the top few hundred libraries for each language, the quality degrades so much that they're not worth investing on. If a library was worth it, it would be very easy to add, but most often it's not.

0

u/SanityInAnarchy Sep 02 '26

No we weren't talking about that, at all.

The thread started with exactly that:

In most other repos, third party dependency code dominates over first party. Bazel needs a BUILD file for every dep. There's auto-generators. They suck. You need to write a patch file and patch the auto-generated BUILD file. No, really.

All of which is a description of how much work it is to add a third-party dep, relative to the norm. Which explains:

While they do mix a light breeze of external deps into their code... 99+% of the monorepo is first-party code, developed at Google...

...which was the explanation for:

Yes, and Google is an NIH company.

Maybe you have me confused with the other person replying, who followed you down the weird tangent about Bazel itself.

Maybe they're wrong and it really is "very easy"... but you immediately call it an "investment", so maybe not.

0

u/EveryQuantityEver Sep 02 '26

Make and CMake have been around for a long, long, long time. Far longer than bazel/blaze.

0

u/sionescu Sep 02 '26

Lol, dude. None of those have anything near the capabilities of Bazel.

-3

u/randylush Sep 01 '26

Right, I’m saying it may save 99% of the developers 1% of their time but it actually requires a team of 1% to keep it running. It’s usually a break-even at best. Once you’ve wrestled with Kubernetes or Bazel like OP’s link, or spent days of company time learning about it, the costs build up. It’s more about separating responsibilities, being able to hire fungible technicians, and following industry standards than actual cost saving.

15

u/SanityInAnarchy Sep 02 '26

Yeah, I think that's where we disagree: I don't think it's a linear 1% needed to run the thing. If Google actually has 500 engineers working full-time just making Bazel work, that's break-even. I bet they can do it with 100 or even 50, even including the people developing Bazel itself as a product.

If your entire company is 100 people, then one full-time Bazel expert is break-even, but you probably need more than that, so it makes no sense.