Site icon Tutorial

Bazel Compiler

Go back to Tutorial

Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. It uses a human-readable, high-level build language. Bazel supports projects in multiple languages and builds outputs for multiple platforms. Bazel supports large codebases across multiple repositories, and large numbers of users.

Bazel offers the following advantages:

Bazel Internals

When running a build or a test, Bazel does the following:

Since all previous build work is cached, 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.

What is the action graph?

The action graph represents the build artifacts, the relationships between them, and the build actions that Bazel will perform. Thanks to this graph, Bazel can track changes to file content as well as changes to actions, such as build or test commands, and know what build work has previously been done. The graph also enables you to easily trace dependencies in your code.

Using Bazel

To build or test a project with Bazel, you typically do the following:

In addition to building, you can also use Bazel to run tests and query the build to trace dependencies in your code.

Command-Line Reference

bazel [<startup options>] <command> [<args>]

or

bazel [<startup options>] <command> [<args>] — [<target patterns>]

Commands

Go back to Tutorial

Exit mobile version