Skip to content

Commit 100d317

Browse files
Update to Gradle 9.1
1 parent b6cfb60 commit 100d317

File tree

8 files changed

+34
-42
lines changed

8 files changed

+34
-42
lines changed

.github/workflows/gradle.yml

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ on:
2929
jobs:
3030
build:
3131
runs-on: ubuntu-latest
32-
env:
33-
VIRUSTOTAL_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
34-
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
3532
steps:
3633

3734
- name: Echo distinct ID ${{ inputs.distinct_id }}
@@ -55,30 +52,16 @@ jobs:
5552
build-scan-publish: true
5653
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
5754
build-scan-terms-of-use-agree: "yes"
58-
59-
- name: Compile Java code
60-
run: ./gradlew remapJar --stacktrace --warning-mode=fail
61-
62-
- name: Validate JSON files
63-
run: ./gradlew spotlessJsonCheck || (echo "::error::JSON validation failed! Run './gradlew spotlessApply' to fix style issues, or check the full error message for syntax errors." && exit 1)
64-
65-
- name: Validate Java code style
66-
run: ./gradlew spotlessJavaCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1)
67-
68-
- name: Validate license headers
69-
run: ./gradlew spotlessLicenseHeaderCheck || (echo "::error::License headers are missing or malformed in some files! Run './gradlew spotlessApply' to fix this, or check the full error message for details." && exit 1)
70-
71-
- name: Run unit tests
72-
run: ./gradlew test --stacktrace --warning-mode=fail
73-
74-
- name: Validate access widener
75-
run: ./gradlew validateAccessWidener --stacktrace --warning-mode=fail
55+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
56+
cache-read-only: ${{ github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/1.') }}
7657

7758
- name: Build
7859
run: ./gradlew build --stacktrace --warning-mode=fail
7960

8061
- name: Upload to VirusTotal for analysis
8162
id: virustotal
63+
env:
64+
VIRUSTOTAL_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
8265
if: ${{ env.VIRUSTOTAL_API_KEY }}
8366
uses: crazy-max/ghaction-virustotal@v4
8467
with:
@@ -90,7 +73,7 @@ jobs:
9073
continue-on-error: true
9174

9275
- name: Add VirusTotal links to build summary
93-
if: ${{ env.VIRUSTOTAL_API_KEY && steps.virustotal.outputs.analysis }}
76+
if: ${{ steps.virustotal.outputs.analysis }}
9477
run: |
9578
echo "<details open>" >> $GITHUB_STEP_SUMMARY
9679
echo "<summary>🛡️ VirusTotal Scans</summary>" >> $GITHUB_STEP_SUMMARY
@@ -105,18 +88,24 @@ jobs:
10588
echo "</details>" >> $GITHUB_STEP_SUMMARY
10689
10790
- name: Run the mod and take screenshots
108-
uses: GabrielBB/[email protected]
91+
env:
92+
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
93+
run: xvfb-run --auto-servernum ./gradlew runEndToEndTest --stacktrace --warning-mode=fail
94+
95+
- name: Upload screenshots.zip artifact
96+
uses: actions/upload-artifact@v4
97+
if: ${{ success() || failure() }}
10998
with:
110-
run: ./gradlew runEndToEndTest --stacktrace --warning-mode=fail
99+
name: screenshots
100+
path: build/run/clientGameTest/screenshots
101+
compression-level: 0
111102

112-
# Needed because the screenshot gallery won't be created on pull requests.
113-
# Also useful if Imgur uploads fail.
114-
- name: Upload Test Screenshots.zip artifact
103+
- name: Upload crash-reports.zip artifact
115104
uses: actions/upload-artifact@v4
116-
if: always()
105+
if: ${{ failure() }}
117106
with:
118-
name: Test Screenshots
119-
path: run/screenshots
107+
name: crash-reports
108+
path: build/run/clientGameTest/crash-reports
120109

121110
- name: Create test screenshot gallery
122111
if: ${{ env.IMGUR_CLIENT_ID && (success() || failure()) }}

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ I don't use or recommend IntelliJ, but the commands to run would be:
8282
```pwsh
8383
git clone https://github.com/Wurst-Imperium/Wurst7.git
8484
cd Wurst7
85-
./gradlew genSources idea
85+
./gradlew genSources idea --no-configuration-cache
8686
```
8787

88+
**Note:** IntelliJ IDEA is [not yet compatible](https://github.com/FabricMC/fabric-loom/issues/1349) with Gradle's configuration cache. You will run into issues.
89+
90+
Possible workarounds:
91+
- Turn off args files ([this setting](https://i.imgur.com/zHqIOYg.png)). Won't work for some users because of a command length limit.
92+
- Add `--no-configuration-cache` to all of your Gradle commands.
8893

8994
## Contributing
9095

build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ dependencies {
5959
// In other words, Wurst won't compile without this library,
6060
// even though it's Minecraft that actually uses it.
6161
modImplementation "com.google.code.findbugs:jsr305:3.0.2"
62-
}
63-
62+
}
63+
6464
loom {
6565
accessWidenerPath = file("src/main/resources/wurst.accesswidener")
6666
}
@@ -111,10 +111,11 @@ tasks.register('runEndToEndTest', JavaExec) {
111111
}
112112

113113
processResources {
114-
inputs.property "version", project.version.substring(1)
114+
def modVersion = project.version.substring(1)
115+
inputs.property("version", modVersion)
115116

116117
filesMatching("fabric.mod.json") {
117-
expand "version": inputs.properties.version
118+
expand(version: modVersion)
118119
}
119120
}
120121

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Done to increase the memory available to gradle.
22
org.gradle.jvmargs=-Xmx1G
33
org.gradle.parallel=true
4+
org.gradle.configuration-cache=true
45

56
# Fabric Properties
67
# check these at https://fabricmc.net/develop/ and

gradle/wrapper/gradle-wrapper.jar

1.65 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH="\\\"\\\""
118117

119118

120119
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
172171
# For Cygwin or MSYS, switch paths to Windows format before running java
173172
if "$cygwin" || "$msys" ; then
174173
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175-
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176174

177175
JAVACMD=$( cygpath --unix "$JAVACMD" )
178176

@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
212210

213211
set -- \
214212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215-
-classpath "$CLASSPATH" \
216213
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217214
"$@"
218215

gradlew.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=
7473

7574

7675
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
76+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7877

7978
:end
8079
@rem End local scope for the variables with windows NT shell

0 commit comments

Comments
 (0)