Skip to content

Instantly share code, notes, and snippets.

@mlabbe
Last active August 25, 2017 19:50
Show Gist options
  • Select an option

  • Save mlabbe/4165255a3fbec3a76dfc18d997e4a1bf to your computer and use it in GitHub Desktop.

Select an option

Save mlabbe/4165255a3fbec3a76dfc18d997e4a1bf to your computer and use it in GitHub Desktop.
Build system thoughts

Feast

Existing makefile-like build systems conflate what we are building with how we are building it. Every project has its own Makefile, autoconf, vsproj, etc., which explain how to build it, and where the files are.

In reality, many simple projects build exactly the same way. That way may involve complex steps, but rarely do they differ meaningfully. It does not make sense to write out a different recipe every time you buy groceries, so why should you re-describe how a project builds every time you begin a new, similar project?

Components of Feast Defined

  • Feast: A completed set of build products.
  • Kitchen: A tool environment (ex: vs2015 64-bit on Windows 10).
  • Dish: A single completed build product.
  • Recipe: Software that determines how to create one build product from multiple prepared ingredients.
  • Prepared Ingredient: A built intermediate unit, as defined by the recipe's needs.
  • Raw Ingredient: Human editable raw file.
  • Chef: Software that builds raw ingredients into dishes.

Key features of Feast

Feast will be an ABI-stable C library first and a command line executable second. This lets you optionally integrate Feast into your GUI tools instead of being forced to choose between an IDE-native build system and a command line prompt.

Feast will use OS system calls and native threads on Windows, Mac and Linux to provide optimal cross-platform building.

While all build systems produce a single completed build product (a "Dish" in Feast nomenclature), only a few support the building of individual compilation units ("Prepared Ingredients"). Even fewer support the automatic refreshing of Prepared Ingredients when they change on disk. Because Recipes are defined separately from the list of Raw Ingredients, it becomes trivial to perform an incremental compile.

If you need to ask your build system to rebuild your project, you have always wasted precious seconds. Feast continuously runs, monitoring Prepared Ingredients for updates.

Sample Recipes

  1. Recipe to run Make: For existing/legacy build systems looking to benefit from Feast's features, it is possible and trivial to write a recipe to wrap a build system. This gets you GUI integration and automatic rebuilding by pointing it at a single Makefile.
  2. Recipe to build a book with LaTeX: Rather than write a Makefile that explains how to compile multiple LaTeX files, how to clean them up, etc., just point them at a single directory of .tex files.
  3. Custom asset cooking for games: Write a recipe to bake your assets, mapping extensions to tools and known build productsn.

Further Design Requirements

  • Recipes must be easy to define. This is a failing of Scons, where you could teach it to do a new thing, but first you must gain access to its source tree and understand API internals.
  • Recipes must self-document. Once the community has created a Recipe, it must be usable by people who did not create it.
  • Dependency checking must be definable in a recipe but be very fast for large projects doing incremental rebuilds with a fresh start.
  • Consider JFDI's API and self-propagating feature as wins to integrate as compatible.
  • Weigh embedding Python with a simplified API in any case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment