Bazel is a build tool like maven and Gradel. you can use it to build and test software in any size quickly and reliably. Google built Bazel internally and named it Blaze. Bazel is the current open-source version. It seems to be starting to get pretty popular now in the industry.
Bazel is generally used in very large projects in big companies, where they keep all of the projects together for various reasons. It is not generally used for people’s projects and personal projects.
Different companies use Bazel to build multiple different languages. The current version is scalable and can be extended.
Benefits of using Bazel
It’s helpful to build high-level language like human readable language to describe the build properties of your project. Unlike other tools, Bazel works on the concepts of libraries, binaries, scripts, and data sets, which you don’t need to write separately like Compiler and Linker.
Bazel chases all previously done work and tracks changes in file content and builds commands. If something needs to be rebuilt Bazel will identify it and perform action accordingly. So, it makes your program, script, and project faster.
Bazel is a multi-platform tool it can run on any platform. Its runs on Linux, macOS, and Windows. Bazel can build deployed packages for multiple platforms like desktop, server, and mobile from the same project. It works with multiple repositories and user bases in the tens and thousands. Bazel support many languages. And you can extend Bazel to support any other language or framework.
Programming languages supported by Bazel
‘Bazel to build’ working process
When running a build or a test, Bazel does the following:
- Loads the
BUILDfiles relevant to the target.
- Analyzes the inputs and their dependencies applies the specified build rules and produce an action graph.
- Executes the build actions on the inputs until the final build outputs are produced.
All the previous build work is stored in the form of cache files, Bazel can identify and reuse cached artifacts and only rebuild or retest what’s changed. To further enforce correctness, you can set up Bazel to run builds and tests hermetically through sandboxing, minimizing skew, and maximizing reproducibility.