Bazel (software): Difference between revisions
m Updated date of last stable release. |
→top: update latest release & pronunciation |
||
Line 8: | Line 8: | ||
| developer = [[Google]] |
| developer = [[Google]] |
||
| released = {{Start date and age|2015|03}} |
| released = {{Start date and age|2015|03}} |
||
| latest release version = |
| latest release version = 5.0.0 |
||
| latest release date = {{Start date and age| |
| latest release date = {{Start date and age|2022|01|19|df=yes}}<ref name="Releases">{{cite web|title=Releases · bazelbuild/bazel|url=https://github.com/bazelbuild/bazel/releases|website=[[GitHub]]}}</ref> |
||
| latest preview version = |
| latest preview version = |
||
| latest preview date = |
| latest preview date = |
||
Line 18: | Line 18: | ||
}} |
}} |
||
'''Bazel''' ({{IPAc-en|ˈ|b| |
'''Bazel''' ({{IPAc-en|ˈ|b|eɪ|z|əl}}<ref>https://bazel.build/faq.html#how-do-you-pronounce-bazel</ref>) is a [[free software]] tool for the automation of building and testing of software.<ref name="Yegulalp">{{cite journal|last1=Yegulalp|first1=Serdar|title=Google open-sources language-agnostic, scalable software tool|journal=InfoWorld|date=Sep 11, 2015|url=https://www.infoworld.com/article/2983495/development-tools/google-open-sources-language-agnostic-scalable-software-tool.html|access-date=25 June 2016|archive-url=https://web.archive.org/web/20171025022213/https://www.infoworld.com/article/2983495/development-tools/google-open-sources-language-agnostic-scalable-software-tool.html|archive-date=25 October 2017|url-status=live}}</ref> The company [[Google]] uses the build tool ''Blaze'' internally<ref name="Beyer">{{cite book|last1=Beyer|first1=Betsy|last2=Jones|first2=Chris|last3=Petoff|first3=Jennifer|last4=Murphy|first4=Niall Richard|title=Site Reliability Engineering: How Google Runs Production Systems|date=23 March 2016|publisher="O'Reilly Media, Inc."|isbn=9781491951187|page=90|url=https://books.google.com/books?id=_4rPCwAAQBAJ&q=Bazel+build&pg=PA90|access-date=25 June 2016|language=en}}</ref> and released an open-sourced part of the Blaze tool as Bazel, named as an [[anagram]] of Blaze.<ref name="Bolton">{{cite web|last1=Bolton|first1=David|title=Bazel, Google's Open Source Build System - The New Stack|url=https://thenewstack.io/bazel-googles-open-source-build-system/|website=thenewstack.io|publisher=The New Stack|access-date=25 June 2016|date=27 April 2015|archive-url=https://web.archive.org/web/20171024153418/https://thenewstack.io/bazel-googles-open-source-build-system/|archive-date=24 October 2017|url-status=live}}</ref> Bazel was first released in March 2015 and achieved beta status by September 2015.<ref name="Daws">{{cite web|last1=Daws|first1=Ryan|title=Google's software build tool Bazel heads into beta|url=https://www.developer-tech.com/news/2015/sep/10/googles-software-build-tool-bazel-heads-beta/|website=www.developer-tech.com|publisher=Developer Tech|access-date=25 June 2016|archive-url=https://web.archive.org/web/20171023140229/https://www.developer-tech.com/news/2015/sep/10/googles-software-build-tool-bazel-heads-beta/|archive-date=23 October 2017|url-status=live}}</ref> |
||
Similar to build tools like [[Make (software)|Make]], [[Apache Ant]], or [[Apache Maven]],<ref name="Yegulalp" /><ref name="Bolton" /> Bazel builds [[software application]]s from [[source code]] using a set of rules. Rules and [[macro (computer science)|macro]]s are created in the [https://docs.bazel.build/versions/master/skylark/language.html Starlark] language (previously called Skylark<ref>{{Cite web|url=https://blog.bazel.build/2018/08/17/starlark.html|title=Starlark - Bazel|website=blog.bazel.build|language=en|access-date=2018-10-18}}</ref>), a dialect of [[Python (programming language)|Python]].<ref name="Bolton" /> There are built-in rules for building software written in the [[programming language]]s of [[Java (programming language)|Java]], [[C (programming language)|C]], [[C++]], [[Go (programming language)|Go]], [[Python (programming language)|Python]], [[Objective-C]] and [[Bourne shell]] scripts.<ref name="Bolton" /><ref name="Daws" /> Bazel can produce software application packages suitable for deployment for the Android and iOS operating systems.<ref name="FAQ">{{cite web|title=FAQ - Bazel|url=https://bazel.build/faq.html|website=bazel.build|access-date=25 June 2016}}</ref> |
Similar to build tools like [[Make (software)|Make]], [[Apache Ant]], or [[Apache Maven]],<ref name="Yegulalp" /><ref name="Bolton" /> Bazel builds [[software application]]s from [[source code]] using a set of rules. Rules and [[macro (computer science)|macro]]s are created in the [https://docs.bazel.build/versions/master/skylark/language.html Starlark] language (previously called Skylark<ref>{{Cite web|url=https://blog.bazel.build/2018/08/17/starlark.html|title=Starlark - Bazel|website=blog.bazel.build|language=en|access-date=2018-10-18}}</ref>), a dialect of [[Python (programming language)|Python]].<ref name="Bolton" /> There are built-in rules for building software written in the [[programming language]]s of [[Java (programming language)|Java]], [[C (programming language)|C]], [[C++]], [[Go (programming language)|Go]], [[Python (programming language)|Python]], [[Objective-C]] and [[Bourne shell]] scripts.<ref name="Bolton" /><ref name="Daws" /> Bazel can produce software application packages suitable for deployment for the Android and iOS operating systems.<ref name="FAQ">{{cite web|title=FAQ - Bazel|url=https://bazel.build/faq.html|website=bazel.build|access-date=25 June 2016}}</ref> |
Revision as of 13:54, 27 January 2022
This article contains promotional content. (October 2019) |
Developer(s) | |
---|---|
Initial release | March 2015 |
Stable release | 5.0.0
/ 19 January 2022[1] |
Repository | |
Written in | Java[2] |
Operating system | Cross-platform |
License | Apache License 2.0 |
Website | bazel |
Bazel (/ˈbeɪzəl/[3]) is a free software tool for the automation of building and testing of software.[2] The company Google uses the build tool Blaze internally[4] and released an open-sourced part of the Blaze tool as Bazel, named as an anagram of Blaze.[5] Bazel was first released in March 2015 and achieved beta status by September 2015.[6]
Similar to build tools like Make, Apache Ant, or Apache Maven,[2][5] Bazel builds software applications from source code using a set of rules. Rules and macros are created in the Starlark language (previously called Skylark[7]), a dialect of Python.[5] 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.[5][6] Bazel can produce software application packages suitable for deployment for the Android and iOS operating systems.[8]
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.[8] 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.[excessive detail?] Timestamps can be problematic when builds are distributed across multiple hosts due to issues with clock synchronization.[9] 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.[10]
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.
Starlark language
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,[11] Buck, and Please.[12][13] 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.[14]
Sandbox
One of the key features that differentiate Bazel from other build systems is the use of a sandbox for compilation steps. When Bazel performs separate compilation, it creates a new directory and fills it with symlinks to the explicit input dependencies for the rule. For languages like C/C++, this provides a significant safety net for the inclusion of header files: it ensures that the developer is aware of the files that are used in compilation, and it prevents the unexpected inclusion of a similarly named header file from another include 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
.[15]
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,[16] consisting of three green building blocks arranged to shape a heart.
See also
References
- ^ "Releases · bazelbuild/bazel". GitHub.
- ^ 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.
- ^ https://bazel.build/faq.html#how-do-you-pronounce-bazel
- ^ 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.
- ^ 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.
- ^ a b 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.
- ^ "Starlark - Bazel". blog.bazel.build. Retrieved 2018-10-18.
- ^ a b "FAQ - Bazel". bazel.build. Retrieved 25 June 2016.
- ^ "What's Wrong With GNU make?".
- ^ York, Nathan (23 September 2011). "Build in the Cloud: Distributing Build Steps". google-engtools.blogspot.com.
- ^ "Pants: A fast, scalable build system".
- ^ "Buck: A high-performance build tool".
- ^ Please FAQ
- ^ Shal, Mike (2009). "Build System Rules and Algorithms" (PDF).
- ^ "tools/cpp/osx_cc_wrapper.sh". Github.
- ^ Giannini, Steren (5 July 2017). "A new logo and homepage for Bazel".