Facebook published the Buck2 build system

Facebook has introduced a new build system, Buck2, focused on building projects from very large repositories that include code in different programming languages. The key differences between the new implementation and the Buck system previously used by Facebook are the use of the Rust language instead of Java and a significant increase in the efficiency and performance of the assembly process (in internal tests in the same infrastructure, Buck2 performs assembly tasks twice as fast as Buck). The code is distributed under the Apache 2.0 license.

The system is not tied to building code in specific languages ​​and out of the box supports building projects written in C++, Python, Rust, Kotlin, Erlang, Swift, Objective-C, Haskell and OCaml used by Facebook. The Starlark language based on Python (like in Bazel) is used to design add-ons, build scripts and rules. Starlark allows you to extend the capabilities of the build system and abstract from the specific languages ​​used in the projects being built.

High performance is achieved through caching of results, parallelization of work and support for remote execution of tasks (Remote Build Execution). In the build environment, the concept of "tightness" is used - the compiled code is cut off from the outside world, nothing is loaded from the outside during the build process, and repeated execution of work on different systems leads to the same result (repeated builds, for example, the result of building a project on the developer's machine will be exactly the same as the build on the continuous integration server). The situation of lack of dependence is perceived in Buck2 as a mistake.

Buck2 key features:

  • The rules for supporting programming languages ​​and the core of the build system are completely separated. The rules are written in the Starlark language, and the Starlark toolkit and implementation are written in Rust.
  • The build system uses a single incremental dependency graph (without division into stages), which allows you to increase the depth of parallelization of work compared to Buck and Bazel and avoid many types of errors.
  • The Buck2 code published on GitHub and the programming language support rules are almost identical to the internal version used in the Facebook infrastructure (the only differences are in binding to the compiler editions and build servers used by Facebook).
  • The build system is designed with an eye to integration with remote job execution systems that allow you to run jobs on remote servers. The remote execution API is compatible with Bazel and has been tested for compatibility with Buildbarn and EngFlow.
  • Integration with virtual file systems is provided, in which the contents of the entire repository are presented, but in fact, work is carried out with the actual local slice of a part of the repository (the developer sees the entire repository, but only the required files that are accessed are retrieved from the repository). Supported are VFS based on EdenFS and Git LFS, which are used by Sapling.

Source: opennet.ru

Add a comment