Move to Java 21 for building the mod

This commit is contained in:
embeddedt 2024-06-05 20:11:13 -04:00
parent c7befd1913
commit a51e740040
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
8 changed files with 16 additions and 28 deletions

View File

@ -16,11 +16,11 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK 17 - name: Set up JDK 21
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: 17 java-version: 21
check-latest: true check-latest: true
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v3 uses: gradle/actions/setup-gradle@v3

View File

@ -14,11 +14,11 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK 17 - name: Set up JDK 21
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: 17 java-version: 21
check-latest: true check-latest: true
- name: Remove tags for release on other versions - name: Remove tags for release on other versions
run: ./scripts/tagcleaner.sh run: ./scripts/tagcleaner.sh

View File

@ -2,16 +2,15 @@ ModernFix is a standard Minecraft-style Gradle project powered by Architectury L
run the `build` task (e.g. via `./gradlew build`). You can also use `./gradlew forge:build` or `./gradlew fabric:build` run the `build` task (e.g. via `./gradlew build`). You can also use `./gradlew forge:build` or `./gradlew fabric:build`
to build for just one loader (e.g. when debugging and wanting to rebuild quickly). to build for just one loader (e.g. when debugging and wanting to rebuild quickly).
You must use Java 17 to develop ModernFix as the toolchain requires it. Nonetheless, the 1.16 mod JARs will work on You must use Java 21 to develop ModernFix as the toolchain requires it. Nonetheless, the built 1.20.1 JAR is still
a Minecraft instance with Java 8. compatible with Java 17.
## Submitting pull requests ## Submitting pull requests
Code or documentation contributions are welcome. Please keep the following points in mind: Code or documentation contributions are welcome. Please keep the following points in mind:
* This project supports many Minecraft versions. Ideally, contributions should be made to the oldest relevant MC version. * This project supports many Minecraft versions. Ideally, contributions should be made to the oldest relevant MC version (currently 1.20)
For instance, a PR optimizing new worldgen should be made to 1.18 (not 1.19 or 1.20) while a PR optimizing something and then they will be ported forward.
like recipes should be made to 1.16 (the oldest supported version).
This somewhat unconventional policy ensures that all supported versions are treated equal when it comes to development, This somewhat unconventional policy ensures that all supported versions are treated equal when it comes to development,
rather than the onus being on other modders and players to backport changes that are needed. Changes to older versions are rather than the onus being on other modders and players to backport changes that are needed. Changes to older versions are

View File

@ -31,8 +31,7 @@ dependencies {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.compilerArgs += '--enable-preview' options.release = 21
options.release = 17
} }
shadowJar { shadowJar {

View File

@ -26,7 +26,6 @@ import org.fury_phoenix.mixinAp.config.MixinConfig;
@SupportedAnnotationTypes({"org.spongepowered.asm.mixin.Mixin", "org.embeddedt.modernfix.annotation.ClientOnlyMixin"}) @SupportedAnnotationTypes({"org.spongepowered.asm.mixin.Mixin", "org.embeddedt.modernfix.annotation.ClientOnlyMixin"})
@SupportedOptions({"rootProject.name", "project.name", "org.fury_phoenix.mixinAp.validator.debug"}) @SupportedOptions({"rootProject.name", "project.name", "org.fury_phoenix.mixinAp.validator.debug"})
@SupportedSourceVersion(SourceVersion.RELEASE_17)
@AutoService(Processor.class) @AutoService(Processor.class)
public class MixinProcessor extends AbstractProcessor { public class MixinProcessor extends AbstractProcessor {
@ -38,6 +37,11 @@ public class MixinProcessor extends AbstractProcessor {
private final Map<String, List<String>> mixinConfigList = new HashMap<>(); private final Map<String, List<String>> mixinConfigList = new HashMap<>();
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
@Override @Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
try { try {

View File

@ -7,7 +7,7 @@ plugins {
id 'org.ajoberstar.grgit' version '5.2.0' id 'org.ajoberstar.grgit' version '5.2.0'
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.79.0' id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.79.0'
id "com.modrinth.minotaur" version "2.+" apply false id "com.modrinth.minotaur" version "2.+" apply false
id("com.diffplug.spotless") version "6.18.0" apply false id("com.diffplug.spotless") version "6.25.0" apply false
id 'modernfix.common-conventions' apply false id 'modernfix.common-conventions' apply false
} }

View File

@ -34,8 +34,6 @@ tasks {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.fork = true
options.forkOptions.jvmArgs << '--enable-preview'
configure(options) { configure(options) {
if (!name.toLowerCase().contains('test')) { if (!name.toLowerCase().contains('test')) {
options.compilerArgs << "-ArootProject.name=${rootProject.name}" << "-Aproject.name=${project.name}" options.compilerArgs << "-ArootProject.name=${rootProject.name}" << "-Aproject.name=${project.name}"

View File

@ -26,18 +26,6 @@ configurations {
} }
} }
// TODO remove
repositories {
maven {
name = "Technici4n"
url = "https://raw.githubusercontent.com/Technici4n/Technici4n-maven/master/"
content {
includeGroup "net.fabricmc.fabric-api"
}
}
}
dependencies { dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
testImplementation "net.fabricmc:fabric-loader-junit:${rootProject.fabric_loader_version}" testImplementation "net.fabricmc:fabric-loader-junit:${rootProject.fabric_loader_version}"
@ -78,7 +66,7 @@ dependencies {
testAgent(project("path": ":test_agent", "configuration": "agentJar")) testAgent(project("path": ":test_agent", "configuration": "agentJar"))
} }
test { tasks.named("test") {
useJUnitPlatform() useJUnitPlatform()
def runDir = file('test_run') def runDir = file('test_run')
doFirst() { doFirst() {