diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1ff9279a4..1f97a25a5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,22 +14,30 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - name: Checkout Repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: current + + - name: Set up Java + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-version: current - - name: Build with Gradle + + - name: Build run: gradle build -Pcommit=${{ github.sha }} + - uses: "marvinpinto/action-automatic-releases@latest" with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest-1.21.4" - prerelease: false - title: "1.21.4 Build" - files: | - ./build/libs/*.jar + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest-1.21.4" + prerelease: false + title: "1.21.4 Build" + files: | + ./build/libs/*.jar diff --git a/.github/workflows/issue-moderator.yml b/.github/workflows/issue-moderator.yml index 4d0f5ea10e..07fb3d6a90 100644 --- a/.github/workflows/issue-moderator.yml +++ b/.github/workflows/issue-moderator.yml @@ -11,7 +11,11 @@ jobs: issue-moderator: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Automatically close issues that don't follow the issue template uses: lucasbento/auto-close-issues@v1.0.2 with: @@ -20,4 +24,3 @@ jobs: @${issue.user.login}: hello! :wave: This issue is being automatically closed because it does not follow the issue template." closed-issues-label: "invalid" - diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 7c20343b0c..bd5623e641 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,20 +7,27 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - name: Checkout Repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: current + + - name: Set up Java + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - - name: Run Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: current - arguments: build + - name: Build + run: gradle build - name: Upload Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: pull-request-build path: build/libs/ diff --git a/.gitignore b/.gitignore index ac251ea00e..54d4c59f04 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ out run bin logs -.github/devbuilds/node_modules +.github/builds/node_modules *.iws *.ipr *.iml diff --git a/build.gradle b/build.gradle deleted file mode 100644 index ed3ac40171..0000000000 --- a/build.gradle +++ /dev/null @@ -1,164 +0,0 @@ -plugins { - id "fabric-loom" version "1.9-SNAPSHOT" - id "maven-publish" - id "com.gradleup.shadow" version "8.3.5" -} - -base { - archivesBaseName = project.archives_base_name - version = project.mod_version - group = project.maven_group -} - -repositories { - maven { - name = "meteor-maven" - url = "https://maven.meteordev.org/releases" - } - maven { - name = "meteor-maven-snapshots" - url = "https://maven.meteordev.org/snapshots" - } - maven { - name = "modrinth" - url = "https://api.modrinth.com/maven" - - content { - includeGroup "maven.modrinth" - } - } - maven { - url = "https://maven.frohnmeyer-wds.de/artifacts" - } - maven { - name = "vram" - url = "https://maven.vram.io/" - } - maven { - name = "ViaVersion" - url = "https://repo.viaversion.com" - } - mavenCentral() -} - -configurations { - // include mods - modImplementation.extendsFrom(modInclude) - include.extendsFrom(modInclude) -} - -dependencies { - // Fabric - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - - // Fabric API - modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fapi_version}") - shadow(fabricApi.module("fabric-api-base", project.fapi_version)) { - transitive = false - } - - // Compat fixes - modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") { transitive = false } - modCompileOnly("maven.modrinth:lithium:${project.lithium_version}") { transitive = false } - modCompileOnly("maven.modrinth:iris:${project.iris_version}") { transitive = false } - modCompileOnly("com.viaversion:viafabricplus:${project.viafabricplus_version}") { transitive = false } - modCompileOnly("com.viaversion:viafabricplus-api:${project.viafabricplus_version}") { transitive = false } - - // Baritone (https://github.com/MeteorDevelopment/baritone) - modCompileOnly "meteordevelopment:baritone:${project.baritone_version}-SNAPSHOT" - - // Libraries - modInclude "meteordevelopment:orbit:${project.orbit_version}" - modInclude "meteordevelopment:starscript:${project.starscript_version}" - modInclude "org.reflections:reflections:${project.reflections_version}" - modInclude "org.javassist:javassist:3.28.0-GA" // dependency of reflections, ordinarily shadowed - modInclude("io.netty:netty-handler-proxy:${project.netty_version}") { transitive = false } - modInclude("io.netty:netty-codec-socks:${project.netty_version}") { transitive = false } - modInclude "de.florianmichael:WaybackAuthLib:${project.waybackauthlib_version}" - - modInclude "io.gitlab.jfronny.libjf:libjf-unsafe-v0:${project.libjf_version}" - include "io.gitlab.jfronny.libjf:libjf-base:${project.libjf_version}" - modLocalRuntime "io.gitlab.jfronny.libjf:libjf-devutil:${project.libjf_version}" -} - -loom { - accessWidenerPath = file("src/main/resources/meteor-client.accesswidener") -} - -afterEvaluate { - migrateMappings.configure { - outputDir = project.file("src/main/java") - } -} - -tasks { - processResources { - def propertyMap = [ - "version" : project.version, - "minecraft_version": project.minecraft_version, - "loader_version" : project.loader_version - ] - - inputs.properties(propertyMap) - filesMatching("fabric.mod.json") { - expand(propertyMap) - } - } - - jar { - from("LICENSE") { - rename { "${it}_${project.base.archivesBaseName}" } - } -} - - java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 - - withSourcesJar() - withJavadocJar() - } - - shadowJar { - configurations = [project.configurations.shadow] - - from("LICENSE") { - rename { "${it}_${project.base.archivesBaseName}" } - } - - destinationDirectory.set(new File(project.buildDir, "devlibs")) - - dependencies { - exclude { - it.moduleGroup == "org.slf4j" - } - } - } - - remapJar { - dependsOn shadowJar - inputFile.set(shadowJar.archiveFile) - } - - javadoc { - options.addStringOption("Xdoclint:none", "-quiet") - options.encoding = "UTF-8" - } - - build { - dependsOn javadocJar - } -} - -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = "meteor-client" - version = project.mod_version - - from components.java - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..6c71f50873 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,184 @@ +plugins { + id("fabric-loom") version "1.9-SNAPSHOT" + id("maven-publish") + id("com.gradleup.shadow") version "9.0.0-beta4" +} + +base { + archivesName = properties["archives_base_name"] as String + group = properties["maven_group"] as String + version = properties["fapi_version"] as String +} + +repositories { + maven { + name = "meteor-maven" + url = uri("https://maven.meteordev.org/releases") + } + maven { + name = "meteor-maven-snapshots" + url = uri("https://maven.meteordev.org/snapshots") + } + maven { + url = uri("https://maven.frohnmeyer-wds.de/artifacts") + } + maven { + name = "vram" + url = uri("https://maven.vram.io/") + } + maven { + name = "ViaVersion" + url = uri("https://repo.viaversion.com") + } + mavenCentral() + + exclusiveContent { + forRepository { + maven { + name = "modrinth" + url = uri("https://api.modrinth.com/maven") + } + } + filter { + includeGroup("maven.modrinth") + } + } +} + +val modInclude: Configuration by configurations.creating + +configurations { + // include mods + modImplementation.configure { + extendsFrom(modInclude) + } + include.configure { + extendsFrom(modInclude) + } +} + +dependencies { + // Fabric + minecraft("com.mojang:minecraft:${properties["minecraft_version"] as String}") + mappings("net.fabricmc:yarn:${properties["yarn_mappings"] as String}:v2") + modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"] as String}") + + // Fabric API + shadow(modImplementation(platform("net.fabricmc.fabric-api:fabric-api-bom:${properties["fapi_version"] as String}"))!!) + modImplementation("net.fabricmc.fabric-api:fabric-api") + shadow("net.fabricmc.fabric-api:fabric-api-base") { + isTransitive = false + } + + // Compat fixes + modCompileOnly(fabricApi.module("fabric-renderer-indigo", properties["fapi_version"] as String)) + modCompileOnly("maven.modrinth:sodium:${properties["sodium_version"] as String}") { isTransitive = false } + modCompileOnly("maven.modrinth:lithium:${properties["lithium_version"] as String}") { isTransitive = false } + modCompileOnly("maven.modrinth:iris:${properties["iris_version"] as String}") { isTransitive = false } + modCompileOnly("com.viaversion:viafabricplus:${properties["viafabricplus_version"] as String}") { isTransitive = false } + modCompileOnly("com.viaversion:viafabricplus-api:${properties["viafabricplus_version"] as String}") { isTransitive = false } + + // Baritone (https://github.com/MeteorDevelopment/baritone) + modCompileOnly("meteordevelopment:baritone:${properties["baritone_version"] as String}-SNAPSHOT") + + // Libraries + modInclude("meteordevelopment:orbit:${properties["orbit_version"] as String}") + modInclude("meteordevelopment:starscript:${properties["starscript_version"] as String}") + modInclude("org.reflections:reflections:${properties["reflections_version"] as String}") + modInclude("io.netty:netty-handler-proxy:${properties["netty_version"] as String}") { isTransitive = false } + modInclude("io.netty:netty-codec-socks:${properties["netty_version"] as String}") { isTransitive = false } + modInclude("de.florianmichael:WaybackAuthLib:${properties["waybackauthlib_version"] as String}") + + modInclude("io.gitlab.jfronny.libjf:libjf-unsafe-v0:${properties["libjf_version"] as String}") + include("io.gitlab.jfronny.libjf:libjf-base:${properties["libjf_version"] as String}") + modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${properties["libjf_version"] as String}") +} + +loom { + accessWidenerPath = file("src/main/resources/meteor-client.accesswidener") +} + +afterEvaluate { + tasks.migrateMappings.configure { + outputDir.set(project.file("src/main/java")) + } +} + +tasks { + processResources { + val propertyMap = mapOf( + "version" to project.version, + "minecraft_version" to project.property("minecraft_version"), + "loader_version" to project.property("loader_version") + ) + + inputs.properties(propertyMap) + filesMatching("fabric.mod.json") { + expand(propertyMap) + } + } + + jar { + val licenseSuffix = project.base.archivesName.get() + from("LICENSE") { + rename { "${it}_${licenseSuffix}" } + } + } + + java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + + withSourcesJar() + withJavadocJar() + } + + withType { + options.release = 21 + } + + shadowJar { + configurations = listOf(project.configurations.shadow.get()) + + val licenseSuffix = project.base.archivesName.get() + from("LICENSE") { + rename { "${it}_${licenseSuffix}" } + } + + destinationDirectory.set(layout.buildDirectory.dir("devlibs")) + + dependencies { + exclude { + it.moduleGroup == "org.slf4j" + } + } + } + + remapJar { + dependsOn(shadowJar) + inputFile.set(shadowJar.get().archiveFile) + } + + javadoc { + with (options as StandardJavadocDocletOptions) { + addStringOption("Xdoclint:none", "-quiet") + addStringOption("encoding", "UTF-8") + addStringOption("charSet", "UTF-8") + } + } + + build { + dependsOn("javadocJar") + } +} + +publishing { + publications { + create("mavenJava") { + from(components["java"]) + artifactId = "meteor-client" + + version = properties["minecraft_version"] as String + "-SNAPSHOT" + } + } +} diff --git a/gradle.properties b/gradle.properties index 5f628a9fdc..c69d88525c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,6 @@ loader_version=0.16.9 fapi_version=0.114.0+1.21.4 # Mod Properties -mod_version=0.6.0 maven_group=meteordevelopment archives_base_name=meteor-client diff --git a/launch/build.gradle.kts b/launch/build.gradle.kts new file mode 100644 index 0000000000..19fd6e6691 --- /dev/null +++ b/launch/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("java") +} + +group = "meteordevelopment" +version = "0.1.0" + +tasks { + withType { + options.release = 8 + } +} diff --git a/settings.gradle b/settings.gradle.kts similarity index 60% rename from settings.gradle rename to settings.gradle.kts index b02216baa3..a7f3f56dd3 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -1,8 +1,8 @@ pluginManagement { repositories { maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' + name = "Fabric" + url = uri("https://maven.fabricmc.net/") } mavenCentral() gradlePluginPortal() diff --git a/src/main/java/meteordevelopment/meteorclient/MeteorClient.java b/src/main/java/meteordevelopment/meteorclient/MeteorClient.java index a68b9abaa0..84ac72d08d 100644 --- a/src/main/java/meteordevelopment/meteorclient/MeteorClient.java +++ b/src/main/java/meteordevelopment/meteorclient/MeteorClient.java @@ -46,8 +46,8 @@ public class MeteorClient implements ClientModInitializer { public static final String MOD_ID = "meteor-client"; public static final ModMetadata MOD_META; public static final String NAME; - public static final Version VERSION; - public static final String DEV_BUILD = ""; + public static final Version VERSION; + public static final String BUILD_NUMBER = ""; public static MeteorClient INSTANCE; public static MeteorAddon ADDON; @@ -63,8 +63,8 @@ public class MeteorClient implements ClientModInitializer { NAME = MOD_META.getName(); LOG = LoggerFactory.getLogger(NAME); - String versionString = MOD_META.getVersion().getFriendlyString(); - if (versionString.contains("-")) versionString = versionString.split("-")[0]; + String versionString = MOD_META.getVersion().getFriendlyString() + .split("[-+]")[0]; // When building and running through IntelliJ and not Gradle it doesn't replace the version so just use a dummy if (versionString.equals("${version}")) versionString = "0.0.0";