diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml index 5e0e54bc34..db319f29df 100644 --- a/.github/workflows/auto-build.yml +++ b/.github/workflows/auto-build.yml @@ -17,6 +17,7 @@ jobs: MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} MAVEN_USER: ${{ secrets.MAVEN_USER }} SNAPSHOT: true + CI: true permissions: contents: write steps: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 847d470ac3..8e70970383 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,6 +29,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + env: + CI: 'true' outputs: ver: ${{ steps.ver.outputs.version }} steps: diff --git a/build.gradle b/build.gradle index e9f03fdced..8b2b54e1dc 100644 --- a/build.gradle +++ b/build.gradle @@ -12,12 +12,14 @@ plugins { } group = maven_group - -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -// Formats the mod version to include the loader, Minecraft version, build number (if present), and '-SNAPSHOT-' if enabled. +// Formats the mod version to include the loader, Minecraft version, and '-SNAPSHOT-' if enabled. boolean isSnapshot = System.getenv("SNAPSHOT") version = "${mod_version}" + (isSnapshot ? "-SNAPSHOT" : "") +boolean isCI = System.getenv("CI") != null + +java { + toolchain.languageVersion = JavaLanguageVersion.of(17) +} sourceSets { // Include resources generated by data generators. @@ -30,53 +32,41 @@ sourceSets { srcDirs += 'src/test/java' } compileClasspath += main.output - runtimeClasspath += main.output + runtimeClasspath += main.output + main.runtimeClasspath } extra { - compileClasspath += main.output - runtimeClasspath += main.output + runtimeClasspath += main.output + main.runtimeClasspath } } -// Set up the test and extra configurations -configurations { - testImplementation.extendsFrom(implementation) - testRuntimeOnly.extendsFrom(runtimeOnly) - extraImplementation.extendsFrom(implementation) - extraRuntimeOnly.extendsFrom(runtimeOnly).transitive(false) - extraRuntimeClasspath.transitive(false) -} - obfuscation { createRemappingConfiguration(configurations.extraRuntimeOnly) } +apply from: "$rootDir/gradle/scripts/jars.gradle" apply from: "$rootDir/gradle/scripts/moddevgradle.gradle" apply from: "$rootDir/gradle/scripts/repositories.gradle" apply from: "$rootDir/dependencies.gradle" apply from: "$rootDir/gradle/scripts/resources.gradle" -apply from: "$rootDir/gradle/scripts/jars.gradle" apply from: "$rootDir/gradle/scripts/publishing.gradle" apply from: "$rootDir/gradle/scripts/spotless.gradle" -// Create run-folders for non-client configs to avoid pollution of dev envs -generateModMetadata.doFirst { - mkdir('run/server') - mkdir('run/gametest') - mkdir('run/data') -} -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" + options.compilerArgs << "-Xlint:-removal" + options.compilerArgs << "-Aquiet=true" // Suppress mixin notes } machete { // disable machete locally for faster builds - enabled = false + enabled = isCI + // Only optimize reobf jars + ignoredTasks.addAll("jar", "slimJar") + additionalTasks.addAll("reobfJar", "reobjSlimJar") } lombok { - version = "1.18.32" + version = "1.18.36" } - diff --git a/dependencies.gradle b/dependencies.gradle index 22de67e18f..39db87878d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,78 +1,60 @@ dependencies { - compileOnly 'org.jetbrains:annotations:24.1.0' + compileOnly(libs.jetbrains.annotations) // LDLib - modApi(forge.ldlib.forge) { transitive = false } - jarJar(forge.ldlib.forge) + jarJar(modApi(forge.ldlib.get())) // Registrate - modImplementation(jarJar("com.tterrag.registrate:Registrate:${forge.versions.registrate.get()}")) + jarJar(modApi(forge.registrate.get())) // Configuration - modApi(forge.configuration) - jarJar(forge.configuration) + jarJar(modApi(forge.configuration.get())) // Mixin (& Extras) - api(annotationProcessor("io.github.llamalad7:mixinextras-common:${this.forge.versions.mixinextras.get()}")) - jarJar("io.github.llamalad7:mixinextras-forge:${this.forge.versions.mixinextras.get()}") - annotationProcessor 'org.spongepowered:mixin:0.8.7:processor' - - // JEI - modCompileOnly(forge.jei.common.api) { transitive = false } - modCompileOnly(forge.jei.forge.api) { transitive = false } - modCompileOnly(forge.jei.forge.impl) { transitive = false } - - // REI - modCompileOnly(forge.rei.plugin) - modCompileOnly(forge.rei.api) - modCompileOnly(forge.rei.forge) - - // EMI - //modCompileOnly("dev.emi:emi-forge:${forge.versions.emi.get()}:api") + annotationProcessor(variantOf(libs.mixin) { classifier("processor") }) + annotationProcessor(forge.mixinExtras.common) + api(forge.mixinExtras.common) + jarJar(forge.mixinExtras.forge) + + // Recipe Viewers + modCompileOnly(forge.bundles.jei) + modCompileOnly(forge.bundles.rei) modCompileOnly(forge.emi) - // TOP - modCompileOnly(forge.theoneprobe) { transitive = false } - - // Jade + // WAILA-likes + modCompileOnly(forge.theoneprobe) modCompileOnly(forge.jade) // Curios - modCompileOnly("top.theillusivec4.curios:curios-forge:${forge.versions.curios.get()}:api") + modCompileOnly(variantOf(forge.curios) { classifier("api") }) // AE2 - modCompileOnly(forge.ae2) { transitive = false } - modCompileOnly("curse.maven:ae2wtlib-459929:5217955") + modCompileOnly(forge.ae2) + modCompileOnly(forge.ae2wtlib) // KJS - modCompileOnly(forge.kubejs) { transitive = false } + modCompileOnly(forge.kubejs) modCompileOnly(forge.architectury) modCompileOnly(forge.rhino) // Shimmer - modCompileOnly(forge.shimmer.forge) { transitive = false } - modCompileOnly("maven.modrinth:embeddium:0.3.19+mc1.20.1") - modCompileOnly("maven.modrinth:oculus:1.20.1-1.7.0") + modCompileOnly(forge.shimmer) + modCompileOnly(forge.embeddium) + modCompileOnly(forge.oculus) // JAVD - modCompileOnly(forge.javd) { transitive = false } + modCompileOnly(forge.javd) - // FTB Teams - modCompileOnly(forge.ftbteams) + // Teams modCompileOnly(forge.ftblibrary) - - // FTB Chunks - modCompileOnly(forge.ftbchunks) - - // Argonauts + modCompileOnly(forge.ftbteams) + modCompileOnly(forge.resourcefullib) modCompileOnly(forge.argonauts) - modCompileOnly(forge.resourceful) - // xaerosWorldMap + // Maps + modCompileOnly(forge.ftbchunks) modCompileOnly(forge.xaerosminimap) modCompileOnly(forge.xaerosworldmap) - - // journeyMap modCompileOnly(forge.journeymap.api) modCompileOnly(forge.journeymap.forge) @@ -81,37 +63,31 @@ dependencies { modRuntimeOnly(forge.ae2) modRuntimeOnly(forge.kotlinforforge) - // Runtime Recipe Viewers - uncomment whichever group you want to use // + // Runtime Recipe Viewers - uncomment whichever one you want to use // modRuntimeOnly(forge.emi) - // modRuntimeOnly(forge.jei.forge.impl) - -// modRuntimeOnly(forge.rei.forge) -// modRuntimeOnly(forge.architectury) -// modRuntimeOnly("me.shedaniel.cloth:cloth-config-forge:11.1.136") +// modRuntimeOnly(forge.bundles.rei.runtime) ////////////////////////////////////////////////////// // Runtime mods for dev testing with unclean client // - // Non-transitive by default // ////////////////////////////////////////////////////// modExtraRuntimeOnly(forge.javd) - modExtraRuntimeOnly("curse.maven:trenzalore-870210:4848244") + modExtraRuntimeOnly(forge.trenzalore) + modExtraRuntimeOnly(forge.curios) +// modExtraRuntimeOnly(forge.worldstripper) - modExtraRuntimeOnly(forge.kubejs) - modExtraRuntimeOnly(forge.architectury) - modExtraRuntimeOnly(forge.rhino) + modExtraRuntimeOnly(forge.bundles.kjs) - modExtraRuntimeOnly(forge.xaerosminimap) - modExtraRuntimeOnly(forge.xaerosworldmap) - modExtraRuntimeOnly(forge.journeymap.forge) - modExtraRuntimeOnly(forge.ftblibrary) modExtraRuntimeOnly(forge.ftbteams) - modExtraRuntimeOnly(forge.ftbchunks) - modExtraRuntimeOnly("top.theillusivec4.curios:curios-forge:${forge.versions.curios.get()}") - modExtraRuntimeOnly("curse.maven:spark-361579:4738952") - modExtraRuntimeOnly("curse.maven:observable-509575:5643037") +// modExtraRuntimeOnly(forge.xaerosminimap) +// modExtraRuntimeOnly(forge.xaerosworldmap) +// modExtraRuntimeOnly(forge.journeymap.forge) +// modExtraRuntimeOnly(forge.ftbchunks) + + modExtraRuntimeOnly(forge.spark) + modExtraRuntimeOnly(forge.observable) ////////////////////////// testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") diff --git a/gradle.properties b/gradle.properties index c118d9878d..87a2cf77f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,7 @@ org.gradle.jvmargs = -Xmx6G +org.gradle.java.installations.auto-download=false +org.gradle.parallel = true +org.gradle.caching = true # Mod Info mod_id = gtceu @@ -8,9 +11,4 @@ mod_description = GregTech CE Unofficial, ported from 1.12.2 mod_license = LGPL-3.0 license mod_url = https://github.com/GregTechCEu/GregTech-Modern/ mod_issue_tracker = https://github.com/GregTechCEu/GregTech-Modern/issues/ - - maven_group = com.gregtechceu.gtceu - -enabled_platforms = forge -loom.platform = forge diff --git a/gradle/forge.versions.toml b/gradle/forge.versions.toml new file mode 100644 index 0000000000..f95773557a --- /dev/null +++ b/gradle/forge.versions.toml @@ -0,0 +1,99 @@ +[versions] +ldlib = "1.0.33.b" +registrate = "MC1.20-1.3.11" +configuration = "2.2.0" +mixinExtras = "0.2.0" + +jei = "15.20.0.105" +rei = "12.1.785" +emi = "1.1.13+1.20.1" +ae2 = "15.0.18" +kubejs = "2001.6.4-build.120" +rhino = "2001.2.3-build.6" +architectury = "9.2.14" +clothconfig = "11.1.136" +theoneprobe = "1.20.1-10.0.1-3" +curios = "5.9.1+1.20.1" +kotlinforforge = "4.11.0" +shimmer = "1.20.1-0.2.4" +journeyMapApi = "1.20-1.9-SNAPSHOT" +ftblibrary = "2001.2.4" +ftbteams = "2001.3.0" +ftbchunks = "2001.3.4" + +## modrinth maven ## +jade = "11.6.3" +embeddium = "0.3.19+mc1.20.1" +oculus = "1.20.1-1.7.0" + +## cursemaven ## +worldStripper = "4578579" +javd = "4803995" +trenzalore = "4848244" +xaerosWorldMap = "5658224" +xaerosMinimap = "5773012" +journeyMap = "5789363" +resourcefullib = "5659871" +argonauts = "5263580" +ae2wtlib = "5217955" +spark = "4738952" +observable = "5643037" +ftblibrary-cm = "5567591" +ftbteams-cm = "5267190" +ftbchunks-cm = "5956390" + + +[libraries] +ldlib = { module = "com.lowdragmc.ldlib:ldlib-forge-1.20.1", version.ref = "ldlib" } +registrate = { module = "com.tterrag.registrate:Registrate", version.ref = "registrate" } +configuration = { module = "dev.toma.configuration:configuration-forge-1.20.1", version.ref = "configuration" } +mixinExtras-common = { module = "io.github.llamalad7:mixinextras-common", version.ref = "mixinExtras" } +mixinExtras-forge = { module = "io.github.llamalad7:mixinextras-forge", version.ref = "mixinExtras" } + +jei-common-api = { module = "mezz.jei:jei-1.20.1-common-api", version.ref = "jei" } +jei-forge-api = { module = "mezz.jei:jei-1.20.1-forge-api", version.ref = "jei" } +jei-forge-impl = { module = "mezz.jei:jei-1.20.1-forge", version.ref = "jei" } +rei-plugin = { module = "me.shedaniel:RoughlyEnoughItems-default-plugin-forge", version.ref = "rei" } +rei-api = { module = "me.shedaniel:RoughlyEnoughItems-api-forge", version.ref = "rei" } +rei-forge = { module = "me.shedaniel:RoughlyEnoughItems-forge", version.ref = "rei" } +emi = { module = "dev.emi:emi-forge", version.ref = "emi" } + +ae2 = { module = "appeng:appliedenergistics2-forge", version.ref = "ae2" } +kubejs = { module = "dev.latvian.mods:kubejs-forge", version.ref = "kubejs" } +rhino = { module = "dev.latvian.mods:rhino-forge", version.ref = "rhino" } +architectury = { module = "dev.architectury:architectury-forge", version.ref = "architectury" } +clothconfig = { module = "me.shedaniel.cloth:cloth-config-forge", version.ref = "clothconfig" } +theoneprobe = { module = "mcjty.theoneprobe:theoneprobe", version.ref = "theoneprobe" } +curios = { module = "top.theillusivec4.curios:curios-forge", version.ref = "curios" } +kotlinforforge = { module = "thedarkcolour:kotlinforforge", version.ref = "kotlinforforge" } +journeymap-api = { module = "info.journeymap:journeymap-api", version.ref = "journeyMapApi" } +shimmer = { module = "com.lowdragmc.shimmer:Shimmer-forge", version.ref = "shimmer" } +ftblibrary = { module = "dev.ftb.mods:ftb-library-forge", version.ref = "ftblibrary" } +ftbteams = { module = "dev.ftb.mods:ftb-teams-forge", version.ref = "ftbteams" } +ftbchunks = { module = "dev.ftb.mods:ftb-chunks-forge", version.ref = "ftbchunks" } +jade = { module = "maven.modrinth:jade", version.ref = "jade" } +embeddium = { module = "maven.modrinth:embeddium", version.ref = "embeddium" } +oculus = { module = "maven.modrinth:oculus", version.ref = "oculus" } + +worldstripper = { module = "curse.maven:worldStripper-250603", version.ref = "worldStripper" } +javd = { module = "curse.maven:javd-370890", version.ref = "javd" } +trenzalore = { module = "curse.maven:trenzalore-870210", version.ref = "trenzalore" } +xaerosworldmap = { module = "curse.maven:xaeros-world-map-317780", version.ref = "xaerosWorldMap" } +xaerosminimap = { module = "curse.maven:xaeros-minimap-263420", version.ref = "xaerosMinimap" } +journeymap-forge = { module = "curse.maven:journeymap-32274", version.ref = "journeyMap" } +resourcefullib = { module = "curse.maven:resourceful-lib-570073", version.ref = "resourcefullib" } +argonauts = { module = "curse.maven:argonauts-845833", version.ref = "argonauts" } +ae2wtlib = { module = "curse.maven:ae2wtlib-459929", version.ref = "ae2wtlib" } +spark = { module = "curse.maven:spark-361579", version.ref = "spark" } +observable = { module = "curse.maven:observable-509575", version.ref = "observable" } +## cursemaven as a backup ## +ftblibrary-cm = { module = "curse.maven:ftb-library-forge-404465", version.ref = "ftblibrary-cm" } +ftbteams-cm = { module = "curse.maven:ftb-teams-forge-404468", version.ref = "ftbteams-cm" } +ftbchunks-cm = { module = "curse.maven:ftb-chunks-forge-314906", version.ref = "ftbchunks-cm" } + +[bundles] +jei = ["jei-common-api", "jei-forge-api", "jei-forge-impl"] +rei = ["rei-plugin", "rei-forge"] +rei-runtime = ["rei-forge", "architectury", "clothconfig"] +kjs = ["kubejs", "rhino", "architectury"] + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..9f55bfd97d --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,26 @@ +[versions] +minecraft = "1.20.1" +forge = "47.3.0" +minecraftForge = "1.20.1-47.3.0" +parchment = "2023.09.03" # https://parchmentmc.org/docs/getting-started +shadow = "8.3.5" +spotless = "7.0.2" +# TODO: Update to stable MDG when https://github.com/neoforged/ModDevGradle/issues/227 is fixed +modDevGradle = "2.0.64-beta" +machete = "2.0.1" +lombok = "8.11" +jetbrains-annotations = "26.0.1" +mixin = "0.8.7" + +[libraries] +minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } +minecraftForge = { module = "net.minecraftforge:forge", version.ref = "minecraftForge" } +jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" } +mixin = { module = "org.spongepowered:mixin", version.ref = "mixin" } + +[plugins] +modDevGradle = { id = "net.neoforged.moddev.legacyforge", version.ref = "modDevGradle" } +shadow = { id = "com.gradleup.shadow", version.ref = "shadow" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +machete = { id = "io.github.p03w.machete", version.ref = "machete" } +lombok = { id = "io.freefair.lombok", version.ref = "lombok" } diff --git a/gradle/scripts/jars.gradle b/gradle/scripts/jars.gradle index 0100328a1a..a422235be7 100644 --- a/gradle/scripts/jars.gradle +++ b/gradle/scripts/jars.gradle @@ -9,20 +9,28 @@ obfuscation { } } -tasks.register('sourcesJar', Jar) { - from delombok.outputs.files - dependsOn delombok - archiveClassifier = "sources" +// Add slim and sources jar to components.java +java { + artifacts.archives(reobfSlimJar) + withSourcesJar() +} + +// Use delombok'd files for sources +sourcesJar { + exclude { + sourceSets.main.allSource.contains it.file + } + from delombok } jar.archiveClassifier = "dev" -reobfJar.archiveClassifier = "" base { archivesName = "${project.name}-${libs.versions.minecraft.get()}" } afterEvaluate { + reobfJar.archiveClassifier = "" tasks.withType(org.gradle.jvm.tasks.Jar).configureEach { destinationDirectory = file('build/libs/') manifest.attributes([ diff --git a/gradle/scripts/moddevgradle.gradle b/gradle/scripts/moddevgradle.gradle index 17ecb11344..e2de760e7d 100644 --- a/gradle/scripts/moddevgradle.gradle +++ b/gradle/scripts/moddevgradle.gradle @@ -1,12 +1,12 @@ - mixin { - add sourceSets.main, "gtceu.refmap.json" + var refmap = add sourceSets.main, "gtceu.refmap.json" + slimJar.from refmap config 'gtceu.mixins.json' } -neoForge { - // Specify the version of NeoForge to use. - version = forge.versions.minecraftForge.get() +legacyForge { + // Specify Forge version + version = libs.versions.minecraftForge.get() parchment { minecraftVersion = libs.versions.minecraft.get() @@ -17,7 +17,7 @@ neoForge { accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg') addModdingDependenciesTo(sourceSets.test) - addModdingDependenciesTo(sourceSets.extra) +// addModdingDependenciesTo(sourceSets.extra) mods { // define mod <-> source bindings diff --git a/gradle/scripts/publishing.gradle b/gradle/scripts/publishing.gradle index 76e7650e0a..8e99be43ea 100644 --- a/gradle/scripts/publishing.gradle +++ b/gradle/scripts/publishing.gradle @@ -1,19 +1,8 @@ -artifacts { - archives tasks.reobfJar - archives tasks.reobfSlimJar - archives tasks.sourcesJar -} - publishing { publications { mavenJava(MavenPublication) { - groupId = project.maven_group - artifactId = project.archivesBaseName - version = project.version - + artifactId = base.archivesName.get() from components.java - - artifact sourcesJar } } @@ -21,10 +10,10 @@ publishing { repositories { // Add repositories to publish to here. maven { - url "https://maven.gtceu.com" + url = "https://maven.gtceu.com" credentials { - username System.getenv("MAVEN_USER") - password System.getenv("MAVEN_PASSWORD") + username = System.getenv("MAVEN_USER") + password = System.getenv("MAVEN_PASSWORD") } } } diff --git a/gradle/scripts/repositories.gradle b/gradle/scripts/repositories.gradle index 393b5f3475..da520853d1 100644 --- a/gradle/scripts/repositories.gradle +++ b/gradle/scripts/repositories.gradle @@ -1,60 +1,68 @@ repositories { mavenLocal() mavenCentral() - maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Jade - maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu, EMI - maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI - maven { - url "https://cursemaven.com" - content { - includeGroup "curse.maven" - } - } // Curse Forge File - maven { - name = "Jared's maven" + + maven { // KubeJS and Rhino + name = "Saps.dev Maven" + url = "https://maven.saps.dev/minecraft" + } + + maven { // JEI + name = "Jared's Maven" url = "https://maven.blamejared.com/" - } // JEI - maven { - // location of a maven mirror for JEI files, as a fallback + } + + maven { // JEI mirror, AE2 name = "ModMaven" url = "https://modmaven.dev" - } // JEI mirror, AE2 - maven { url = "https://maven.parchmentmc.org" } // Parchment mappings - maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings - maven { url = "https://maven.firstdarkdev.xyz/snapshots" } // LDLib - maven { // Flywheel - url = "https://maven.tterrag.com/" - content { - // need to be specific here due to version overlaps - includeGroup("com.jozufozu.flywheel") - includeGroup("com.tterrag.registrate") - includeGroup("com.simibubi.create") - } } - maven { url = "https://maven.theillusivec4.top/" } // Curios - maven { // TOP - url "https://maven.k-4u.nl" + + maven { // LDLib, Shimmer + name = "FirstDarkDev Maven" + url = "https://maven.firstdarkdev.xyz/snapshots" } - maven { - // saps.dev Maven (KubeJS and Rhino) - url = "https://maven.saps.dev/minecraft" - content { - includeGroup "dev.latvian.mods" - } + + exclusiveContent { // FTB mods + forRepository { maven { url = "https://maven.ftb.dev/releases" } } + filter { includeGroup("dev.ftb.mods") } } - // JourneyMap API releases are here - maven { - name = "JourneyMap (Public)" - url = "https://jm.gserv.me/repository/maven-public/" + exclusiveContent { // TOP + forRepository { maven { url = "https://maven.k-4u.nl" } } + filter { includeGroup('mcjty.theoneprobe') } } - maven { - name = "Kotlin for Forge" - url = "https://thedarkcolour.github.io/KotlinForForge/" - content { - includeGroup "thedarkcolour" + exclusiveContent { // JourneyMap API + forRepository { maven { url = "https://jm.gserv.me/repository/maven-public/" } } + filter { includeGroup("info.journeymap") } + } + exclusiveContent { // Modrinth Maven + forRepository { maven { url = "https://api.modrinth.com/maven" } } + filter { includeGroup("maven.modrinth") } + } + exclusiveContent { // Curseforge Maven + forRepository { maven { url = "https://cursemaven.com" } } + filter { includeGroup("curse.maven") } + } + exclusiveContent { // terraformers - EMI + forRepository { maven { url = "https://maven.terraformersmc.com/releases/" } } + filter { includeGroup("dev.emi") } + } + exclusiveContent { // shedaniel - REI, architectury, cloth-config + forRepository { maven { url = "https://maven.shedaniel.me/" } } + filter { + includeGroupAndSubgroups("me.shedaniel") + includeGroup("dev.architectury") } } - maven { url "https://maven.architectury.dev/" } - maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes - maven { url 'https://jitpack.io' } // Mixin Extras, Fabric ASM + exclusiveContent { // tterrag - registrate + forRepository { maven { url = "https://maven.tterrag.com/" } } + filter { includeGroup("com.tterrag.registrate") } + } + exclusiveContent { // Curios + forRepository { maven { url = "https://maven.theillusivec4.top/" } } + filter { includeGroup('top.theillusivec4.curios')} + } + exclusiveContent { // KotlinForForge + forRepository { maven { url = "https://thedarkcolour.github.io/KotlinForForge/" } } + filter { includeGroup("thedarkcolour") } + } } diff --git a/gradle/scripts/resources.gradle b/gradle/scripts/resources.gradle index e89f53a031..34d7f2e7a7 100644 --- a/gradle/scripts/resources.gradle +++ b/gradle/scripts/resources.gradle @@ -13,16 +13,26 @@ def mod_issue_tracker = getConfig("mod_issue_tracker") String suffix = System.getenv("VERSION_SUFFIX") String version_toml = "$version" + (suffix ? "-$suffix" : "") -task printVersion { +tasks.register('printVersion') { doLast { println mod_version } } +// Create run-folders for non-client configs to avoid pollution of dev envs +tasks.matching { it.name.startsWith('prepare') }.configureEach { + doFirst { + mkdir('run') + mkdir('run/server') + mkdir('run/gametest') + mkdir('run/data') + } +} + // This block of code expands all declared replace properties in the specified resource targets. // A missing property will result in an error. Properties are expanded using ${} Groovy notation. var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { - var forgeVers = forge.versions.forgeShortVersion.get().split("\\.")[0] + var forgeVers = libs.versions.forge.get().split("\\.")[0] var replaceProperties = [ version : version_toml, mod_id : mod_id, @@ -51,4 +61,4 @@ var generateModMetadata = tasks.register("generateModMetadata", ProcessResources // this works with both building through Gradle and the IDE. sourceSets.main.resources.srcDir generateModMetadata // To avoid having to run "generateModMetadata" manually, make it run on every project reload -neoForge.ideSyncTask generateModMetadata +legacyForge.ideSyncTask generateModMetadata diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle index b5e8e9945c..7c9c44f9e7 100644 --- a/gradle/scripts/spotless.gradle +++ b/gradle/scripts/spotless.gradle @@ -3,12 +3,13 @@ // Can be locally toggled via spotless:off/spotless:on comments spotless { encoding 'UTF-8' + ratchetFrom 'origin/1.20.1' format 'misc', { target '.gitignore' trimTrailingWhitespace() - indentWithSpaces(4) + leadingTabsToSpaces() endWithNewline() } java { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023..e6441136f3 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 0d1842103b..94113f200e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787337..b740cf1339 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/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/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# 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"' +# 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 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. 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=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=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# 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. + +# 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, 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" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 477c896641..7101f8e467 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +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=. -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%" == "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%"=="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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega \ No newline at end of file +@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 diff --git a/settings.gradle b/settings.gradle index fa25ac0113..c46b849761 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,163 +13,8 @@ dependencyResolutionManagement { mavenCentral() } versionCatalogs { - // Minecraft Version - def minecraftVersion = "1.20.1" - - // Mod Dependencies Versions - // Common - def jeiVersion = "15.20.0.105" - def reiVersion = "12.1.785" - def emiVersion = "1.1.13" - def ae2Version = "15.0.18" - def kjsVersion = "2001.6.4-build.120" - def architecturyVersion = "9.2.14" - def rhinoVersion = "2001.2.3-build.6" - def auVersion = "1.20.1-0.6.0" - - // Forge - def forgeVersion = "47.1.47" - def registrateForgeVersion = "MC1.20-1.3.11" - def topForgeVersion = "1.20.1-10.0.1-3" - def jadeForgeVersion = "11.6.3" - def curiosForgeVersion = "5.9.1" - def worldStripperForgeFile = "4578579" - def javdVersion = "4803995" - def xaerosWorldMapVersion = "5658224" - def xaerosMinimapVersion = "5773012" - def journeyMapVersion = "5789363" - def journeyMapApiVersion = "1.20-1.9" - def ftbteamsForgeFile = "5267190" - def ftblibraryForgeFile = "5567591" - def ftbchunksForgeFile = "5956390" - def argonautsForgeFile = "5263580" - def resourcefulForgeFile = "5659871" - def kffVersion = "4.11.0" - - // Libs - def quiltMappingsVersion = "5" // https://lambdaurora.dev/tools/import_quilt.html - def parchmentVersion = "2023.09.03" // https://parchmentmc.org/docs/getting-started - def shadowVersion = "7.1.2" - def spotlessVersion = "6.25.0" - def modDevGradleVersion = "2.0.52-beta" - def vineFlowerVersion = "1.+" - def macheteVersion = "1.+" - def configurationVersion = "2.2.0" - def ldLibVersion = "1.0.31" - def mixinextrasVersion = "0.2.0" - def shimmerVersion = "0.2.4" - def lombokPluginVersion = "8.7.1" - forge { - version("forgeShortVersion", forgeVersion) - def minecraftForge = version("minecraftForge", "${minecraftVersion}-${forgeVersion}") - library("minecraftForge", "net.minecraftforge", "forge").versionRef(minecraftForge) - - def ldLib = version("ldlib", ldLibVersion) - library("ldlib-forge", "com.lowdragmc.ldlib", "ldlib-forge-${minecraftVersion}").versionRef(ldLib) - - def shimmer = version("shimmer", "${minecraftVersion}-${shimmerVersion}") - library("shimmer-forge", "com.lowdragmc.shimmer", "Shimmer-forge").versionRef(shimmer) - - def registrate = version("registrate", registrateForgeVersion) - library("registrate", "com.tterrag.registrate", "Registrate").versionRef(registrate) - - def jei = version("jei", jeiVersion) - library("jei-common-api", "mezz.jei", "jei-${minecraftVersion}-common-api").versionRef(jei) - library("jei-forge-api", "mezz.jei", "jei-${minecraftVersion}-forge-api").versionRef(jei) - library("jei-forge-impl", "mezz.jei", "jei-${minecraftVersion}-forge").versionRef(jei) - - def rei = version("rei", reiVersion) - library("rei-plugin", "me.shedaniel", "RoughlyEnoughItems-default-plugin-forge").versionRef(rei) - library("rei-api", "me.shedaniel", "RoughlyEnoughItems-api-forge").versionRef(rei) - library("rei-forge", "me.shedaniel", "RoughlyEnoughItems-forge").versionRef(rei) - - def emi = version("emi", emiVersion + "+" + minecraftVersion) - library("emi", "dev.emi", "emi-forge").versionRef(emi) - - def theoneprobe = version("theoneprobe", topForgeVersion) - library("theoneprobe", "mcjty.theoneprobe", "theoneprobe").versionRef(theoneprobe) - - def curios = version("curios", curiosForgeVersion + "+" + minecraftVersion) - library("curios", "top.theillusivec4.curios", "curios-forge").versionRef(curios) - - def jade = version("jade", jadeForgeVersion) - library("jade", "maven.modrinth", "jade").versionRef(jade) - - def kubejs = version("kubejs", kjsVersion) - library("kubejs", "dev.latvian.mods", "kubejs-forge").versionRef(kubejs) - def architectury = version("architectury", architecturyVersion) - library("architectury", "dev.architectury", "architectury-forge").versionRef(architectury) - def rhino = version("rhino", rhinoVersion) - library("rhino", "dev.latvian.mods", "rhino-forge").versionRef(rhino) - - def mixinextras = version("mixinextras", mixinextrasVersion) - library("mixinextras-forge", "io.github.llamalad7", "mixinextras-forge").versionRef(mixinextras) - - def configuration = version("configuration", configurationVersion) - library("configuration", "dev.toma.configuration", "configuration-forge-1.20.1").versionRef(configuration) - - def worldStripper = version("worldStripper", worldStripperForgeFile) - library("worldStripper", "curse.maven", "worldStripper-250603").versionRef(worldStripper) - - def ae2 = version("ae2", ae2Version) - library("ae2", "appeng", "appliedenergistics2-forge").versionRef(ae2) - - def xaerosWorldMap = version("xaerosWorldMap", xaerosWorldMapVersion) - library("xaerosworldmap", "curse.maven", "xaeros-world-map-317780").versionRef(xaerosWorldMap) - - def xaerosMiniMap = version("xaerosMinimap", xaerosMinimapVersion) - library("xaerosminimap", "curse.maven", "xaeros-minimap-263420").versionRef(xaerosMiniMap) - - def journeyMapApi = version("journeyMapApi", journeyMapApiVersion + "-SNAPSHOT") - library("journeymap-api", "info.journeymap", "journeymap-api").versionRef(journeyMapApi) - - def journeyMap = version("journeyMap", journeyMapVersion) - library("journeymap-forge", "curse.maven", "journeymap-32274").versionRef(journeyMap) - - def javd = version("javd", javdVersion) - library("javd", "curse.maven", "javd-370890").versionRef(javd) - - def ftbteams = version("ftbteams", ftbteamsForgeFile) - library("ftbteams", "curse.maven", "ftb-teams-forge-404468").versionRef(ftbteams) - - def ftblibrary = version("ftblibrary", ftblibraryForgeFile) - library("ftblibrary", "curse.maven", "ftb-library-forge-404465").versionRef(ftblibrary) - - def ftbchunks = version("ftbchunks", ftbchunksForgeFile) - library("ftbchunks", "curse.maven", "ftb-chunks-forge-314906").versionRef(ftbchunks) - - def argonautslib = version("argonauts", argonautsForgeFile) - library("argonauts", "curse.maven", "argonauts-845833").versionRef(argonautslib) - - def resourceful = version("resourceful", resourcefulForgeFile) - library("resourceful", "curse.maven", "resourceful-lib-570073").versionRef(resourceful) - - def kotlinForForge = version("kotlinForForge", kffVersion) - library("kotlinforforge", "thedarkcolour", "kotlinforforge").versionRef(kotlinForForge) - } - - libs { - version("quiltMappings", quiltMappingsVersion) - version("parchment", parchmentVersion) - - def minecraft = version("minecraft", minecraftVersion) - library("minecraft", "com.mojang", "minecraft").versionRef(minecraft) - - def shadow = version("shadow", shadowVersion) - plugin("shadow", "com.github.johnrengelman.shadow").versionRef(shadow) - - def spotless = version("spotless", spotlessVersion) - plugin("spotless", "com.diffplug.spotless").versionRef(spotless) - - def modDevGradle = version("modDevGradleLegacy", modDevGradleVersion) - plugin("modDevGradle", "net.neoforged.moddev.legacyforge").versionRef(modDevGradle) - - def machete = version("machete", macheteVersion) - plugin("machete", "io.github.p03w.machete").versionRef(machete) - - def lombok = version("lombok", lombokPluginVersion) - plugin("lombok", "io.freefair.lombok").versionRef(lombok) + from(files("gradle/forge.versions.toml")) } } }