What are the differences between Bazel and Gradle?

Google just opened its Bazel build tool . What is the difference between this tool and Gradle? What can he do, that Gradle cannot, what he is doing better, and what makes Gradle better?

+73
build-process gradle build-tools bazel
Mar 25 '15 at 1:06
source share
2 answers

Disclaimer: I am working on Bazel and I am not familiar with Gradle. However, one of my colleagues wrote a comparison of two systems, which I rephrase here:

Bazel and Gradle highlight various aspects of the build experience. To some extent, their priorities are incompatible - the desire for flexibility and unobtrusiveness limits the restrictions that he can set on the assembly structure, while the desire for Basel's reliability and performance necessarily requires limitations that are not negotiable.

Gradle follows the same principles as Bazel, i.e. The Gradle team pays great attention to performance (incremental assemblies, parallel configuration and execution, the Gradle daemon), correctness (content- (rich support for declarative syntax, dependency version control, explicitly declared dependencies). And Basel respects the need for flexible project layouts.

The caveat is that Gradle wants to promote good practice, while Bazel wants to demand it. Gradle is aimed at the middle between the Ant experience (the freedom to define your own project structure with incoherent results) and the Maven experience (applied best practices that are not possible for the various needs of the project). Bazel believes that flexible project support is possible without compromising strong guarantees that enable its powerful workflows.

No philosophy is more “correct” - whatever tool is best suited to the project depends on the specific meanings of the projects.

Gradle Review

Gradle is a very flexible system that allows users to create complete and reliable assembly threads with minimal restrictions on how they organize their projects. It does this by delivering powerful building blocks (like auto-tracking and dependency extraction, tightly integrated plug-in support) with a universal Turing scripting interface that can combine these blocks, however users want to.

Gradle highlights the following features:

  • Easy migration from other systems. Gradle easily accommodates any project organization to easily implement arbitrary workflow structures. He initially understands Ant's tasks and integrates initially with Maven and Ivy repositories.
  • Highly developed screenwriting model. Users implement all the build logic by writing Groovy scripts. “Build” is simply the execution of sequences of common tasks that depend on dependencies, which are essentially open, redefinable, extensible method definitions.
  • Rich dependency management. Validated dependencies can be declared and automatically organized from external code repositories, local file systems, and other Gradle projects. Assembly outputs can also be automatically published to repositories and other places.
  • A tightly integrated plugin system. Plugins are simply task pools organized to facilitate the desired workflow. Many of the core functions of Gradle s "core" are actually implemented through plugins (for example, Java, Android). Plugins interact (at their discretion) with the logic of the build script. Plugins have deep access to the underlying Gradle data structures.

Bazel Review

Bazel arose because of the need for reliable and efficient creation of internal Google projects. Because the Googles development environment is unusually large and complex, Bazel offers unusually strong guarantees of the integrity of its assemblies and unusually low performance when they are reached.

This provides the basis for powerful development workflows based on reproducible assemblies, where the "assembly" becomes an abstract entity that can be referenced, repeated, transferred to different machines and transferred to arbitrary programs and services, so each instance is known to be exactly same thing.

Bazel highlights the following features:

  • Correctness. Bazel designs are designed to always produce the right output, period. If two users invoke the same assembly with the same commit with the same Bazel flags on different machines, they will see the same results. Incremental assemblies are just as reliable as clean assemblies, which makes them essentially unnecessary.
  • Performance. The assembly is designed to run as fast as possible, based on available resources. Tasks are as parallelizable as their dependency networks allow. Unnecessary work is never performed (i.e., “Modern” tasks are always skipped). Naturally, work on remote artists can be performed to overcome local restrictions on machines.
  • reproducibility. Any instance of an assembly can be accurately reproduced in any environment. For example, if an error report says that version X of software Y does not work in production environment Z, the developer can confidently recreate it on his own machine with the confidence that they are debugging the same thing.
+80
Mar 31 '15 at 14:31
source share

As links to articles tend to die, here is a summary of Gradle Team views on Bazel (most of them are directly taken from an article that was published in March 2015):

It was designed to solve a problem unique to Google; massive monolithic code base (hundreds of millions of LOC).

The benefit of parallelization that Bazel currently provides will be consistent with “our new configuration and component model” (see article date here).

Bazel does not have a high-level declarative build language, which makes the build easy to use for developers. At Google, this can be offset by a dedicated service team that owns the build tool.

Bazel is not designed for extensibility (although the Bazel development team has since objected to this, assuring that they are working on extensibility).

Speed ​​is optimized around the idea that all transitive dependencies are stored in one large repo; all libraries and tools are checked in this central repository. Most enterprises have more distributed dependency management requirements.

Bazel is only * nix, it does not work on Windows. This eliminates a large number of potential Enterprises.

Lack of plugin ecosystem.

+24
May 17 '16 at 11:07
source share



All Articles