Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose args property from AbstractPaketTask to all tasks
Description =========== This pull request adds changes to allow all possible additional paket command switches be set through the gradle tasks. The most important switches are implemented already within the task interface. But some optional switches are not. We don't want to add a big support list of all possible commandline options at the time, the users of the tasks can configure these options themself. Changes ======= ![IMPROVE] paket tasks interface
- Loading branch information
Showing
5 changed files
with
219 additions
and
1 deletion.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
src/integrationTest/groovy/wooga/gradle/paket/PaketIntegrationArgumentsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package wooga.gradle.paket | ||
|
||
import nebula.test.IntegrationSpec | ||
import spock.lang.IgnoreIf | ||
import spock.lang.Unroll | ||
|
||
abstract class PaketIntegrationArgumentsSpec extends IntegrationSpec { | ||
|
||
abstract Class getTestPlugin() | ||
abstract List<String> getTestTasks() | ||
|
||
def setup() { | ||
given: "a paket dependency file" | ||
createFile("paket.dependencies") | ||
|
||
and: "a empty lock file" | ||
createFile("paket.lock") | ||
|
||
buildFile << """ | ||
group = 'test' | ||
${applyPlugin(getTestPlugin())} | ||
""".stripIndent() | ||
} | ||
|
||
@IgnoreIf({ env["CI"] }) | ||
@Unroll | ||
def "task: #taskToRun is available"() { | ||
when: | ||
def result = runTasksSuccessfully("tasks") | ||
|
||
then: | ||
result.standardOutput.contains(taskToRun) | ||
|
||
where: | ||
taskToRun << getTestTasks() | ||
} | ||
|
||
@Unroll | ||
def "task :#taskToRun can set custom arguments '-customFlag1, -customFlag2' with args(arguments,...)"() { | ||
given: | ||
buildFile << """ | ||
|
||
project.tasks."${taskToRun}" { | ||
args($value) | ||
} | ||
""".stripIndent() | ||
when: | ||
def result = runTasks(taskToRun) | ||
then: | ||
result.wasExecuted(taskToRun) | ||
result.standardOutput.contains("Starting process 'command '") | ||
result.standardOutput.contains(" $expectedCommandlineSwitch") | ||
where: | ||
taskToRun << getTestTasks() | ||
value = '"-customFlag1", "-customFlag2"' | ||
expectedCommandlineSwitch = '-customFlag1 -customFlag2' | ||
} | ||
@Unroll | ||
def "task :#taskToRun can set custom arguments '-customFlag1, -customFlag2' with args([arguments])"() { | ||
given: | ||
buildFile << """ | ||
|
||
project.tasks."${taskToRun}" { | ||
args($value) | ||
} | ||
""".stripIndent() | ||
when: | ||
def result = runTasks(taskToRun) | ||
then: | ||
result.wasExecuted(taskToRun) | ||
result.standardOutput.contains("Starting process 'command '") | ||
result.standardOutput.contains(" $expectedCommandlineSwitch") | ||
where: | ||
taskToRun << getTestTasks() | ||
value = '["-customFlag1", "-customFlag2"]' | ||
expectedCommandlineSwitch = '-customFlag1 -customFlag2' | ||
} | ||
@Unroll | ||
def "task :#taskToRun can set custom arguments '-customFlag1, -customFlag2' with args = [arguments]"() { | ||
given: | ||
buildFile << """ | ||
|
||
project.tasks."${taskToRun}" { | ||
args = $value | ||
} | ||
""".stripIndent() | ||
when: | ||
def result = runTasks(taskToRun) | ||
then: | ||
result.wasExecuted(taskToRun) | ||
result.standardOutput.contains("Starting process 'command '") | ||
result.standardOutput.contains(" $expectedCommandlineSwitch") | ||
where: | ||
taskToRun << getTestTasks() | ||
value = '["-customFlag1", "-customFlag2"]' | ||
expectedCommandlineSwitch = '-customFlag1 -customFlag2' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/integrationTest/groovy/wooga/gradle/paket/get/PaketGetArgumentsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package wooga.gradle.paket.get; | ||
|
||
import wooga.gradle.paket.PaketIntegrationArgumentsSpec; | ||
import wooga.gradle.paket.PaketPlugin; | ||
|
||
import java.util.List; | ||
|
||
class PaketGetArgumentsSpec extends PaketIntegrationArgumentsSpec { | ||
|
||
@Override | ||
Class getTestPlugin() { | ||
return PaketGetPlugin.class | ||
} | ||
|
||
@Override | ||
List<String> getTestTasks() { | ||
return [ | ||
PaketGetPlugin.INSTALL_TASK_NAME, | ||
PaketGetPlugin.UPDATE_TASK_NAME, | ||
PaketGetPlugin.RESTORE_TASK_NAME, | ||
PaketGetPlugin.OUTDATED_TASK_NAME | ||
] | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/integrationTest/groovy/wooga/gradle/paket/pack/PaketPackArgumentsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package wooga.gradle.paket.pack | ||
|
||
import wooga.gradle.paket.PaketIntegrationArgumentsSpec | ||
|
||
class PaketPackArgumentsSpec extends PaketIntegrationArgumentsSpec { | ||
|
||
@Override | ||
Class getTestPlugin() { | ||
return PaketPackPlugin.class | ||
} | ||
|
||
@Override | ||
List<String> getTestTasks() { | ||
return ["paketPack-WoogaTest"] | ||
} | ||
|
||
def paketTemplateFile | ||
def version = "1.0.0" | ||
def packageID = "Wooga.Test" | ||
|
||
def setup() { | ||
buildFile << """ | ||
version = "$version" | ||
""".stripIndent() | ||
|
||
paketTemplateFile = createFile("paket.template") | ||
paketTemplateFile << """ | ||
type file | ||
id $packageID | ||
authors Wooga | ||
owners Wooga | ||
description | ||
Empty nuget package. | ||
""".stripIndent() | ||
|
||
createFile("paket.lock") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters