Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Bazel: Google Build Tool is now Open Source

Bazel: Google Build Tool is now Open Source

Leia em Português

Lire ce contenu en français

Bazel, the tool that Google uses to build the majority of its software has been partially open sourced. According to Google, Bazel is aimed to build “code quickly and reliably” and is “critical to Google’s ability to continue to scale its software development practices as the company grows.”

Before building Bazel, Google built its software using Makefiles. These tended to be large and led to “slow and unreliable builds.” Furthermore, in comparison to Makefiles, Bazel provides higher-level concepts such as “Java test”, “C++ binary”, the notions of “target platform” and “host platform”, etc.

This level of abstraction is provided by BUILD, a language “that describes a project as sets of small interconnected libraries, binaries and tests.” This is how a simple BUILD file looks like:

package(default_visibility = [“//visibility:public”])

  name = "hello-lib",
  srcs = [""],
  hdrs = ["hello-lib.h"],

  name = "hello-world",
  srcs = [""],
  deps = [":hello-lib"],

  name = "hello-success_test",
  srcs = [""],
  deps = [":hello-lib"],

Among other advantages that Bazel provides, Google highlights its

  • efficiency, thanks to the fact that it recompiles only those files that require it and it is also able to skip tests that do not need to be run;
  • reproducibility of results, making sure there are no skews between “incremental vs clean builds, laptop vs CI system.”

Being designed to Google’s own requirements, Bazel is touted to be particularly suited for projects that have any combination of the following characteristics: have a large, shared codebase; support multiple platforms; are written in multiple languages; have an extensive test suite.

It is worth to note that Bazel will not be developed fully as open source. Indeed, says Google, “We have a significant amount of code that is not open source; in terms of rules, only ~10% of the rules are open source at this point.” The policy that Google will enforce is based on the recognition that a core contributors group will actively work on Bazel, while “external contributors are not actively supporting the project, but just contributing individual changes.”

InfoQ has got in touch with Bazel’s core contributors group to know about what speed improvement can be expected from using Bazel and which features set further apart Bazel from other recently open-sourced competitors such as Facebook's Buck and Pants. This post will be updated if they respond.

Bazel runs on Linux-based systems and OS X, but it is not currently supported on Windows, and Google has “no plans to invest in this port right now”, since it would be a major endeavour.

Rate this Article