TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Use the Bazel Build System

19 pointsby eka1almost 3 years ago

7 comments

Tomtealmost 3 years ago
Oh my god. The Bazel website is &quot;translated by Google&quot; (into German in my case).<p>&quot;Warum OBA?&quot; - &quot;Why OBA?&quot;: i have no idea what OBA might mean. It&#x27;s not a common acronym.<p>But it gets better. &quot;Fast, richtig&quot;. Yes, that means &quot;almost correct&quot;. A great claim!
basicallybonesalmost 3 years ago
I have been using Bazel (4, then 5) as the build tool for a small Go monorepo with ~10 (and growing) Dockerized applications importing a handful of internal packages. The initial setup was a bit of a learning curve, and it is overkill for our current stack, but builds are very fast.<p>At the same time, I have been using NX for a larger (though not huge) Javascript monorepo. Javascript is my strongest language, so take this with a grain of salt, but at my org&#x27;s scale I vastly prefer the NX experience over Bazel. I think the reason is that NX feels like an optimized, natural extension of normal Javascript build tooling, while Bazel requires an entirely separate set of knowledge.
评论 #32186564 未加载
ncmncmalmost 3 years ago
A build system optimized for use at Google seems like it must be unavoidably badly pessimized for practically everyone else, as with Kubernetes. But I have not tried it.<p>I know that some people use Cargo for non-Rust projects. Curious about experience with that, vs. e.g. Meson. CMake is used for a lot of projects, but that experience has been almost as bad as Autotools, yet still better than SCons or WAF.
mhoadalmost 3 years ago
Now is actually not a horrible time to start at least being aware of Bazel. With their upcoming 6.0 release in a couple of months they are bringing in some much more sensible primitives to work with that make it much less intimidating than it has been to date.<p>Don’t get me wrong it’s still EXTREMELY power user and I imagine several years before it starts making a name for itself outside of mega corps like Google and Twitter because the ecosystem right now is a mess but I genuinely hope it can live up to its full potential where you can build basically any project from scratch with a single command and know that it was done right and with many other guarantees under the hood.
seedless-sensatalmost 3 years ago
I have always been amused by their motto &quot;Fast, Correct - Choose two&quot;. The more common idiom is something like &quot;Fast, Correct, Cheap - Choose Two&quot;. I guess Bazel isn&#x27;t cheap.
a_nopalmost 3 years ago
All of my clients use Bazel now, so I&#x27;ve started using Bazel. I like it a lot, but there are some kludges when you get into any non-trivial chain of dependencies.<p>First off, if you depend upon another Bazel project which has its own dependencies, you need to clone dependencies from its WORKSPACE into yours for any targets you are hitting. If they chose to include macros for importing their dependencies, you may use those, but this would be opt-in. This is not technically unreasonable; you have all the power you need to have everything in your project depend upon a single version of a shared library or potentially import multiple versions (depending on how tangled the tree is), but you have to use this power, even if you don&#x27;t care. Compare this to a non-sandboxed, more naive build using whatever version of libraries was found in the environment. You have the means to tightly control what is in the environment, or not care. With Bazel you have to care.<p>The dependency chain has led to a problem in practice when I tried to use Google&#x27;s protobufs and Cython at the same time. The protobuf generated Python bindings use a particular version of Cython and override Cython&#x27;s own Bazel rules, which seemed like a very rude and unnecessary practice. This made it impossible for me to use Cython in the same project as protobufs. A bug report to protobuf was met with &quot;PR welcome.&quot;<p>As far as I can tell there are no &quot;best practices&quot; or features in Bazel to ease this kind of degenerate dependency chaining. If there are, a popular Google library decided not to use them. I consider dependencies to be the best and worst thing about Bazel; when it works it just works, when it doesn&#x27;t it really doesn&#x27;t.<p>All that said, I would probably use Bazel over pretty much any other alternative for business software in C++. For one-offs and PoC it is overkill.
zuzuleinenalmost 3 years ago
&quot;sandboxed-execution: Bazel also runs every action in a &quot;sandbox&quot;. You can think of sandbox as being akin to a lightweight container. All the declared-inputs are mapped into the sandbox, and the generated outputs are closely monitored. This is done for each action. If a dependency is missed in the input specification - that&#x27;s a build failure.&quot;<p>This reminds me of how Nix[1] is doing things under the hood. Recently added Nix to on of our projects[2] which is still a build system using Nix to manage dependencies.<p>[1]<a href="https:&#x2F;&#x2F;nixos.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nixos.org&#x2F;</a><p>[2]<a href="https:&#x2F;&#x2F;bob.build&#x2F;docs&#x2F;getting-started&#x2F;package-management" rel="nofollow">https:&#x2F;&#x2F;bob.build&#x2F;docs&#x2F;getting-started&#x2F;package-management</a>