Skip to content

Commit

Permalink
Remove need to manually set wrapper GRADLE_OPTS
Browse files Browse the repository at this point in the history
Replace the wrapper task with a variant that automatically adds the
appropriate GRADLE_OPTS to the shell and bat files.
  • Loading branch information
philwebb committed Nov 1, 2012
1 parent 00220eb commit 23b091b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -805,3 +805,12 @@ configure(rootProject) {
}
}

def defaultWrapper = tasks["wrapper"]
task wrapper(overwrite: true, dependsOn: defaultWrapper) << {
def gradleOpts = "-XX:MaxPermSize=1024m -Xmx1024m -XX:MaxHeapSize=256m"
File wrapperFile = file('gradlew')
wrapperFile.text = wrapperFile.text.replace("DEFAULT_JVM_OPTS=", "GRADLE_OPTS=\"$gradleOpts \$GRADLE_OPTS\"\nDEFAULT_JVM_OPTS=")
File wrapperBatFile = file('gradlew.bat')
wrapperBatFile.text = wrapperBatFile.text.replace("set DEFAULT_JVM_OPTS=", "set GRADLE_OPTS=$gradleOpts %GRADLE_OPTS%\nset DEFAULT_JVM_OPTS=")
}

0 comments on commit 23b091b

Please sign in to comment.