From 52d8005d9f9f0a58da7539db65da386648d1dca2 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 20 Dec 2023 13:33:32 +0100 Subject: [PATCH 1/4] Add a bot comment that explains how to fix Spotless errors --- .github/workflows/gradle.yml | 45 ++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3a10dd4..ff11262 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,5 +1,3 @@ -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle name: Java CI with Gradle on: @@ -17,24 +15,63 @@ on: jobs: build: runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 + - name: Set up Java 17 uses: actions/setup-java@v3 with: java-version: '17' distribution: 'microsoft' + - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Setup Gradle uses: gradle/gradle-build-action@v2 + + - name: Check code style with Spotless + id: spotless_check + run: ./gradlew spotlessCheck + continue-on-error: true + + - name: Comment on PR on Spotless failure + if: ${{ steps.spotless_check.outcome == 'failure' && github.event_name == 'pull_request' }} + uses: actions/github-script@v7 + with: + script: | + const prAuthor = context.payload.pull_request.user.login; + const codestyleUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/tree/master/codestyle`; + const commentBody = ` + Hi @${prAuthor}, thanks for the pull request! It seems there are some format violations that need to be fixed. + + If you're using Eclipse, please make sure to use the cleanup and format settings located in the [codestyle folder](${codestyleUrl}). This will help ensure consistency with the existing codebase. + + Alternatively, if you're not using Eclipse, you can also fix these violations by running the following command from the command line: + + \`\`\` + ./gradlew spotlessApply + \`\`\` + + Once you've done this, please commit the changes and push them to your branch. This should cause the check to pass and allow your pull request to be merged. + `; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); + - name: Execute Gradle build - run: ./gradlew build spotlessCheck + run: ./gradlew build + - name: VirusTotal scan - if: github.event_name == 'push' + if: ${{ github.event_name == 'push' }} uses: crazy-max/ghaction-virustotal@v4 with: vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }} From b625b6e9d32716feb9b8e30b3a1fb8a7c1ddd1cb Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 24 Jan 2024 11:09:09 +0100 Subject: [PATCH 2/4] Remove broken bot comment --- .github/workflows/gradle.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ff11262..024b42b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -38,34 +38,6 @@ jobs: - name: Check code style with Spotless id: spotless_check run: ./gradlew spotlessCheck - continue-on-error: true - - - name: Comment on PR on Spotless failure - if: ${{ steps.spotless_check.outcome == 'failure' && github.event_name == 'pull_request' }} - uses: actions/github-script@v7 - with: - script: | - const prAuthor = context.payload.pull_request.user.login; - const codestyleUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/tree/master/codestyle`; - const commentBody = ` - Hi @${prAuthor}, thanks for the pull request! It seems there are some format violations that need to be fixed. - - If you're using Eclipse, please make sure to use the cleanup and format settings located in the [codestyle folder](${codestyleUrl}). This will help ensure consistency with the existing codebase. - - Alternatively, if you're not using Eclipse, you can also fix these violations by running the following command from the command line: - - \`\`\` - ./gradlew spotlessApply - \`\`\` - - Once you've done this, please commit the changes and push them to your branch. This should cause the check to pass and allow your pull request to be merged. - `; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: commentBody - }); - name: Execute Gradle build run: ./gradlew build From ad4b6227e8c30e136d760a730099852c235f3ff4 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 3 Apr 2024 14:32:35 +0200 Subject: [PATCH 3/4] Update dependencies for gradle workflow --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 024b42b..7f4b1a7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -21,10 +21,10 @@ jobs: uses: actions/checkout@v4 - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 - name: Set up Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'microsoft' @@ -33,7 +33,7 @@ jobs: run: chmod +x gradlew - name: Setup Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/gradle-build-action@v3 - name: Check code style with Spotless id: spotless_check From 5a42c94053e32a40ba3da2217a6bdf05a206105b Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 3 Apr 2024 15:00:47 +0200 Subject: [PATCH 4/4] Update Fabric stuff --- build.gradle | 8 +- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew.bat | 184 +++++++++++------------ src/main/resources/fabric.mod.json | 2 +- 5 files changed, 100 insertions(+), 100 deletions(-) diff --git a/build.gradle b/build.gradle index 3c612ef..aaa7a60 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.4-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' id 'com.matthewprenger.cursegradle' version '1.4.0' id "com.modrinth.minotaur" version "2.+" @@ -78,7 +78,7 @@ spotless { // configure the maven publication publishing { publications { - mavenJava(MavenPublication) { + create("mavenJava", MavenPublication) { from components.java } } @@ -164,13 +164,13 @@ task github(dependsOn: moveDevLibs) { def repository = github.getRepository("Wurst-Imperium-MCX/WI-Zoom") def ghVersion = "v" + version.substring(0, version.indexOf("-")) - def ghRelease = repository.getReleaseByTagName(ghVersion as String); + def ghRelease = repository.getReleaseByTagName(ghVersion as String) if(ghRelease == null) { def releaseBuilder = new GHReleaseBuilder(repository, ghVersion as String) ghRelease = releaseBuilder.create() } - ghRelease.uploadAsset(remapJar.archiveFile.get().getAsFile(), "application/java-archive"); + ghRelease.uploadAsset(remapJar.archiveFile.get().getAsFile(), "application/java-archive") ghRelease.uploadAsset(remapSourcesJar.archiveFile.get().getAsFile(), "application/java-archive") ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar"), "application/java-archive") ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesBaseName}-${version}-sources-dev.jar"), "application/java-archive") diff --git a/gradle.properties b/gradle.properties index c7fdcd9..f72e9e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,10 +7,10 @@ org.gradle.parallel=true # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.20.4 yarn_mappings=1.20.4+build.3 -loader_version=0.15.1 +loader_version=0.15.9 #Fabric api -fabric_version=0.91.2+1.20.4 +fabric_version=0.96.11+1.20.4 # Mod Properties mod_version = 1.5-MC1.20.4 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..13ba5d3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -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. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +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 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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 + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9b0dbe8..fb66737 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,7 +30,7 @@ ], "depends": { - "fabricloader": ">=0.15.0", + "fabricloader": ">=0.15.9", "fabric-api": ">=0.76.1", "minecraft": "~1.20-alpha.23.12.a", "java": ">=17"