excludedMethods
@@ -83,7 +83,8 @@ class PitestPluginExtension {
/**
* A list of test classes which should be excluded when mutating.
*
- * @since 1.3.0* @see #excludedClasses
+ * @since 1.3.0
+ * @see #excludedClasses
* @see #excludedMethods
*/
@Incubating
@@ -156,13 +157,21 @@ class PitestPluginExtension {
*
* Samples usage ("itest" project depends on "shared" project):
*
- * configure(project(':itest')) {* dependencies {* compile project(':shared')
- *}*
- * apply plugin: "pl.droidsonroids.pitest"
+ * configure(project(':itest')) {
+ * dependencies {
+ * compile project(':shared')
+ * }
+ *
+ * apply plugin: "info.solidsoft.pitest"
* //mutableCodeBase - additional configuration to resolve :shared project JAR as mutable code path for PIT
- * configurations { mutableCodeBase { transitive false }}* dependencies { mutableCodeBase project(':shared') }* pitest {* mainSourceSets = [project.sourceSets.main, project(':shared').sourceSets.main]
+ * configurations { mutableCodeBase { transitive false } }
+ * dependencies { mutableCodeBase project(':shared') }
+ * pitest {
+ * mainSourceSets = [project.sourceSets.main, project(':shared').sourceSets.main]
* additionalMutableCodePaths = [configurations.mutableCodeBase.singleFile]
- *}*}*
+ * }
+ * }
+ *
*
* @since 1.1.3 (specific for Gradle plugin)
*/
@@ -188,8 +197,10 @@ class PitestPluginExtension {
*
* Should be defined a map:
*
- * pitest {* pluginConfiguration = ["plugin1.key1": "value1", "plugin1.key2": "value2"]
- *}*
+ * pitest {
+ * pluginConfiguration = ["plugin1.key1": "value1", "plugin1.key2": "value2"]
+ * }
+ *
*/
MapProperty pluginConfiguration
@@ -217,8 +228,10 @@ class PitestPluginExtension {
* PIT fails on not Java specific file passed on a classpath (e.g. native libraries). Native libraries ('*.so', '*.dll', '*.dylib')
* and '*.pom' files are filtered by default, but a developer can add extra extensions to the list:
*
- * pitest {* fileExtensionsToFilter += ['xml', 'orbit']
- *}*
+ * pitest {
+ * fileExtensionsToFilter += ['xml', 'orbit']
+ * }
+ *
*
* Rationale: https://github.com/szpak/gradle-pitest-plugin/issues/53
*
@@ -226,8 +239,10 @@ class PitestPluginExtension {
*
* Please note. Starting with 1.4.6 due to Gradle limitations only the new syntax with addAll()/addAll([] is possible (instead of "+="):
*
- * pitest {* fileExtensionsToFilter.addAll('xml', 'orbit')
- *}*
+ * pitest {
+ * fileExtensionsToFilter.addAll('xml', 'orbit')
+ * }
+ *
* More information: https://github.com/gradle/gradle/issues/10475
*
* @since 1.2.4
@@ -235,6 +250,23 @@ class PitestPluginExtension {
@Incubating
final ListProperty fileExtensionsToFilter
+ /**
+ * Adds 'junit-platform-launcher' automatically to the 'testRuntimeOnly' configuration.
+ *
+ * Starting with PIT 1.14.0 (with pitest-junit-plugin 1.2.0+) that dependency is no longer shaded and has to be explicitly added to avoid:
+ * "Minion exited abnormally due to UNKNOWN_ERROR" or "NoClassDefFoundError: org.junit.platform.launcher.core.LauncherFactory".
+ * This feature is enabled by default if junit-platform is found on the testImplementation classes.
+ *
+ * PLEASE NOTE. This feature is experimental and might not work as expected in some corner cases. In that situation, just disable it and add
+ * required dependency 'junit-platform-launcher' in a proper version to 'testRuntimeOnly' manually.
+ *
+ * More information: https://github.com/szpak/gradle-pitest-plugin/issues/337
+ *
+ * @since 1.14.0
+ */
+ @Incubating
+ final Property addJUnitPlatformLauncher
+
final ReportAggregatorProperties reportAggregatorProperties
PitestPluginExtension(Project project) {
@@ -248,7 +280,6 @@ class PitestPluginExtension {
targetClasses = nullSetPropertyOf(p, String)
//null instead of empty collection to distinguish on optional parameters
targetTests = nullSetPropertyOf(p, String)
- dependencyDistance = of.property(Integer)
threads = of.property(Integer)
mutators = nullSetPropertyOf(p, String)
excludedMethods = nullSetPropertyOf(p, String)
@@ -291,6 +322,7 @@ class PitestPluginExtension {
outputCharset = of.property(Charset)
features = nullListPropertyOf(p, String)
fileExtensionsToFilter = nullListPropertyOf(p, String)
+ addJUnitPlatformLauncher = of.property(Boolean)
reportAggregatorProperties = new ReportAggregatorProperties(of)
excludeMockableAndroidJar = of.property(Boolean)
}
diff --git a/src/main/groovy/pl/droidsonroids/gradle/pitest/PitestTask.groovy b/src/main/groovy/pl/droidsonroids/gradle/pitest/PitestTask.groovy
index 3a94818b..1bb145d3 100644
--- a/src/main/groovy/pl/droidsonroids/gradle/pitest/PitestTask.groovy
+++ b/src/main/groovy/pl/droidsonroids/gradle/pitest/PitestTask.groovy
@@ -67,10 +67,6 @@ class PitestTask extends JavaExec {
@Optional
final SetProperty targetTests
- @Input
- @Optional
- final Property dependencyDistance
-
@Input
@Optional
final Property threads
@@ -257,16 +253,19 @@ class PitestTask extends JavaExec {
List overriddenTargetTests
//should be Set or SetProperty but it's not supported in Gradle as of 5.6.1
+ @Internal
+ File rootDir
+
PitestTask() {
getMainClass().set("org.pitest.mutationtest.commandline.MutationCoverageReport")
ObjectFactory of = project.objects
+ rootDir = project.rootDir
testPlugin = of.property(String)
reportDir = of.directoryProperty()
targetClasses = of.setProperty(String)
targetTests = of.setProperty(String)
- dependencyDistance = of.property(Integer)
threads = of.property(Integer)
mutators = of.setProperty(String)
excludedMethods = of.setProperty(String)
@@ -304,29 +303,29 @@ class PitestTask extends JavaExec {
pluginConfiguration = of.mapProperty(String, String)
maxSurviving = of.property(Integer)
useClasspathJar = of.property(Boolean)
+ inputEncoding = of.property(Charset)
+ outputEncoding = of.property(Charset)
additionalClasspath = of.fileCollection()
useAdditionalClasspathFile = of.property(Boolean)
additionalClasspathFile = of.fileProperty()
features = of.listProperty(String)
- inputEncoding = of.property(Charset)
- outputEncoding = of.property(Charset)
}
@Input
String getAdditionalClasspathFilePath() {
- return additionalClasspathFile.asFile.get().relativePath(project.rootProject.rootDir)
+ return additionalClasspathFile.asFile.get().relativePath(rootDir)
}
@Input
@Optional
String getHistoryInputLocationPath() {
//?. operator doesn't work with Gradle Providers
- return historyInputLocation.isPresent() ? historyInputLocation.asFile.get().relativePath(project.rootProject.rootDir) : null
+ return historyInputLocation.isPresent() ? historyInputLocation.asFile.get().relativePath(rootDir) : null
}
@Input
String getDefaultFileForHistoryDataPath() {
- return defaultFileForHistoryData.asFile.get().relativePath(project.rootProject.rootDir)
+ return defaultFileForHistoryData.asFile.get().relativePath(rootDir)
}
@Input
@@ -358,7 +357,6 @@ class PitestTask extends JavaExec {
map['reportDir'] = reportDir.getOrNull()?.toString()
map['targetClasses'] = targetClasses.get().join(',')
map['targetTests'] = overriddenTargetTests ? overriddenTargetTests.join(',') : optionalCollectionAsString(targetTests)
- map['dependencyDistance'] = optionalPropertyAsString(dependencyDistance)
map['threads'] = optionalPropertyAsString(threads)
map["mutators"] = optionalCollectionAsString(mutators)
map['excludedMethods'] = optionalCollectionAsString(excludedMethods)
diff --git a/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestAggregatorPluginTest.groovy b/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestAggregatorPluginTest.groovy
index 46ee429a..bba35380 100644
--- a/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestAggregatorPluginTest.groovy
+++ b/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestAggregatorPluginTest.groovy
@@ -48,6 +48,8 @@ class PitestAggregatorPluginTest extends Specification {
}
// void "use pitest version from subproject project configuration"() {} //TODO: Can be implemented with ProjectBuilder? withParent()?
+// void "use configured charset in aggregation"() {} //TODO: Can be tested in "unit" way?
+
// void "use configured charset in aggregation"() {} //TODO: Can be tested in "unit" way?
private void assertThatTasksAreInGroup(List taskNames, String group) {
diff --git a/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestTaskConfigurationSpec.groovy b/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestTaskConfigurationSpec.groovy
index d202f658..5ef99957 100644
--- a/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestTaskConfigurationSpec.groovy
+++ b/src/test/groovy/pl/droidsonroids/gradle/pitest/PitestTaskConfigurationSpec.groovy
@@ -30,7 +30,6 @@ class PitestTaskConfigurationSpec extends BasicProjectBuilderSpec implements Wit
'features',
'excludedTestClasses',
'testPlugin',
- 'dependencyDistance',
'threads',
"mutators",
'excludedMethods',
@@ -143,7 +142,6 @@ class PitestTaskConfigurationSpec extends BasicProjectBuilderSpec implements Wit
"reportDir" | new File("//tmp//foo") || new File("//tmp//foo//release").path //due to issues on Windows
"targetClasses" | ["a", "b"] || "a,b"
"targetTests" | ["t1", "t2"] || "t1,t2"
- "dependencyDistance" | 42 || "42"
"threads" | 42 || "42"
"mutators" | ["MUTATOR_X", "MUTATOR_Y", "-MUTATOR_Z"] || "MUTATOR_X,MUTATOR_Y,-MUTATOR_Z"
"excludedMethods" | ["methodX", "methodY"] || "methodX,methodY"