Skip to content

Commit

Permalink
Set correct source/target java versions
Browse files Browse the repository at this point in the history
Co-authored-by: Howard ZHY <96782166+howardzhy@users.noreply.github.com>
  • Loading branch information
FlorianMichael and HowardZHY committed Jan 20, 2025
1 parent 379546a commit e386123
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ allprojects {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}

// Always set min java version to 17, for java 8 versions the jar is manually downgraded so it doesn't matter.
compileJava.setSourceCompatibility("17")
compileJava.setTargetCompatibility("17")

// Configuration used to include dependencies to the final jars
configurations {
library
Expand Down Expand Up @@ -95,6 +99,11 @@ subprojects {
// Used to execute code only for specific submodules
def versionId = Integer.parseInt(mcVersion.replace(".", ""))

// Java 17 is default, set newer versions here
if (versionId >= 1_20_6) {
compileJava.setSourceCompatibility("21")
compileJava.setTargetCompatibility("21")
}
compileJava.options.encoding = "UTF-8"

minecraft {
Expand Down Expand Up @@ -140,7 +149,9 @@ subprojects {
library "org.spongepowered:mixin:${mixin_version}"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}

if (versionId >= 1_20_6) {
// NeoForge, only to compile against
compileOnly("net.neoforged.fancymodloader:loader:2.0.20") { transitive = false }
compileOnly("net.neoforged:bus:7.2.0") { transitive = false }
}
Expand Down Expand Up @@ -283,4 +294,4 @@ subprojects {

dependencies {
compileOnly "io.netty:netty-all:4.1.117.Final"
}
}
6 changes: 5 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ include "viaforge-mc1192"
include "viaforge-mc1194"
include "viaforge-mc1204"
include "viaforge-mc1206"
include "viaforge-mc1214"
include "viaforge-mc1214"

plugins {
id "org.gradle.toolchains.foojay-resolver-convention" version "0.9.0"
}

0 comments on commit e386123

Please sign in to comment.