Move more build logic to the core generation module