Bazel allows you to combine multiple directories from across your filesystem and pretend all of the sources are part of your project. This is a little hard to picture, so let’s use a concrete example. Let’s say you have two projects you’re working on, checked out at ~/gitroot/spaghetti-stable and ~/gitroot/meatballs-master. You don’t want to combineContinue reading “Combining projects without converting to a monorepo”
Author Archives: kchodorow
Non-technical advice for startups and open source projects
A former coworker recently asked me about what had worked well (and not) at MongoDB. I realized that I actually know a bunch of things about running an open source project/startup, some of which may not be common knowledge, so I figured I’d share some here. Things changed dramatically as the company grew and theContinue reading “Non-technical advice for startups and open source projects”
One weird trick for fast CI
Compilers hate this! (Just kidding, compilers are easy-going.) For many build systems, you have to do a clean build to be sure you’re getting the correct result, so your CI has to always do a clean build. On the other hand, Bazel is designed so that you never have to do a bazel clean (ifContinue reading “One weird trick for fast CI”
Creating a javadoc rule for Bazel
A couple of users have asked about how to generate javadoc with Bazel. There’s no built-in way, but I figured it might be useful to whip together a new rule to do so. Here it is. If you’d like to use this rule, download it to your workspace, load it in your build file, andContinue reading “Creating a javadoc rule for Bazel”
Build, y u go slow?
When a build is taking too long, it can be very helpful to know what it’s doing. Bazel has built-in tooling that lets you visualize what each thread is doing at any given moment of a build and which build steps are slowing down your overall build. To try out Bazel’s profiling tools, build yourContinue reading “Build, y u go slow?”
Debugging flaky tests with Bazel
Suppose you have a test that is passing… most of the time. When you start debugging it, you might try running the test and, unhelpfully, it passes: $ bazel test :flaker INFO: Found 1 test target… Target //:flaker up-to-date: bazel-bin/flaker INFO: Elapsed time: 0.223s, Critical Path: 0.04s //:flaker PASSED Executed 1 out of 1 tests:Continue reading “Debugging flaky tests with Bazel”
The Return of the Scala Rule Tutorial: The Execution
This builds on the first part of the tutorial. In this post, we will make the the rule actually produce an executable. Capturing the output from scalac At the end of the tutorial last time, we were calling scalac, but ignoring the result: (cd /private/var/tmp/_bazel_kchodorow/92df5f72e3c78c053575a1a42537d8c3/blerg && exec env – /bin/bash -c ‘external/scala/bin/scalac HelloWorld.scala; echo ”’blah”’Continue reading “The Return of the Scala Rule Tutorial: The Execution”
Tutorial: how to write Scala rules for Bazel
Bazel comes with built-in support for several languages and allows you to write your own support for any other languages in Python. Although you could probably get more abstract, let’s define a rule as something that takes some files, does something to them, and then gives you some output files. Specifically, for this example, weContinue reading “Tutorial: how to write Scala rules for Bazel”
Trimming the (build) tree with Bazel
Jonathan Lange wrote a great blog post about how Bazel caches tests. Basically: if you run a test, change your code, then run a test again, the test will only be rerun if you changed something that could actually change the outcome of the test. Bazel takes this concept pretty far to minimize the workContinue reading “Trimming the (build) tree with Bazel”
Positive reinforcement learning through barbacoa
Yesterday I had some extra barbacoa that Domino was super excited about and Andrew suggested I use it to teach him (Domino, not Andrew) how to lie down on command. I waited until he lay down on his own, said “yes!” and gave him a piece of barbacoa. He leapt up and ate the barbacoaContinue reading “Positive reinforcement learning through barbacoa”
