ExDeorum/build.gradle
2024-04-16 15:27:58 -07:00

183 lines
5.5 KiB
Groovy

plugins {
id 'java-library'
id 'idea'
id 'net.neoforged.gradle.userdev' version '7.0.105'
}
version = '2.7'
group = 'thedarkcolour.exdeorum'
base {
archivesName = 'exdeorum'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
minecraft.accessTransformers.file(rootProject.file('src/main/resources/META-INF/accesstransformer.cfg'))
runs {
configureEach {
systemProperty 'forge.logging.console.level', 'debug'
jvmArgument '-XX:+AllowEnhancedClassRedefinition'
modSource project.sourceSets.main
}
client {}
server {
programArgument '--nogui'
}
data {
// instead of using --all, skip file check validation
programArguments.addAll('--server', '--client', '--dev', '--reports')
programArguments.addAll ('--mod', 'exdeorum', '--output', file('src/generated/resources/').absolutePath, '--existing', file('src/main/resources/').absolutePath)
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
// Exclude KubeJS compat till they update todo remove when KubeJS updates
// If IntelliJ ignores this, you have to change Gradle settings to build projects using Gradle instead of IntelliJ
sourceSets {
main {
java {
exclude 'thedarkcolour/exdeorum/compat/kubejs/'
}
}
}
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.saps.dev/minecraft"
content { includeGroup "dev.latvian.mods" }
}
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 {
implementation("net.neoforged:neoforge:${neo_version}")
// TOP OPTIONAL
compileOnly("mcjty.theoneprobe:theoneprobe:${mc_version}_neo-${top_version}") {
transitive = false
}
// JADE OPTIONAL
implementation("curse.maven:jade-324717:5109393")
// JEI OPTIONAL
compileOnly("mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}")
runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
// REI OPTIONAL todo add
compileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")
compileOnly("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}")
// EMI OPTIONAL
compileOnly("dev.emi:emi-neoforge:${emi_version}:api")
runtimeOnly("dev.emi:emi-neoforge:${emi_version}")
//implementation("curse.maven:reipc-521393:4837449")
// KubeJS OPTIONAL todo add when KubeJS updates
//implementation("dev.architectury:architectury-neoforge:${architectury_version}")
//implementation("dev.latvian.mods:rhino-neoforge:${rhino_version}")
//implementation("dev.latvian.mods:kubejs-neoforge:${kubejs_version}")
// ModKit DEV ONLY
implementation('com.github.thedarkcolour:Modkit:e9334176e0')
// Oculus + Embeddium OPTIONAL
compileOnly('maven.modrinth:oculus:1.20.1-1.6.9')
compileOnly('maven.modrinth:embeddium:0.3.9+mc1.20.4')
// testing
//implementation("curse.maven:allthecompressed-514045:4938351")
//implementation("curse.maven:inventorysorter-240633:4655091")
//implementation("curse.maven:cyclic-239286:4994392")
//implementation("curse.maven:flib-661261:4724762")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
}
subsystems {
parchment {
minecraftVersion = '1.20.4'
mappingsVersion = '2024.02.25'
}
}
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
mc_version: mc_version,
mod_version: version,
neo_version_range: neo_version_range,
loader_version_range: loader_version_range
]
inputs.properties replaceProperties
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)
}
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}