/* * Iris is a World Generator for Minecraft Servers * Copyright (c) 2026 Arcane Arts (Volmit Software) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.api.tasks.compile.JavaCompile import org.gradle.jvm.toolchain.JavaLanguageVersion plugins { id 'java' id 'net.fabricmc.fabric-loom' version '1.17.11' alias(libs.plugins.shadow) } Properties rootProperties = new Properties() file('../../gradle.properties').withInputStream { InputStream stream -> rootProperties.load(stream) } String irisVersion = providers.gradleProperty('irisVersion').getOrElse(rootProperties.getProperty('irisVersion', '4.0.0-26.2')) String minecraftVersion = providers.gradleProperty('minecraftVersion').getOrElse(rootProperties.getProperty('minecraftVersion', '26.2')) String fabricLoaderVersion = providers.gradleProperty('fabricLoaderVersion').getOrElse(rootProperties.getProperty('fabricLoaderVersion', '0.19.3')) Closure irisArtifactName = { String platform, String targetVersion -> return "Iris v${project.version} [${platform}] ${targetVersion}.jar" } group = 'art.arcane' version = irisVersion java { toolchain { languageVersion = JavaLanguageVersion.of(25) } } sourceSets { main { java { srcDir '../modded-common/src/main/java' } resources { srcDir '../modded-common/src/main/resources' } } } repositories { mavenCentral() maven { name = 'FabricMC' url = uri('https://maven.fabricmc.net/') } maven { url = uri('https://repo.codemc.org/repository/maven-public/') } maven { url = uri('https://jitpack.io') } maven { url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') } } configurations { bundle { canBeConsumed = false canBeResolved = true } devBundle { canBeConsumed = false canBeResolved = true } } configurations.named('bundle').configure { exclude(group: 'com.google.code.gson') exclude(group: 'com.google.guava') exclude(group: 'commons-io') exclude(group: 'org.apache.commons', module: 'commons-lang3') exclude(group: 'it.unimi.dsi', module: 'fastutil') exclude(group: 'org.slf4j') exclude(group: 'org.apache.logging.log4j') exclude(group: 'de.crazydev22.slimjar.helper') exclude(group: 'de.crazydev22.slimjar') exclude(group: 'io.github.slimjar') } configurations.compileClasspath.extendsFrom(configurations.devBundle) configurations.runtimeClasspath.extendsFrom(configurations.devBundle) configurations.create('jij') { transitive = true } dependencies { minecraft("com.mojang:minecraft:${minecraftVersion}") implementation("net.fabricmc:fabric-loader:${fabricLoaderVersion}") jij('net.fabricmc.fabric-api:fabric-api-base:2.0.4+ece063239e') jij('net.fabricmc.fabric-api:fabric-registry-sync-v0:7.1.0+c7bd5b8e9e') jij('net.fabricmc.fabric-api:fabric-resource-loader-v1:2.0.13+9edec1269e') jij('net.fabricmc.fabric-api:fabric-lifecycle-events-v1:4.1.3+4575b05f9e') jij('net.fabricmc.fabric-api:fabric-command-api-v2:3.1.0+00cb03469e') jij('net.fabricmc.fabric-api:fabric-events-interaction-v0:5.2.6+8f57f7ee9e') implementation('net.fabricmc.fabric-api:fabric-api-base:2.0.4+ece063239e') implementation('net.fabricmc.fabric-api:fabric-registry-sync-v0:7.1.0+c7bd5b8e9e') implementation('net.fabricmc.fabric-api:fabric-resource-loader-v1:2.0.13+9edec1269e') implementation('net.fabricmc.fabric-api:fabric-lifecycle-events-v1:4.1.3+4575b05f9e') implementation('net.fabricmc.fabric-api:fabric-command-api-v2:3.1.0+00cb03469e') implementation('net.fabricmc.fabric-api:fabric-events-interaction-v0:5.2.6+8f57f7ee9e') compileOnly('org.slf4j:slf4j-api:2.0.17') compileOnly(libs.spigot) { transitive = false } List shared = [ "art.arcane:core:${irisVersion}".toString(), "art.arcane:spi:${irisVersion}".toString(), 'com.github.VolmitSoftware:VolmLib:master-SNAPSHOT', libs.paralithic, libs.lru, libs.kotlin.stdlib, libs.kotlin.coroutines, libs.commons.lang, libs.commons.math3, libs.caffeine, libs.lz4, libs.zip, libs.sentry, libs.oshi, libs.byteBuddy.core, libs.byteBuddy.agent ] shared.each { Object notation -> add('bundle', notation) add('devBundle', notation) } } tasks.named('compileJava', JavaCompile).configure { options.encoding = 'UTF-8' options.release.set(25) } loom { accessWidenerPath = file('src/main/resources/irisworldgen.accesswidener') runs { server { String parity = providers.gradleProperty('irisParity').getOrNull() if (parity != null) { property('iris.parity', parity) } String parityGolden = providers.gradleProperty('irisParityGolden').getOrNull() if (parityGolden != null) { property('iris.parity.golden', parityGolden) } String parityDeep = providers.gradleProperty('irisParityDeep').getOrNull() if (parityDeep != null) { property('iris.parity.deep', parityDeep) } String worldCheck = providers.gradleProperty('irisWorldCheck').getOrNull() if (worldCheck != null) { property('iris.worldcheck', worldCheck) } vmArg('-Xmx8G') programArgs('nogui') } } } processResources { inputs.property('version', project.version) inputs.property('minecraftVersion', minecraftVersion) filesMatching('fabric.mod.json') { expand('version': project.version, 'minecraftVersion': minecraftVersion) } } tasks.named('shadowJar', ShadowJar).configure { doFirst { delete(layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-fabric.jar")) } archiveFileName.set(irisArtifactName('Fabric', "${minecraftVersion}+${fabricLoaderVersion}")) configurations = [project.configurations.named('bundle').get()] mergeServiceFiles() exclude('META-INF/maven/**') exclude('META-INF/proguard/**') exclude('META-INF/*.SF') exclude('META-INF/*.DSA') exclude('META-INF/*.RSA') duplicatesStrategy = DuplicatesStrategy.EXCLUDE relocate('org.objectweb.asm', 'art.arcane.iris.shadow.asm') exclude('oshi.properties') from(project.configurations.named('jij')) { into('META-INF/jars') rename { String fileName -> fileName.replaceAll(/-[0-9][^-]*\.jar$/, '.jar') } } } tasks.named('assemble').configure { dependsOn(tasks.named('shadowJar')) }