Buck2, the new Facebook build system

Buck2-Hero

Buck2, Facebook's new open source build system

Facebook introduced recently released a new build system called "Buck2", which notes that it is focused on building projects from repositories . large ones that include code in different languages programming.

The differences between the new implementation and the system previously used buck By facebook are using Rust language instead of Java and a significant increase in the efficiency and performance of the assembly process (in internal tests on the same infrastructure, Buck2 performs assembly tasks twice as fast as Buck).

Build systems stand between a developer and their code running, so anything we can do to make the experience faster or more productive directly affects how effective a developer can be. The goal for Buck2 was to keep what we loved about Buck1 (the basics and workflows), take inspiration from post-Buck1 innovations (including Bazel, Adapton, and Shake), and focus on speed and enabling new experiences.

About Buck2

It is highlighted that the system is not tied to the creation of code in specific languages and out of the box, it supports builder projects written in C++, Python, Rust, Kotlin, Erlang, Swift, Objective-C, Haskell, and OCaml used by Facebook.

The Starlark language, based on Python (as in Bazel), is used to design plugins, create 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.

It is mentioned that high performance is achieved by caching the results, parallelization of work and support for remote execution of tasks (Remote Build Execution).

The build environment uses the concept of "hermeticity": the compiled code is detached from the outside world, nothing is loaded from the outside during the build process, and repeated execution of the job on different systems leads to the same result (repeated builds, for example, the result of compiling a project on the machine from the developer will be exactly the same as the build on the continuous integration server). The lack of dependency situation is perceived in Buck2 as a bug.

On the part of the Buck2 Key Features, the following stand out:

  • The rules for supporting programming languages ​​and the core build system are completely separate. 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 (no staging), which allows you to increase the depth of parallelization of work compared to Buck and Bazel and avoid many kinds of bugs.
  • Buck2's code posted on GitHub and the programming language support rules are almost identical to the internal version used in Facebook's infrastructure (the only differences are in the link to compiler editions and build servers used by Facebook). ).
  • The build system is designed to integrate 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, the work is carried out with the real local portion of a part of the repository (the developer sees the entire repository, but only what is required) files accessed are retrieved from the repository). EdenFS-based VFS and Git LFS are supported, which are used by Sapling.

Finally, for those interested in being able to learn more about it, they should know that the code is distributed under the Apache 2.0 license and they can consult the details In the following link.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.