Meta has released its Buck2 build system under the MIT open source license, InfoWorld reports. Buck2 is written in the Rust programming language and is designed to make the build process faster and more efficient. The company says the system is used by thousands of developers at Meta and performs millions of builds per day.
Buck2 can be accessed from GitHub or from the Buck2 website. The system can build software written in any language, and can build software written in many languages simultaneously. For example, if developers have a Python binary that imports a Rust library that depends on an OCaml library that depends on a C file, Buck2 can help them, Meta says.
For each language, a generic rule should be written that describes what it means to compile in that particular language and how standard features such as testing, starting, and linking with C are provided. Buck2 ships ready-made with rules for Assembly, C/C++, Erlang, Go, Haskell, Java, JavaScript, Julia, OCaml, Python, and Rust. Developers can use the Starlark scripting language, a dialect of Python, to add or re-implement language rules to Buck2.
Buck2 is a completely rewritten Buck, with a separation of kernel and language-specific rules, increased parallelism, integration with remote execution and virtual file systems, and revised console output.
Buck2’s kernel is written in Rust, while language-specific rules, such as how to build C++, are written in Starlark’s Rust implementation. According to Meta, separating the language rules from the kernel makes it easier to change and understand the rules. A single dependency graph powers the build system, eliminating many types of errors and improving parallelism, while the rules API is designed to offer advanced performance features.
Choosing Rust offers advantages such as no breaks for garbage collection, while Java, which Meta used when writing Buck1, offers advantages such as better profiling tools, Meta says. The Buck2 binary is language agnostic.