Facebook has announced its new assembly system called “buck2”, which is focused on organizing the assembly of projects from very large repositories, including different programming languages. This new system is significantly different from its predecessor “buck” which used Java, it uses Rust and has a significant increase in the efficiency and performance of the assembly process. In internal tests performed on the same infrastructure, Buck2 performed assembly tasks faster than Buck. The code is distributed under the license Apache 2.0.
Buck2 is not tied to the assembly of code in specific languages, it supports projects written in C ++, Python, Rust, Kotlin, Erlang, Swift, Objective-C, Haskell and Ocaml that are used on Facebook. The system uses the “Starlark” language based on Python (as in Bazel) to make additions for assembly scenarios and rules. Starlark allows the system to expand its capabilities and abstract from specific languages used in collected projects.
Buck2 has achieved high productivity through caching results, parallelization of work and supporting remote tasks (Remote Build Execution). In the assembly environment, Buck2 applies the concept of “gemitivity”. The assembled code is cut off from the outside world, nothing is loaded from the outside during the assembly process, and the same result is obtained during repeated work on different systems. The lack of dependence is perceived in Buck2 as an error.
The key features of Buck2 include the separation of rules for supporting programming languages and the core of the assembly system, the use of a unified incidental graph of dependencies, and its code is identical to the internal version used in the Facebook infrastructure. The only differences to the editorial office of compilers and assembly servers used on Facebook.
The Buck2 code and rules for supporting programming languages are available on Github. Users can take advantage of the benefits that Buck2 offers, such as expanding capabilities and abstracting from specific programming languages. With its high productivity, this new assembly system can improve the efficiency and performance of large repositories in different industries.