Moved generation logic to beforeBuildFinish event (fixes #13)