buildShards

internal fun buildShards(stale: List<Shard>, out: Map<Shard, File>, ctx: OverlayBuild): Int

Build every stale shard in parallel; returns the classes written across all of them.

One worker per SHARD, not per jar: each shard is its own file, so writes never contend. Largest first, which puts the environment shard (the only one with many members) at the front so its tail runs alongside the others instead of after them. Reserve 2 cores for the game.