Skip to content

Commit

Permalink
Fix GradleVersion forced-upgrade for minimum required JRE.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Jul 28, 2022
1 parent e386e93 commit 6a786a2
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.gradle.testkit.runner.BuildTask;
import org.gradle.testkit.runner.GradleRunner;
import org.gradle.testkit.runner.TaskOutcome;
import org.gradle.util.GradleVersion;
import org.junit.jupiter.api.BeforeEach;

import com.diffplug.common.base.Errors;
Expand All @@ -50,27 +51,35 @@ public enum GradleVersionSupport {
final String version;

GradleVersionSupport(String version) {
String minVersionForRunningJRE;
switch (Jvm.version()) {
case 20:
case 19:
case 18:
// TODO: https://docs.gradle.org/current/userguide/compatibility.html
case 18:
minVersionForRunningJRE = "7.5";
break;
case 17:
this.version = "7.3";
minVersionForRunningJRE = "7.3";
break;
case 16:
this.version = "7.0";
minVersionForRunningJRE = "7.0";
break;
case 15:
this.version = "6.7";
minVersionForRunningJRE = "6.7";
break;
case 14:
this.version = "6.3";
minVersionForRunningJRE = "6.3";
break;
default:
this.version = version;
minVersionForRunningJRE = null;
break;
}
if (minVersionForRunningJRE != null && GradleVersion.version(minVersionForRunningJRE).compareTo(GradleVersion.version(version)) > 0) {
this.version = minVersionForRunningJRE;
} else {
this.version = version;
}
}
}

Expand Down

0 comments on commit 6a786a2

Please sign in to comment.