BT

Bazel: Google Build Tool is now Open Source

| by Sergio De Simone Follow 21 Followers on Mar 27, 2015. Estimated reading time: 2 minutes |

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”])

cc_library(
  name = "hello-lib",
  srcs = ["hello-lib.cc"],
  hdrs = ["hello-lib.h"],
)

cc_binary(
  name = "hello-world",
  srcs = ["hello-world.cc"],
  deps = [":hello-lib"],
)

cc_test(
  name = "hello-success_test",
  srcs = ["hello-world.cc"],
  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

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT