diff --git a/.forgejo/workflows/build-java.yml b/.forgejo/workflows/build-java.yml new file mode 100644 index 0000000..fc4be96 --- /dev/null +++ b/.forgejo/workflows/build-java.yml @@ -0,0 +1,41 @@ +name: build-java +on: [ push, pull_request ] + +jobs: + build: + runs-on: docker + steps: + - name: checkout repository + uses: https://code.forgejo.org/actions/checkout@v4 + - name: setup jdk + uses: https://github.com/actions/setup-java@v4 + with: + java-version: | + 8 + 21 + distribution: temurin + - name: restore cached dependencies + uses: https://code.forgejo.org/actions/cache/restore@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-Gradle + - name: build + run: ./gradlew build --no-daemon --warning-mode=all + - name: capture build artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: build-artifacts.zip + path: | + build/libs + !build/libs/*-all.jar + if-no-files-found: error + - name: cache downloaded dependencies + if: ${{ github.ref_name == github.event.repository.default_branch }} + uses: https://code.forgejo.org/actions/cache/save@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-Gradle diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a12a986..8fc3827 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,33 +8,23 @@ on: [pull_request, push] jobs: build: - strategy: - matrix: - # Use these Java versions - java: [ - 21, # Current Java LTS & minimum supported by Minecraft - ] - # and run on both Linux and Windows - os: [ubuntu-22.04, windows-2022] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-24.04 steps: - name: checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v3 + uses: gradle/actions/wrapper-validation@v4 + - name: setup jdk + uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + java-version: '21' distribution: 'microsoft' - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: build run: ./gradlew build - name: capture build artifacts - if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Artifacts path: build/libs/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index b03a39f..620f571 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,8 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.10-SNAPSHOT' id 'maven-publish' - id 'com.github.johnrengelman.shadow' version '8.1.1' } -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - version = project.mod_version group = project.maven_group @@ -19,23 +16,21 @@ repositories { // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. - mavenCentral() } loom { splitEnvironmentSourceSets() + mods { "modid" { sourceSet sourceSets.main sourceSet sourceSets.client } } + } dependencies { - compileOnly 'org.projectlombok:lombok:1.18.32' - annotationProcessor 'org.projectlombok:lombok:1.18.32' - // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" @@ -43,36 +38,19 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - - implementation('net.dv8tion:JDA:5.0.0-beta.17') { - exclude module: 'opus-java' - } - shadow 'net.dv8tion:JDA:5.0.0-beta.17' -} - -tasks.withType(ShadowJar).configureEach { - it.minimize() - it.configurations = [project.configurations.shadow] - it.enableRelocation = true - it.relocationPrefix = "dev.jonasjones.yadacl.vendor" -} - - -remapJar { - from('LICENSE') // Include license - inputFile.set shadowJar.archiveFile - dependsOn shadowJar + } processResources { inputs.property "version", project.version + filesMatching("fabric.mod.json") { - expand "version": project.version + expand "version": inputs.properties.version } } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { @@ -80,23 +58,28 @@ java { // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { + inputs.property "archivesName", project.base.archivesName + from("LICENSE") { - rename { "${it}_${project.base.archivesName.get()}"} + rename { "${it}_${inputs.properties.archivesName}"} } } // configure the maven publication publishing { publications { - mavenJava(MavenPublication) { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name from components.java } } + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { // Add repositories to publish to here. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..e18bc25 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.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f3b75f3 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,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/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 7101f8e..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ##########################################################################