Refactor gradle build