ExDeorum/build.gradle
Jeremy 6a7cf80e41 Added Thirst Was Taken to test environment
This allows easier testing for TWT compatibility and some common uses for fluid NBT (TWT uses it for water purity levels)
2026-01-08 12:47:01 -05:00

265 lines
7.8 KiB
Groovy

plugins {
id('idea')
id('com.modrinth.minotaur') version "2.+"
id('com.matthewprenger.cursegradle') version "1.4.0"
id('net.neoforged.moddev.legacyforge') version '2.0.80'
id('org.jetbrains.gradle.plugin.idea-ext') version "1.1.9"
}
version = '1.48'
group = 'thedarkcolour.exdeorum'
base.archivesName = 'exdeorum'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
legacyForge {
version = "${mc_version}-${forge_version}"
accessTransformers = files('src/main/resources/META-INF/accesstransformer.cfg')
parchment {
mappingsVersion = project.parchment_mappings
minecraftVersion = project.mc_version
}
runs {
configureEach {
logLevel = org.slf4j.event.Level.DEBUG
jvmArgument '-XX:+AllowEnhancedClassRedefinition'
jvmArgument '-XX:+IgnoreUnrecognizedVMOptions'
}
client {
client()
//property 'mixin.env.remapRefMap', 'true'
//property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
}
server {
server()
gameDirectory.set(project.layout.projectDirectory.dir('run/server'))
programArgument '--nogui'
}
data {
data()
programArguments.addAll('--mod', 'exdeorum', '--all', '--output', file('src/generated/resources/').absolutePath, '--existing', file('src/main/resources/').absolutePath)
}
}
mods {
exdeorum {
sourceSet sourceSets.main
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenCentral()
maven {
name = 'McJty maven'
url = 'https://maven.k-4u.nl'
content { includeGroup 'mcjty.theoneprobe' }
}
maven {
name = 'jei'
url = 'https://maven.blamejared.com/'
content { includeGroup "mezz.jei" }
}
maven {
name = 'rei'
url = "https://maven.shedaniel.me"
}
maven {
name = 'Architectury API'
url = "https://maven.architectury.dev"
content { includeGroup "dev.architectury" }
}
maven {
name = 'KubeJS and Rhino'
url = "https://maven.latvian.dev/releases"
content { includeGroupAndSubgroups "dev.latvian" }
}
maven {
name = 'ModKit'
url 'https://jitpack.io'
content { includeGroup 'com.github.thedarkcolour' }
}
maven {
name = 'TerraformersMC'
url = 'https://maven.terraformersmc.com'
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeModule("maven.modrinth", "oculus")
includeModule("maven.modrinth", "embeddium")
}
}
maven {
url "https://cursemaven.com"
content { includeGroup "curse.maven" }
}
}
dependencies {
// TOP OPTIONAL
modCompileOnly("mcjty.theoneprobe:theoneprobe:1.20.1-${top_version}") {
transitive = false
}
// JADE OPTIONAL
modImplementation("curse.maven:jade-324717:4986594")
// JEI OPTIONAL
modCompileOnly("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
modCompileOnly("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
modRuntimeOnly("mezz.jei:jei-${mc_version}-forge:${jei_version}")
// REI OPTIONAL
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")
modCompileOnly("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}")
modCompileOnly("curse.maven:reipc-521393:4837449")
// EMI OPTIONAL
modCompileOnly("dev.emi:emi-forge:${emi_version}:api")
//modRuntimeOnly("dev.emi:emi-forge:${emi_version}")
// KubeJS OPTIONAL
modImplementation("dev.architectury:architectury-forge:${architectury_version}")
modImplementation("dev.latvian.mods:rhino-forge:${rhino_version}")
modImplementation("dev.latvian.mods:kubejs-forge:${kubejs_version}")
// ModKit DEV ONLY
modImplementation('com.github.thedarkcolour:ModKit:cc8f1c11ec')
// Oculus + Embeddium OPTIONAL
modCompileOnly('maven.modrinth:oculus:1.20.1-1.6.9')
modCompileOnly('maven.modrinth:embeddium:0.2.12+mc1.20.1')
// testing
//modImplementation("curse.maven:allthecompressed-514045:4938351")
modImplementation("curse.maven:inventory-tweaks-refoxed-976858:5315928")
//modImplementation("curse.maven:inventorysorter-240633:4655091")
modImplementation("curse.maven:cyclic-239286:4994392")
modImplementation("curse.maven:flib-661261:4724762")
modImplementation("curse.maven:thirst-was-taken-679270:6660408")
// DEV ONLY
compileOnly('org.jetbrains:annotations:23.0.0')
}
test {
useJUnitPlatform()
}
def replaceProperties = [mc_version: mc_version, mod_version: version]
processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project
filesMatching(['META-INF/mods.toml']) {
expand replaceProperties
}
// Minify JSON resources
// Actual reduction in file size is just a few KB, but why not?
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file ->
//noinspection UnnecessaryQualifiedReference
try {
file.text = groovy.json.JsonOutput.toJson(new groovy.json.JsonSlurper().parse(file))
} catch (Exception e) {
println "Unable to minify file ${file.name}"
throw new RuntimeException(e)
}
}
}
}
jar {
manifest {
attributes([
"Specification-Title" : "exdeorum",
"Specification-Vendor" : "exdeorumsareus",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : "${version}",
"Implementation-Vendor" : "exdeorumsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
if (System.getenv("CURSEFORGE_TOKEN")) {
curseforge {
apiKey = System.getenv("CURSEFORGE_TOKEN")
project {
id = "901420"
changelogType = "markdown"
changelog = getChangelog(project.version)
releaseType = "release"
addGameVersion(mc_version)
addGameVersion("Forge")
addGameVersion("NeoForge")
addGameVersion("Java 17")
mainArtifact(reobfJar.archiveFile) {
displayName = "Ex Deorum ${project.version}"
}
}
}
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "WP0FLyzv"
versionName = "Ex Deorum ${project.version}"
gameVersions = [mc_version]
loaders = ["forge", "neoforge"]
changelog = getChangelog(project.version)
uploadFile = reobfJar
additionalFiles.add(sourcesJar)
}
static def getChangelog(Object version) {
version = version.toString()
def file = new File('changelog.md')
if (!file.exists()) {
return "Changelog file not found"
}
// Relies on the changelog block being "##blahblahblah_VERSION" where _ is a space
def content = file.text.normalize().split("##.* ")
for (final def chunk in content) {
if (chunk.isEmpty()) continue
def lineTerminatorIndex = chunk.findIndexOf { c -> c == '\n' || c == '\r' }
def versionString = chunk.substring(0, lineTerminatorIndex)
if (versionString == version) {
return "## Ex Deorum $version\n" + chunk.substring(lineTerminatorIndex + 1)
}
}
// Fallback in case this fails
return "Ex Deorum Update ${version}"
}