Skip to content

Commit

Permalink
Backport fixed Recipe Remainder API to 1.20.1 (#373)
Browse files Browse the repository at this point in the history
* Update to QLoader 0.25.0 and QLoom 1.4

* Update to QLoom 1.5 (and Gradle 8.8)

* Backport fixed Recipe Remainder API

* Update CI

* Nuke Log4J javadoc
why did we even keep that in

* Fix CI

* Fix CI for real

---------

Co-authored-by: Eli Orona <[email protected]>
  • Loading branch information
EnnuiL and OroArmor authored Jul 6, 2024
1 parent 0cb467f commit 3839acf
Show file tree
Hide file tree
Showing 38 changed files with 594 additions and 220 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: Release
on: [workflow_dispatch] # Manual trigger

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v3
- run: ./gradlew checkLicenses generateQmj --parallel --stacktrace
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,29 @@ jobs:
strategy:
matrix:
java: [17]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
cache: 'gradle'
- name: Check Licenses and Generate QMJs
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: checkLicenses generateQmj --parallel --stacktrace
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/tags/v') }}
- name: Check Licenses and Generate QMJs
run: ./gradlew checkLicenses generateQmj --stacktrace
- name: Publish to Snapshot maven
uses: gradle/gradle-build-action@v2
with:
arguments: build publish --stacktrace --parallel
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/tags/v') }}
run: ./gradlew build publish --stacktrace
env:
SNAPSHOTS_URL: ${{ secrets.SNAPSHOTS_URL }}
SNAPSHOTS_USERNAME: ${{ secrets.SNAPSHOTS_USERNAME }}
SNAPSHOTS_PASSWORD: ${{ secrets.SNAPSHOTS_PASSWORD }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Artifacts
name: Artifacts (Java ${{ matrix.java }})
path: ./*/build/libs/
32 changes: 14 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,37 @@ jobs:
build:
strategy:
matrix:
java: [17, 20]
runs-on: ubuntu-22.04
java: [17, 21]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
- name: Check Licenses and Generate QMJs
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: checkLicenses generateQmj --parallel --stacktrace
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/tags/v') }}
- name: Check Licenses and Generate QMJs
run: ./gradlew checkLicenses generateQmj --stacktrace
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build publishToMavenLocal --stacktrace --parallel -Porg.gradle.parallel.threads=4
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/tags/v') }}
run: ./gradlew build publishToMavenLocal --stacktrace -Porg.gradle.parallel.threads=4
- run: mkdir run && echo "eula=true" >> run/eula.txt
- name: Run auto-test server
uses: gradle/gradle-build-action@v2
with:
arguments: :runAutoAllTestServer --stacktrace
- uses: actions/upload-artifact@v3
run: ./gradlew :runAutoAllTestServer --stacktrace
- uses: actions/upload-artifact@v4
with:
name: Production Mods
name: Production Mods (Java ${{ matrix.java }})
path: |
./**/build/libs/
!./build-logic/**
!./**/build/libs/*-javadoc.jar
!./**/build/libs/*-sources.jar
!./**/build/libs/*-testmod.jar
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Test Mods
name: Test Mods (Java ${{ matrix.java }})
path: ./**/build/libs/*-testmod.jar
10 changes: 5 additions & 5 deletions build-logic/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
asm = "9.5"
indra_git = "3.1.2"
quilt_gradle_licenser = "2.+"
quilt_parsers = "0.2.1"
quilt_loom = "1.3.+"
asm = "9.7"
indra_git = "3.1.3"
quilt_gradle_licenser = "2.0.1"
quilt_parsers = "0.3.0"
quilt_loom = "1.5.8"

[libraries]
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
Expand Down
4 changes: 0 additions & 4 deletions build-logic/src/main/groovy/qsl.library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ jar {
enabled = false
}

prepareRemapJar {
enabled = false
}

remapJar {
enabled = false
}
Expand Down
5 changes: 2 additions & 3 deletions build-logic/src/main/groovy/qsl.module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ loom {

// Enable the game test runner.
property("quilt.game_test", "true")
property("quilt.game_test.report_file", "${project.buildDir}/game_test/report.xml")
property("quilt.game_test.report_file", layout.buildDirectory.file("game_test/report.xml").get().asFile.path)
runDir("build/game_test")
}
}
Expand All @@ -173,8 +173,7 @@ javadoc {
"https://guava.dev/releases/31.0.1-jre/api/docs/",
"https://asm.ow2.io/javadoc/",
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://jenkins.liteloader.com/job/Mixin/javadoc/",
"https://logging.apache.org/log4j/2.x/log4j-api/apidocs/"
"https://jenkins.liteloader.com/job/Mixin/javadoc/"
)

// Disable the overzealous doclint tool in Java 8
Expand Down
2 changes: 1 addition & 1 deletion build-logic/src/main/java/qsl/internal/Versions.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class Versions {
/**
* The version of Quilt Loader to use.
*/
public static final String LOADER_VERSION = "0.20.2";
public static final String LOADER_VERSION = "0.25.0";

/**
* The target Java version.
Expand Down
17 changes: 11 additions & 6 deletions build-logic/src/main/java/qsl/internal/extension/QslExtension.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
package qsl.internal.extension;

import org.gradle.api.Project;
import org.gradle.api.Task;
import qsl.internal.Versions;

public class QslExtension {
private static final String RESOLVE_VINEFLOWER_TASK = "resolveVineflower";
private static final String GEN_SOURCES_WITH_VINEFLOWER_TASK = "genSourcesWithVineflower";
private static final String[] TASKS_TO_DISABLE = {RESOLVE_VINEFLOWER_TASK, "genSourcesWithFernFlower"};
private static final String[] TASKS_TO_DISABLE = {
"genSourcesWithFernFlower",
"genSourcesWithVineflower",
"genSourcesWithCfr",
"genSources"
};
protected final Project project;

public QslExtension(Project project) {
this.project = project;

this.project.afterEvaluate(p -> {
for (var task : TASKS_TO_DISABLE) {
p.getTasks().findByName(task).setEnabled(false);
Task disabled = p.getTasks().findByName(task);
if (disabled != null) {
disabled.setEnabled(false);
}
}

p.getTasks().findByName(GEN_SOURCES_WITH_VINEFLOWER_TASK).dependsOn(p.getRootProject().getTasks().findByName(RESOLVE_VINEFLOWER_TASK));
});
}

Expand Down
38 changes: 19 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ sourceSets {

// The root project simply just publishes all artifacts.
// For that reason, do not generate a remapped jar.
prepareRemapJar {
enabled = false
}

remapJar {
enabled = false
}
Expand All @@ -58,8 +54,9 @@ task fatJavadoc(type: Javadoc) {
"https://guava.dev/releases/31.1-jre/api/docs/",
"https://asm.ow2.io/javadoc/",
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://jenkins.liteloader.com/job/Mixin/javadoc/",
"https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-mappings/${Versions.MINECRAFT_VERSION.version()}+build.${Versions.MAPPINGS_BUILD}/quilt-mappings-${Versions.MINECRAFT_VERSION.version()}+build.${Versions.MAPPINGS_BUILD}-javadoc.jar/"
"https://jenkins.liteloader.com/job/Mixin/javadoc/"
// TODO: Fix maven javadocs
// "https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-mappings/${Versions.MINECRAFT_VERSION.version()}+build.${Versions.MAPPINGS_BUILD}/quilt-mappings-${Versions.MINECRAFT_VERSION.version()}+build.${Versions.MAPPINGS_BUILD}-javadoc.jar/"
)

// Disable the overzealous doclint tool in Java 8
Expand All @@ -77,21 +74,24 @@ task fatJavadoc(type: Javadoc) {
}

afterEvaluate {
subprojects.stream().filter { it.path.count(':') == 2 }.each { subproject ->
subproject.tasks.withType(Javadoc).each { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
// TODO: find a proper fix for this
// What does this do? Well, turns out transitive access wideners aren't applied properly,
// which fails the fat javadoc task! Since Quilt Block Entity adds a transitive access widener to a private interface.
// So what do we do? We simply removed the Vanilla JAR and hope that the correct transformed JAR shows up first.
// The proper fix is to get the root project to generate a new MC JAR that contains all the transitive transformations of the modules
// applied and pass that to the fat javadoc task instead.
.filter { !it.name.startsWith("minecraft") || it.name.contains("@block@block_entity") }
subprojects.stream()
.filter { it.path.count(':') == 2 }
.filter { it.name != "block_entity"}
.each { subproject ->
subproject.tasks.withType(Javadoc).each { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
// TODO: find a proper fix for this
// What does this do? Well, turns out transitive access wideners aren't applied properly,
// which fails the fat javadoc task! Since Quilt Block Entity adds a transitive access widener to a private interface.
// So what do we do? We simply removed the Vanilla JAR and hope that the correct transformed JAR shows up first.
// The proper fix is to get the root project to generate a new MC JAR that contains all the transitive transformations of the modules
// applied and pass that to the fat javadoc task instead.
// .filter { !it.name.startsWith("minecraft") }
}
}
}
destinationDir = file("${buildDir}/docs/fat-javadoc")
destinationDir = layout.buildDirectory.file("docs/fat-javadoc").get().asFile
}


Expand Down Expand Up @@ -170,7 +170,7 @@ loom {

configName = "Game test server"
property("quilt.game_test", "true")
property("quilt.game_test.report_file", "${project.buildDir}/game_test/report.xml")
property("quilt.game_test.report_file", project.layout.buildDirectory.file("game_test/report.xml").get().asFile.path)
runDir("build/game_test")
}
}
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
# though needing more might be a sign that something is wrong in the build tool.
org.gradle.jvmargs=-Xmx3072m
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
16 changes: 8 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion library/block/block_extensions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def checkBlockSettings = tasks.register('checkBlockSettings') {
dependsOn jar

doLast {
def moduleJar = project.buildDir.toPath().resolve("devlibs/${qslModule.moduleName.get()}-${version}-dev.jar")
def moduleJar = project.layout.buildDirectory.file("devlibs/${qslModule.moduleName.get()}-${version}-dev.jar").get().asFile.toPath()

try (def moduleFs = FileSystems.newFileSystem(URI.create("jar:${moduleJar.toUri()}"), [create: false])) {
def mcFs = ClassAnalysisUtils.loadMinecraftJar(project)
Expand Down
2 changes: 1 addition & 1 deletion library/item/item_setting/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks.register('checkItemSettings') {
dependsOn jar

doLast {
def moduleJar = project.buildDir.toPath().resolve("devlibs/${qslModule.moduleName.get()}-${version}-dev.jar")
def moduleJar = project.layout.buildDirectory.file("devlibs/${qslModule.moduleName.get()}-${version}-dev.jar").get().asFile.toPath()

try (def moduleFs = FileSystems.newFileSystem(URI.create("jar:${moduleJar.toUri()}"), [create: false])) {
try (def mcFs = ClassAnalysisUtils.loadMinecraftJar(project)) {
Expand Down
Loading

0 comments on commit 3839acf

Please sign in to comment.