Bazel (software)

Bazel is a free software tool that allows for the automation of building and testing of software.[2] The company Google uses the build tool Blaze internally[3] and released an open-sourced part of the Blaze tool as Bazel, named as an anagram of Blaze.[4] Bazel was first released in March 2015 and achieved beta status by September 2015.[5]

Bazel
Developer(s)Google
Initial releaseMarch 2015
Stable release
3.1.0 / 21 April 2020 (2020-04-21)[1]
Repository
Written inJava[2]
Operating systemCross-platform
LicenseApache License 2.0
Websitebazel.build 

Similar to build tools like Make, Apache Ant, or Apache Maven,[2][4] Bazel builds software applications from source code using a set of rules. Rules and macros are created in the Starlark language (previously called Skylark[6]), a dialect of Python.[4] There are built-in rules for building software written in the programming languages of Java, C, C++, Go, Python, Objective-C and Bourne shell scripts.[4][5] Bazel can produce software application packages suitable for deployment for the Android and iOS operating systems.[7]

In designing Bazel, emphasis has been placed on build speed, correctness, and reproducibility.[2][4] The tool uses parallelization to speed up parts of the build process.[4] It includes a Bazel Query language that can be used to analyze build dependencies in complex build graphs.[4]

Rationale

One of the goals of Bazel is to create a build system where build target inputs and outputs are fully specified and therefore precisely known to the build system.[7] This allows a more accurate analysis and determination of out-of-date build artifacts in the build system's dependency graph. Making the dependency graph analysis more deterministic leads to potential improvements in build times by avoiding re-executing unnecessary build targets. Build reliability is improved by avoiding errors where build targets might depend on out-of-date input artifacts.

To achieve more accurate dependency graph analysis, Bazel uses content digests rather than file-based timestamps. File timestamps are commonly used to detect changes in tools like Make or Apache Ant. Timestamps can be problematic when builds are distributed across multiple hosts due to issues with clock synchronization.[8] One of Bazel's goals is to enable distributed and parallel builds on a remote cloud infrastructure. Bazel is also designed to scale up to very large build repositories which may not be practical to download to an individual developer's work machine.[9]

Bazel provides tooling which helps developers to create bit-identical reproducible build outputs. Bazel's implemented rules avoid typical pitfalls such as embedding timestamps in generated outputs to ensure content digest matches. This in turn allows the build system to reliably cache (memoize) the outputs of intermediate build steps. Furthermore, reproducible build makes it possible to share intermediate build results between teams or departments in an organization, using dedicated build servers or distributed caches. Bazel therefore is particularly well-suited for larger organizations and software projects that have significant number of build dependencies. A deterministic build and an ability to precisely analyze build input and output artifacts across the dependency graph lends itself to parallel execution of build steps.

Bazel is extensible with its custom Starlark programming language. Starlark uses a syntax which is a subset of the syntax of the Python programming language. Starlark however doesn't implement many of Python's language features, such as ability to mutate collections or access the file I/O, in order to avoid extensions that could create side-effects or create build outputs not known to the build system itself. Such side-effects could potentially lead to incorrect analysis of the build dependency graph.

Bazel was designed as a multi-language build system. Many commonly used build system are designed with a preference towards a specific programming language. Examples of such systems include Ant and Maven for Java, Leiningen for Clojure, sbt for Scala, etc. In a multi-language project, combining separate build systems and achieving the build speed and correctness benefits described above can be difficult and problematic.

Bazel also provides sand-boxed build execution. This can be used to ensure all build dependencies have been properly specified and the build does not depend, for example, on libraries installed only locally on a developer's work computer. This helps to ensure that builds remain portable and can be executed in other (remote) environments.

Build systems most similar to Bazel are Pants,[10] Buck, and Please.[11][12] Pants and Buck both aim for similar technical design goals as Bazel and were inspired by the Blaze build system used internally at Google. Blaze is also the predecessor to Bazel. Bazel, Pants, Buck, and Please adopted Starlark as BUILD file parser, respective its BUILD file syntax. Independently developed build systems with similar goals of efficient dependency graph analysis and automated build artifact tracking have been implemented in build systems such as tup.[13]

Old Bazel logo

Since Bazel's initial release the logo was a green letter "b" stylized into a stem of a basil plant with two leaves.

On July 5, 2017, the Bazel Blog announced a new logo,[14] consisting of three green building blocks arranged to shape a heart.

gollark: <@!340622484674052096>
gollark: <@!340622484674052096>
gollark: <@!340622484674052096>
gollark: t!weather Core of Sun
gollark: t!weather Sun

See also

References

  1. "Releases ยท bazelbuild/bazel". GitHub.
  2. Yegulalp, Serdar (Sep 11, 2015). "Google open-sources language-agnostic, scalable software tool". InfoWorld. Archived from the original on 25 October 2017. Retrieved 25 June 2016.
  3. Beyer, Betsy; Jones, Chris; Petoff, Jennifer; Murphy, Niall Richard. Site Reliability Engineering: How Google Runs Production Systems. "O'Reilly Media, Inc.". p. 90. ISBN 9781491951187. Retrieved 25 June 2016.
  4. Bolton, David (27 April 2015). "Bazel, Google's Open Source Build System - The New Stack". thenewstack.io. The New Stack. Archived from the original on 24 October 2017. Retrieved 25 June 2016.
  5. Daws, Ryan. "Google's software build tool Bazel heads into beta". www.developer-tech.com. Developer Tech. Archived from the original on 23 October 2017. Retrieved 25 June 2016.
  6. "Starlark - Bazel". blog.bazel.build. Retrieved 2018-10-18.
  7. "FAQ - Bazel". bazel.build. Retrieved 25 June 2016.
  8. "What's Wrong With GNU make?".
  9. Nathan York (23 September 2011). "Build in the Cloud: Distributing Build Steps". google-engtools.blogspot.com.
  10. "Pants: A fast, scalable build system".
  11. "Buck: A high-performance build tool".
  12. Please FAQ
  13. Mike Shal (2009). "Build System Rules and Algorithms" (PDF).
  14. Steren Giannini (5 July 2017). "A new logo and homepage for Bazel".
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.