At the highest level, Bazel’s core philosophy is a trade-off:
You provide
Bazel requires a description of your code and its dependencies in BUILD
files. You’ll see that these can be largely automated, but they are checked into version control, and developers sometimes need to read or edit them.
It also requires plugins called a “rule set” to teach it what to do with those descriptions. These rules, in turn, know how to fetch existing build tools like compilers or code generators.
You get
Provided with BUILD
files, Bazel constructs a dependency graph. It uses that to create a lazy transformation from your source tree to a bazel-out/
folder containing the requested build outputs. Test results are modeled as outputs too. The output folder is then continually updated as the sources are changed, but doing as little work as possible.