Skip to content

Commit ebc1925

Browse files
authored
Add upper bounds for gradle and java version ranges, now that we know FG4 doesn't work under Gradle7 / Java16 (#782)
1 parent 0c2ea04 commit ebc1925

File tree

1 file changed

+10
-7
lines changed
  • src/common/java/net/minecraftforge/gradle/common/util

1 file changed

+10
-7
lines changed

src/common/java/net/minecraftforge/gradle/common/util/Utils.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -518,19 +518,22 @@ public static final String capitalize(@Nonnull final String toCapitalize) {
518518
}
519519

520520
public static void checkJavaRange(@Nullable JavaVersionParser.JavaVersion minVersionInclusive, @Nullable JavaVersionParser.JavaVersion maxVersionExclusive) {
521-
checkRange("java", JavaVersionParser.getCurrentJavaVersion(), minVersionInclusive, maxVersionExclusive, "");
521+
checkRange("java", JavaVersionParser.getCurrentJavaVersion(), minVersionInclusive, maxVersionExclusive, "",
522+
"\nNote: Support for running under Java 16 requires Gradle 7, which will be supported in ForgeGradle 5.");
522523
}
523524

524525
public static void checkGradleRange(@Nullable GradleVersion minVersionInclusive, @Nullable GradleVersion maxVersionExclusive) {
525-
checkRange("Gradle", GradleVersion.current(), minVersionInclusive, maxVersionExclusive, "\nNote: Upgrade your gradle version first before trying to switch to FG4.");
526+
checkRange("Gradle", GradleVersion.current(), minVersionInclusive, maxVersionExclusive,
527+
"\nNote: Upgrade your gradle version first before trying to switch to FG4.",
528+
"\nNote: Support for Gradle 7 will be added in ForgeGradle 5.");
526529
}
527530

528-
private static <T> void checkRange(String name, Comparable<T> current, @Nullable T minVersionInclusive, @Nullable T maxVersionExclusive, String additional) {
531+
private static <T> void checkRange(String name, Comparable<T> current, @Nullable T minVersionInclusive, @Nullable T maxVersionExclusive, String additionalMin, String additionalMax) {
529532
if (minVersionInclusive != null && current.compareTo(minVersionInclusive) < 0)
530-
throw new RuntimeException(String.format("Found %s version %s. Minimum required is %s.%s", name, current, minVersionInclusive, additional));
533+
throw new RuntimeException(String.format("Found %s version %s. Minimum required is %s.%s", name, current, minVersionInclusive, additionalMin));
531534

532535
if (maxVersionExclusive != null && current.compareTo(maxVersionExclusive) >= 0)
533-
throw new RuntimeException(String.format("Found %s version %s. Versions %s and newer are not supported yet.", name, current, maxVersionExclusive));
536+
throw new RuntimeException(String.format("Found %s version %s. Versions %s and newer are not supported yet.%s", name, current, maxVersionExclusive, additionalMax));
534537
}
535538

536539
/**
@@ -546,14 +549,14 @@ public static void checkEnvironment() {
546549
checkJavaRange(
547550
// Minimum must be update 101 as it's the first one to include Let's Encrypt certificates.
548551
JavaVersionParser.parseJavaVersion("1.8.0_101"),
549-
null //TODO: Add JDK range check to MCPConfig?
552+
JavaVersionParser.parseJavaVersion("16.0")
550553
);
551554
}
552555

553556
if (ENABLE_TEST_GRADLE) {
554557
checkGradleRange(
555558
GradleVersion.version("6.8.1"),
556-
null
559+
GradleVersion.version("7.0")
557560
);
558561
}
559562

0 commit comments

Comments
 (0)