K. D.
K. D.

Reputation: 4219

Gradle "private" configuration per developer

For local development our developers should be able to define a task (copying the final jar into a specific directory) with a custom configuration. Some people do not need this task so we don't want to put it into our build.gradle.

Is it possible to add any "custom" configuration to a gradle project so that we can simply ignore a file in our CVS? If not, what could be good way to go?

Upvotes: 1

Views: 108

Answers (1)

judoole
judoole

Reputation: 1422

Something along these lines could work:

def username = System.getProperty('user.name')
def userGradleScript = file("gradle/user/${username}.gradle")
if (!userGradleScript.exists()) {
    //Create a file from template and replace %username% in file
    userGradleScript.write(file('gradle/user/template.gradle').text.replaceAll('%username%', username))
}
apply from: userGradleScript

Upvotes: 1

Related Questions