How Buck WorksBuck has three primary concepts:
- A build rule is a procedure for producing an output file from a set of input files.
- A build target is a string identifier for a build rule. It can be thought of as a "URI" within a project using Buck.
- A build file that defines one or more build rules. In Make, this would be a
Makefile, but in Buck, these files are named
BUCK. A project using Buck is expected to have many
Every build rule can have zero or more dependencies associated with it, or
deps. These dependencies form a directed graph, which Buck requires to be acyclic. When building the output of a build rule, all of the rule's transitive dependencies are built first. This means that the graph is built in a "bottom-up" fashion. A build rule knows only who it depends on, not what depends on it, which makes the build graph easier to reason about. This helps Buck identify independent subgraphs that can be built in parallel, as well as determine the minimal set of build rules that need to be rebuilt.
Buck is designed for building multiple deliverables from a single repository (a monorepo) rather than across multiple repositories. It has been Facebook's experience that maintaining dependencies in the same repository makes it easier to ensure that all developers have the correct version of all of the code, and simplifies the process of making atomic commits.