Evaluating Bazel for building Firefox
Hermetic declarative build systems like Bazel feel exactly like sound statically typed languages to me. It&#x27;s <i>really</i> hard to get all of your dependencies precisely specified declaratively. The urge to hack in a little imperative code or jam in a build step that you just &quot;know&quot; needs to happen in a certain order is always there and it can be very difficult to satisfy the taskmaster that is the build system. When you have weird cases like a script that produces a variable set of output files based on the <i>content</i> of some input file, it&#x27;s tough to get that working in the build system.<p>But... if you climb that cliff, there are many rewards at the top. Like the article notes, you can reuse intermediate build artifacts between developers (because it&#x27;s not possible for those artifacts to accidentally depend on developer-specific state), you can automatically parallelize (because the build system can tell declaratively which tasks do no depend on each other) and you can ask it interesting queries about the dependency graph. That sounds an awful lot like the runtime safety, performance, and static analysis static types give you.<p>The challenge is that for small programs, dynamic types are just easier to get going with. And <i>every</i> build script starts pretty small. So you have a plethora of simple, hackable build systems like make that work fine at first but then get more and more painful as the program grows. With software, there is at least some customer-visible pain that can enable you to justify a rewrite in a statically-typed language. But build infrastructure is always a hidden cost so it&#x27;s really hard to get the resources to migrate to a different build language.<p>Maybe the lesson here is to bite the bullet and start with a hermetic build system at first.