Jump to content

Bazel (software)

From Wikipedia, the free encyclopedia
(Redirected from Blaze (software))
Bazel
Developer(s)Google
Initial releaseMarch 2015; 9 years ago (2015-03)
Stable release
8.0.0 / 9 December 2024; 10 days ago (2024-12-09)[1]
Repository
Written inJava[2]
Operating systemCross-platform
LicenseApache License 2.0
Websitebazel.build Edit this on Wikidata

Bazel (/ˈbzəl/[3]) is a free and open-source software tool used for the automation of building and testing software.[2]

Similar to build tools like Make, Apache Ant, and Apache Maven,[2][4] Bazel builds software applications from source code using rules. Rules and macros are created in the Starlark language,[5] a dialect of Python.[4] There are built-in rules for building software written in Java, Kotlin, Scala, C, C++, Go, Python, Rust, JavaScript, Objective-C, and bash scripts.[4][6] Bazel can produce software application packages suitable for deployment for the Android and iOS operating systems.[7]

History

[edit]

In 2006,[8] Google started the development of a build tool called Blaze.[9] The motivation was to have a build system that provides both speed and correctness in a large monorepo.[10]

Bazel was created as an open-source port of Blaze, using its anagram as a name.[4] Bazel was first released in March 2015 and entered beta by September 2015.[6] Version 1.0 was released in October 2019.[11]

Rationale

[edit]

Bazel has been described as "one of the first openly-available cloud build systems". It is able to save the history of previously run commands and share the results across multiple users.[12] To do so, Bazel requires that the inputs and outputs of build targets are fully specified.

Starlark language

[edit]

Bazel is extensible with the Starlark programming language.[13] Starlark is an embedded language whose syntax is a subset of the Python syntax. However, it doesn't implement many of Python's language features, such as the ability to 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.

Languages

[edit]

Bazel was designed as a multilanguage build system. It is able to build software combining multiple programming languages within the same repository.

Many commonly used build systems are designed with a preference for a specific programming language. Examples of such systems include Ant and Maven for Java, Leiningen for Clojure, sbt for Scala, etc. In a repository with multiple languages, combining separate build systems and achieving the build speed and correctness benefits described above can be difficult and problematic.

Relation to other build tools

[edit]

Build systems most similar to Bazel are Pants,[14] Buck,[15] Please,[16] and the Brazil build system used internally at Amazon.[17] Pants and Buck both aim for similar technical design objectives as Bazel, with Pants being inspired by the Blaze build system used internally at Google.

Bazel, Pants, Buck, and Please adopted Starlark as a BUILD file parser, respective to its BUILD file syntax. Independently developed build systems with similar uses in efficient dependency graph analysis and automated build artifact tracking have been implemented in build systems such as tup.[18]

Sandbox

[edit]

Bazel uses a sandbox for compilation steps. When Bazel performs a separate compilation, it creates a new directory and fills it with symlinks to the explicit input dependencies for the rule. For languages like C or C++, this requires the user to be explicit about the dependencies and it prevents the unexpected inclusion of a similarly named header file from another including directory.

This sandbox approach leads to issues with common build tools, resulting in a number of workarounds required to correctly compile code under different architectures. For example, when performing separate compilation for Mac/Darwin architectures, the compiler writes the input paths into SO and OSO symbols in the Mach-O binary, which can be seen with a command like nm -a mybinary | grep SO. These paths are needed for finding symbols during debugging. As a result, builds in Bazel must correct the compiled objects after the fact, trying to correct path-related issues that arose from the sandbox construction using flags like -fdebug-prefix-map and -oso_prefix, the latter having become available in Xcode 11.0. Similar handling needs to take place in linking phases, rewriting the rpath values in shared object libraries with a command like install_name_tool.[19]

[edit]
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,[20] consisting of three green building blocks arranged to shape a heart.

Adoption

[edit]

Bazel is commonly used by companies.[21] A few notable users include Google, SpaceX,[22] Stripe,[23] Tinder,[24] and Uber.[25]

See also

[edit]

References

[edit]
  1. ^ "Releases · bazelbuild/bazel". GitHub.
  2. ^ a b c 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. ^ "FAQ - Bazel". bazel.build. Archived from the original on 2016-11-06.
  4. ^ a b c d 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. ^ "Starlark - Bazel". blog.bazel.build. Retrieved 2018-10-18.
  6. ^ a b Daws, Ryan (10 September 2015). "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.
  7. ^ "FAQ - Bazel". bazel.build. Retrieved 25 June 2016.
  8. ^ Vermeulen, Steve (21 November 2023). "Bazel, From Blaze to Buck2 — A Brief History of Modern Monorepo Build Systems".
  9. ^ Beyer, Betsy; Jones, Chris; Petoff, Jennifer; Murphy, Niall Richard (23 March 2016). Site Reliability Engineering: How Google Runs Production Systems. "O'Reilly Media, Inc.". p. 90. ISBN 9781491951187. Retrieved 25 June 2016.
  10. ^ Winters, Titus; Manshreck, Tom; Wright, Hyrum. Software Engineering at Google. O'Reilly. p. 372.
  11. ^ "Bazel 1.0". blog.bazel.build. Retrieved 2023-10-29.
  12. ^ Mokhov, Andrey and Mitchell, Neil and Peyton Jones, Simon (2018). "Build Systems à la Carte". Proceedings of the ACM on Programming Languages. 2 (ICFP): 1–29. doi:10.1145/3236774.{{cite journal}}: CS1 maint: multiple names: authors list (link)
  13. ^ "Starlark Language". bazel.build.
  14. ^ "Pants: A fast, scalable build system".
  15. ^ "Buck: A high-performance build tool".
  16. ^ Please FAQ
  17. ^ Amazon's Build System
  18. ^ Shal, Mike (2009). "Build System Rules and Algorithms" (PDF).
  19. ^ "tools/cpp/osx_cc_wrapper.sh". Github. 5 February 2022.
  20. ^ Giannini, Steren (5 July 2017). "A new logo and homepage for Bazel".
  21. ^ "Who's Using Bazel".
  22. ^ "Building Real-time Systems with Bazel w/ SpaceX". 11 December 2017 – via YouTube.
  23. ^ "Fast builds, secure builds. Choose two". 4 May 2022.
  24. ^ "Bazel Hermetic Toolchain and Tooling Migration". 13 June 2022.
  25. ^ https://www.uber.com/en-DE/blog/go-monorepo-bazel/
[edit]