Batch

Despite being smart at task scheduling and caching, Terrabuild can’t always beat compiler optimizations when doing batch builds.

For example, .NET is able to build a whole solution and optimize how to restore and build dependencies. However, for that, you need to build and maintain a solution file. Also, you can’t easily build a subset of this solution file.

To have the best of both worlds, Terrabuild supports batch builds and delegates the build to dedicated commands. To support this feature, clusters are created from the build graph when:

  • All commands used in a target support batch mode
  • Commands are exactly the same across targets
  • Targets are part of the same dependency chain

Once clusters are identified, Terrabuild asks extensions to craft dedicated batch commands. This way you do not need to maintain a solution file and you can benefit from faster builds transparently.

You can configure targets to build when their parent must build, even if the target itself could be restored from cache. This is particularly useful in clusters when it’s faster to build as part of a batch operation than to restore individually. To use this feature, set build to ~cascade in your target configuration.

ℹ️
Batch support must be enabled per extension using the batch attribute on extensions.
Last updated on