mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-07-13 02:15:46 +00:00
246 lines
8.3 KiB
Groovy
246 lines
8.3 KiB
Groovy
/*
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
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.minecraftforge.gradle' version '7.0.27'
|
|
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 forgeVersion = providers.gradleProperty('forgeVersion').getOrElse(rootProperties.getProperty('forgeVersion', '26.2-65.0.0'))
|
|
String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate').getOrElse(rootProperties.getProperty('volmLibCoordinate', 'com.github.VolmitSoftware:VolmLib:cdf7e8bb880199734dacd386a6616bda799fcde1'))
|
|
Closure<String> loaderDisplayVersion = { String loaderVersion ->
|
|
String coordinatePrefix = "${minecraftVersion}-"
|
|
if (loaderVersion.startsWith(coordinatePrefix)) {
|
|
return loaderVersion.substring(coordinatePrefix.length())
|
|
}
|
|
|
|
return loaderVersion
|
|
}
|
|
Closure<String> 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'
|
|
srcDir '../client-common/src/main/java'
|
|
}
|
|
resources {
|
|
srcDir '../modded-common/src/main/resources'
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
minecraft.mavenizer(it)
|
|
maven fg.forgeMaven
|
|
maven fg.minecraftLibsMaven
|
|
mavenCentral()
|
|
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
|
|
}
|
|
runBundle {
|
|
canBeConsumed = false
|
|
canBeResolved = true
|
|
}
|
|
commonsLangRaw {
|
|
canBeConsumed = false
|
|
canBeResolved = true
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
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.named('runBundle').configure {
|
|
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.runBundle)
|
|
|
|
['compileClasspath', 'runtimeClasspath'].each { String name ->
|
|
configurations.named(name).configure {
|
|
resolutionStrategy.capabilitiesResolution.withCapability('org.lz4:lz4-java') {
|
|
selectHighestVersion()
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation minecraft.dependency("net.minecraftforge:forge:${forgeVersion}")
|
|
compileOnly('org.slf4j:slf4j-api:2.0.17')
|
|
compileOnly(libs.spigot) {
|
|
transitive = false
|
|
}
|
|
|
|
List<Object> shared = [
|
|
"art.arcane:core:${irisVersion}".toString(),
|
|
"art.arcane:spi:${irisVersion}".toString(),
|
|
volmLibCoordinate,
|
|
libs.paralithic,
|
|
libs.lru,
|
|
libs.kotlin.stdlib,
|
|
libs.kotlin.coroutines,
|
|
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)
|
|
add('runBundle', notation)
|
|
}
|
|
add('bundle', libs.commons.lang)
|
|
add('devBundle', libs.commons.lang)
|
|
add('commonsLangRaw', libs.commons.lang)
|
|
}
|
|
|
|
TaskProvider<Jar> sanitizedCommonsLang = tasks.register('sanitizedCommonsLang', Jar) {
|
|
archiveBaseName.set('commons-lang-sanitized')
|
|
destinationDirectory.set(layout.buildDirectory.dir('sanitized'))
|
|
from({ zipTree(configurations.named('commonsLangRaw').get().singleFile) })
|
|
exclude('org/apache/commons/lang/enum/**')
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
dependencies {
|
|
add('runBundle', files(sanitizedCommonsLang))
|
|
}
|
|
|
|
minecraft {
|
|
accessTransformer.from(file('src/main/resources/META-INF/accesstransformer.cfg'))
|
|
runs {
|
|
register('server') {
|
|
workingDir = layout.projectDirectory.dir('run')
|
|
String parity = providers.gradleProperty('irisParity').getOrNull()
|
|
if (parity != null) {
|
|
systemProperty('iris.parity', parity)
|
|
}
|
|
String parityGolden = providers.gradleProperty('irisParityGolden').getOrNull()
|
|
if (parityGolden != null) {
|
|
systemProperty('iris.parity.golden', parityGolden)
|
|
}
|
|
String parityDeep = providers.gradleProperty('irisParityDeep').getOrNull()
|
|
if (parityDeep != null) {
|
|
systemProperty('iris.parity.deep', parityDeep)
|
|
}
|
|
String worldCheck = providers.gradleProperty('irisWorldCheck').getOrNull()
|
|
if (worldCheck != null) {
|
|
systemProperty('iris.worldcheck', worldCheck)
|
|
}
|
|
jvmArgs('-Xmx8G')
|
|
args('--nogui')
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.named('compileJava', JavaCompile).configure {
|
|
options.encoding = 'UTF-8'
|
|
options.release.set(25)
|
|
}
|
|
|
|
processResources {
|
|
inputs.property('version', project.version)
|
|
inputs.property('minecraftVersion', minecraftVersion)
|
|
filesMatching('META-INF/mods.toml') {
|
|
expand('version': project.version, 'minecraftVersion': minecraftVersion)
|
|
}
|
|
}
|
|
|
|
tasks.named('shadowJar', ShadowJar).configure {
|
|
doFirst {
|
|
delete(layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-forge.jar"))
|
|
}
|
|
archiveFileName.set(irisArtifactName('Forge', "${minecraftVersion}+${loaderDisplayVersion(forgeVersion)}"))
|
|
configurations = [project.configurations.named('bundle').get()]
|
|
from(sourceSets.main.output)
|
|
mergeServiceFiles()
|
|
exclude('META-INF/maven/**')
|
|
exclude('META-INF/proguard/**')
|
|
exclude('META-INF/*.SF')
|
|
exclude('META-INF/*.DSA')
|
|
exclude('META-INF/*.RSA')
|
|
exclude('org/apache/commons/lang/enum/**')
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
relocate('org.objectweb.asm', 'art.arcane.iris.shadow.asm')
|
|
relocate('io.sentry', 'art.arcane.iris.shadow.sentry')
|
|
relocate('com.sun.jna', 'art.arcane.iris.shadow.jna')
|
|
relocate('oshi', 'art.arcane.iris.shadow.oshi')
|
|
relocate('net.jpountz', 'art.arcane.iris.shadow.jpountz')
|
|
exclude('oshi.properties')
|
|
exclude('org/jspecify/**')
|
|
exclude('com/google/errorprone/**')
|
|
exclude('com/google/j2objc/**')
|
|
exclude('org/checkerframework/**')
|
|
exclude('org/jetbrains/annotations/**')
|
|
exclude('org/intellij/lang/**')
|
|
}
|
|
|
|
tasks.named('assemble').configure {
|
|
dependsOn(tasks.named('shadowJar'))
|
|
}
|