Skip to content

Commit

Permalink
Improved: Define ‘gradlew’ variable in “build.gradle” only once
Browse files Browse the repository at this point in the history
  • Loading branch information
mthl committed Nov 23, 2019
1 parent d00208c commit 174b924
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Expand Up @@ -74,6 +74,7 @@ apply from: 'common.gradle'


// global properties // global properties
ext.os = System.getProperty('os.name').toLowerCase() ext.os = System.getProperty('os.name').toLowerCase()
ext.gradlew = os.contains('windows') ? 'gradlew.bat' : './gradlew'
ext.pluginsDir = "${rootDir}/plugins" ext.pluginsDir = "${rootDir}/plugins"


application { application {
Expand Down Expand Up @@ -1020,11 +1021,10 @@ def createOfbizBackgroundCommandTask(taskName) {
def sourceTask = taskName.tokenize().first() def sourceTask = taskName.tokenize().first()
def arguments = (taskName - sourceTask) def arguments = (taskName - sourceTask)
def serverCommand = "ofbiz ${arguments}".toString() def serverCommand = "ofbiz ${arguments}".toString()
def gradleRunner = os.contains('windows') ? 'gradlew.bat' : './gradlew'


task (taskName) { task (taskName) {
doLast { doLast {
spawnProcess([gradleRunner, "--no-daemon", serverCommand]) spawnProcess([gradlew, "--no-daemon", serverCommand])
} }
} }
} }
Expand Down Expand Up @@ -1083,7 +1083,5 @@ def taskExistsInproject(fullyQualifiedProject, taskName) {
} }


def gradlewSubprocess(commandList) { def gradlewSubprocess(commandList) {
def gradlew = os.contains('windows') ? 'gradlew.bat' : './gradlew'
exec { commandLine(gradlew, "--no-daemon", *commandList) } exec { commandLine(gradlew, "--no-daemon", *commandList) }
} }

0 comments on commit 174b924

Please sign in to comment.