Skip to content

Commit

Permalink
Change minimal required Gradle version to 6.4
Browse files Browse the repository at this point in the history
To avoid deprecation warnings in Gradle 7:
#283
  • Loading branch information
szpak committed Sep 19, 2021
1 parent 6c133ca commit ee47cd4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

- Support for Gradle configuration cache - [#249](https://github.com/szpak/gradle-pitest-plugin/issues/249) - PR by [David Burstrom](https://github.com/davidburstrom)
- Turn on cacheability for PitestTask - [#67](https://github.com/szpak/gradle-pitest-plugin/issues/67) - PR by [David Burstrom](https://github.com/davidburstrom)
- Fix deprecation warnings in Gradle 7 - [#283](https://github.com/szpak/gradle-pitest-plugin/issues/283) - PR by [Mike Duigou](https://github.com/bondolo)
- Bump minimal supported Gradle version to 6.4 - required to fix deprecation warnings in Gradle 7
- Upgrade Gradle wrapper to 6.9.1
- Switch CI from defunc travis-ci.org to travis-ci.com

- Switch CI from defunct travis-ci.org to travis-ci.com

## 1.6.0 - 2021-03-04

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import info.solidsoft.gradle.pitest.PitestPlugin
import nebula.test.functional.ExecutionResult
import nebula.test.functional.GradleRunner
import org.gradle.api.GradleException
import org.gradle.api.JavaVersion
import org.gradle.internal.jvm.Jvm
import org.gradle.util.GradleVersion
import org.spockframework.runtime.extension.builtin.PreconditionContext
import spock.lang.IgnoreIf
import spock.util.Exceptions
import spock.util.environment.RestoreSystemProperties

import java.util.regex.Pattern

Expand All @@ -31,27 +31,29 @@ import static info.solidsoft.gradle.pitest.PitestTaskConfigurationSpec.PIT_PARAM
@CompileDynamic
class PitestPluginGradleVersionFunctionalSpec extends AbstractPitestFunctionalSpec {

//4.8, but plugin requires 5.6
private static final GradleVersion MINIMAL_SUPPORTED_JAVA12_COMPATIBLE_GRADLE_VERSION = PitestPlugin.MINIMAL_SUPPORTED_GRADLE_VERSION
//6.0+ - https://github.com/gradle/gradle/issues/8681#issuecomment-532507276
private static final GradleVersion MINIMAL_SUPPORTED_JAVA13_COMPATIBLE_GRADLE_VERSION = GradleVersion.version("6.0.1")
//6.3+ - https://github.com/gradle/gradle/issues/10248
private static final GradleVersion MINIMAL_SUPPORTED_JAVA14_COMPATIBLE_GRADLE_VERSION = GradleVersion.version("6.3")
//6.3+, but plugin requires 6.4 - https://github.com/gradle/gradle/issues/10248
private static final GradleVersion MINIMAL_SUPPORTED_JAVA14_COMPATIBLE_GRADLE_VERSION = PitestPlugin.MINIMAL_SUPPORTED_GRADLE_VERSION
//https://docs.gradle.org/6.7/release-notes.html
private static final GradleVersion MINIMAL_SUPPORTED_JAVA15_COMPATIBLE_GRADLE_VERSION = GradleVersion.version("6.7")
//https://docs.gradle.org/7.0/release-notes.html
private static final GradleVersion MINIMAL_SUPPORTED_JAVA16_COMPATIBLE_GRADLE_VERSION = GradleVersion.version("7.0.2")
//TODO: 7.0, 7.1, 7.2? Determine once testing with Java 17 using toolchain is unlocked - https://github.com/szpak/gradle-pitest-plugin/issues/298
private static final GradleVersion MINIMAL_SUPPORTED_JAVA17_COMPATIBLE_GRADLE_VERSION = GradleVersion.version("7.0.2")

private static final Map<JavaVersion, GradleVersion> MINIMAL_GRADLE_VERSION_FOR_JAVA_VERSION = [
(JavaVersion.VERSION_15): MINIMAL_SUPPORTED_JAVA15_COMPATIBLE_GRADLE_VERSION,
(JavaVersion.VERSION_16): MINIMAL_SUPPORTED_JAVA16_COMPATIBLE_GRADLE_VERSION,
(JavaVersion.VERSION_17): MINIMAL_SUPPORTED_JAVA17_COMPATIBLE_GRADLE_VERSION,
].withDefault { MINIMAL_SUPPORTED_JAVA17_COMPATIBLE_GRADLE_VERSION }

void setup() {
daemonMaxIdleTimeInSecondsInMemorySafeMode = 1 //trying to mitigate "Gradle killed" issues with Travis
}

@RestoreSystemProperties
void "should run mutation analysis with Gradle #requestedGradleVersion"() {
given:
gradleVersion = requestedGradleVersion
classpathFilter = Predicates.and(GradleRunner.CLASSPATH_DEFAULT, FILTER_SPOCK_JAR)
and:
//TODO: Until fixed: https://github.com/szpak/gradle-pitest-plugin/pull/289
if (requestedGradleVersion.toString().startsWith("7.")) {
System.setProperty("ignoreDeprecations", "true")
}
when:
copyResources("testProjects/simple1", "")
then:
Expand Down Expand Up @@ -100,10 +102,9 @@ class PitestPluginGradleVersionFunctionalSpec extends AbstractPitestFunctionalSp

//TODO: Extract regression tests control mechanism to a separate class (or even better trait) when needed in some other place
private static final String REGRESSION_TESTS_ENV_NAME = "PITEST_REGRESSION_TESTS"
private static final List<String> GRADLE5_VERSIONS = ["5.6"]
private static final List<String> GRADLE6_VERSIONS = ["6.9.1", "6.8.3", "6.7", "6.6", "6.5", "6.4", "6.3", "6.2.1", "6.1.1", MINIMAL_SUPPORTED_JAVA13_COMPATIBLE_GRADLE_VERSION.version]
private static final List<String> GRADLE6_VERSIONS = ["6.9.1", "6.8.3", "6.7", "6.6", "6.5", MINIMAL_SUPPORTED_JAVA14_COMPATIBLE_GRADLE_VERSION.version]
private static final List<String> GRADLE7_VERSIONS = ["7.2", "7.1.1", "7.0.2"]
private static final List<String> GRADLE_LATEST_VERSIONS = [GRADLE5_VERSIONS.first(), GRADLE6_VERSIONS.first(), GRADLE7_VERSIONS.first()]
private static final List<String> GRADLE_LATEST_VERSIONS = [GRADLE6_VERSIONS.first(), GRADLE7_VERSIONS.first(), PitestPlugin.MINIMAL_SUPPORTED_GRADLE_VERSION.version]

private List<String> resolveRequestedGradleVersions() {
String regressionTestsLevel = System.getenv(REGRESSION_TESTS_ENV_NAME)
Expand All @@ -115,25 +116,22 @@ class PitestPluginGradleVersionFunctionalSpec extends AbstractPitestFunctionalSp
case "quick":
return GRADLE_LATEST_VERSIONS
case "full":
return GRADLE5_VERSIONS + GRADLE6_VERSIONS + GRADLE7_VERSIONS
return GRADLE6_VERSIONS + GRADLE7_VERSIONS
default:
log.warn("Unsupported $REGRESSION_TESTS_ENV_NAME value '`$regressionTestsLevel`' (expected 'latestOnly', 'quick' or 'full'). " +
"Assuming 'latestOnly'.")
"Assuming 'latestOnly'.")
return GRADLE_LATEST_VERSIONS
}
}

//Jvm class from Spock doesn't work with Java 9 stable releases - otherwise @IgnoreIf could be used - TODO: check with Spock 1.2
@SuppressWarnings("ConfusingTernary")
private List<String> applyJavaCompatibilityAdjustment(List<String> requestedGradleVersions) {
if (!Jvm.current().javaVersion.isJava9Compatible()) {
//All supported versions should be Java 8 compatible
if (!Jvm.current().javaVersion.isCompatibleWith(JavaVersion.VERSION_15)) {
//All supported versions should be Java 14 compatible
return requestedGradleVersions
}
GradleVersion minimalCompatibleGradleVersion =
!isJava14Compatible() ? MINIMAL_SUPPORTED_JAVA13_COMPATIBLE_GRADLE_VERSION :
!isJava13Compatible() ? MINIMAL_SUPPORTED_JAVA12_COMPATIBLE_GRADLE_VERSION :
MINIMAL_SUPPORTED_JAVA14_COMPATIBLE_GRADLE_VERSION
GradleVersion minimalCompatibleGradleVersion = MINIMAL_GRADLE_VERSION_FOR_JAVA_VERSION.get(Jvm.current().javaVersion)
return leaveJavaXCompatibleGradleVersionsOnly(requestedGradleVersions, minimalCompatibleGradleVersion)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class PitestPlugin implements Plugin<Project> {
public final static String PITEST_CONFIGURATION_NAME = 'pitest'

public final static String DEFAULT_PITEST_VERSION = '1.6.3'
@Internal
public static final GradleVersion MINIMAL_SUPPORTED_GRADLE_VERSION = GradleVersion.version("5.6") //public as used also in regression tests
@Internal //6.4 due to main -> mainClass change to avoid deprecation warning in Gradle 7.x - https://github.com/szpak/gradle-pitest-plugin/pull/289
public static final GradleVersion MINIMAL_SUPPORTED_GRADLE_VERSION = GradleVersion.version("6.4") //public as used also in regression tests

private static final String PITEST_JUNIT5_PLUGIN_NAME = "junit5"
private final static List<String> DYNAMIC_LIBRARY_EXTENSIONS = ['so', 'dll', 'dylib']
Expand Down

0 comments on commit ee47cd4

Please sign in to comment.