This functionality already exists written by Tim Ward. Unfortunately at the moment it is only in the form of a Maven plugin. Tim tells me there is already a plan for a Gradle plugin as well.