Skip to content

Commit

Permalink
only call Gradle once in helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
stempler committed Sep 8, 2017
1 parent d3d615f commit d98af19
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,20 @@ class SwarmComposerPlugin implements Plugin<Project> {
run = "docker stack deploy --compose-file \"$relPath\" --with-registry-auth ${sc.stackName}"
}

def images = "./gradlew -Pquiet=true build-${sc.stackName}-${sc.setupName}"
def gradleArgs = []

gradleArgs.add(0, '-Pquiet=true')
gradleArgs << "build-${sc.stackName}-${sc.setupName}"
if (!composeSupported) {
// also add push
images += "\n./gradlew -Pquiet=true push-${sc.stackName}-${sc.setupName}"
gradleArgs << "push-${sc.stackName}-${sc.setupName}"
}

gradleArgs << taskName

scriptFile.text = """#!/bin/bash
set -e
$images
./gradlew ${taskName}
./gradlew ${gradleArgs.join(' ')}
$run"""
try {
['chmod', 'a+x', scriptFile.absolutePath].execute()
Expand Down

0 comments on commit d98af19

Please sign in to comment.