From 6c99e25c32ed483f28c27fada1df271c6aedf953 Mon Sep 17 00:00:00 2001 From: fesc7420 <17569373+Pfoerd@users.noreply.github.com> Date: Mon, 3 Jul 2023 15:46:58 +0200 Subject: [PATCH] Ability to override from command line on-behalf-of: @e-solutions-GmbH --- .../OverridePluginFunctionalSpec.groovy | 16 ++++++++++++++++ .../solidsoft/gradle/pitest/PitestTask.groovy | 8 +++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/OverridePluginFunctionalSpec.groovy b/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/OverridePluginFunctionalSpec.groovy index d85067f7..394b7c2f 100644 --- a/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/OverridePluginFunctionalSpec.groovy +++ b/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/OverridePluginFunctionalSpec.groovy @@ -80,4 +80,20 @@ class OverridePluginFunctionalSpec extends AbstractPitestFunctionalSpec { result.standardOutput.contains("--targetTests=$overriddenTargetTests") } + void "should allow to enable verbose output from command line"() { + given: + buildFile << """ + ${getBasicGradlePitestConfig()} + + pitest { + failWhenNoMutations = false + verbose = false + } + """.stripIndent() + when: + ExecutionResult result = runTasksSuccessfully('pitest', '--verbose') + then: + result.standardOutput.contains("--verbose=true") + } + } diff --git a/src/main/groovy/info/solidsoft/gradle/pitest/PitestTask.groovy b/src/main/groovy/info/solidsoft/gradle/pitest/PitestTask.groovy index 311b4ad2..aaaac905 100644 --- a/src/main/groovy/info/solidsoft/gradle/pitest/PitestTask.groovy +++ b/src/main/groovy/info/solidsoft/gradle/pitest/PitestTask.groovy @@ -249,6 +249,12 @@ class PitestTask extends JavaExec { @Optional List overriddenTargetTests //should be Set or SetProperty but it's not supported in Gradle as of 5.6.1 + @Incubating + @Option(option = "verbose", description = "Output verbose logging. Overrides 'verbose' defined in configuration") + @Input + @Optional + Boolean overriddenVerbose + PitestTask() { getMainClass().set("org.pitest.mutationtest.commandline.MutationCoverageReport") @@ -354,7 +360,7 @@ class PitestTask extends JavaExec { map['excludedClasses'] = optionalCollectionAsString(excludedClasses) map['excludedTestClasses'] = optionalCollectionAsString(excludedTestClasses) map['avoidCallsTo'] = optionalCollectionAsString(avoidCallsTo) - map['verbose'] = optionalPropertyAsString(verbose) + map['verbose'] = overriddenVerbose ? overriddenVerbose.toString() : optionalPropertyAsString(verbose) map['verbosity'] = optionalPropertyAsString(verbosity) map['timeoutFactor'] = optionalPropertyAsString(timeoutFactor) map['timeoutConst'] = optionalPropertyAsString(timeoutConstInMillis)