Buck is a cross-platform, cross-language build system made for large scale compilation at Facebook. All Buckaroo packages use Buck as a build system, so it goes without saying that we’re big fans.
However, even if you’re not at Facebook scale, here are 7 reasons that we think you should give Buck a try.
Buck is not just a hobbyist project that might become unsupported when the creator loses interest. It is used in production at Facebook, Uber and Dropbox, to name a few. On top of that, many of the Buck team are ex-Google, where they worked on Blaze, the closed-source predecessor to Buck (and Bazel). Buck is the culmination of a huge amount of knowledge about build systems.
Have you ever deleted your build folder just in case? Buck copies (or symlinks) source-files into a staging area before compilation so that dependencies are sandboxed. Every build input (headers, flags and the environment) is used as a cache key for the build artefacts. This disciplined approach means that Buck can give you correct incremental builds, every time.
For C/C++, Buck allows you to separate the exported headers (headers available to users of your library) from private headers (headers used to build your library). This is a huge win for modularity in C/C++ code, since it prevents other modules from reaching behind your API.
Buck knows when to rebuild a target by the hashes of its inputs. This means less developer time gets wasted with unnecessary rebuilds because you touched, but did not change, a file. Buck works incredibly well with branching VCS, such as Git.
Anyone who has worked with CMake will understand the frustration of working with with a subpar scripting language. Buck does not reinvent the wheel and instead uses Python for build scripts.
However, Buck uses Python in a controlled way. The Python scripts are used to generate the build targets, rather than execute the build itself. This allows Buck to execute the Python code in a single thread but afterwards perform the build in parallel. As an added bonus, this means that the result of the Python can be cached.
Buck understands the dependency graph of your project, allowing it to build independent artefacts in parallel. However, unlike make -j4
, Buck is always deterministic. You can even share incremental compilation results across your team using Buck Server.
Perhaps the best feature of Buck is that build files are easy to reason about. Each target can only use the dependencies it declares, dependency cycles are not allowed and recursion between build outputs is impossible.
Even if you have never used Buck before, you can probably make sense of this:
Head over to the Buck website to get started.
(Even) More Reasons to Use Buck Build_Excellent Precompiled Header Support_medium.com
Getting Started with Buck build on Travis CI_Travis CI is a service that offers free build servers for open-source projects (thanks, VCs!). It has tight integration…_hackernoon.com
Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.
To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!