240 lines
6.6 KiB
Groovy
240 lines
6.6 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id 'idea'
|
|
id 'net.neoforged.moddev' version '2.0.141'
|
|
id("com.modrinth.minotaur") version '2.+'
|
|
id("com.matthewprenger.cursegradle") version '1.4.0'
|
|
}
|
|
|
|
version = '4.0'
|
|
group = 'thedarkcolour.exdeorum'
|
|
base {
|
|
archivesName = 'exdeorum'
|
|
}
|
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
|
|
java.toolchain.vendor = JvmVendorSpec.JETBRAINS
|
|
java.withSourcesJar()
|
|
|
|
evaluationDependsOn(":coremod")
|
|
|
|
neoForge {
|
|
version = neo_version
|
|
|
|
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
|
|
|
|
runs {
|
|
configureEach {
|
|
logLevel = org.slf4j.event.Level.DEBUG
|
|
jvmArgument '-XX:+AllowEnhancedClassRedefinition'
|
|
}
|
|
|
|
client {
|
|
client()
|
|
}
|
|
|
|
server {
|
|
server()
|
|
gameDirectory.set(project.layout.projectDirectory.dir('run/server'))
|
|
programArgument '--nogui'
|
|
}
|
|
|
|
data {
|
|
clientData()
|
|
programArguments.addAll('--mod', 'exdeorum', '--output', file('src/generated/resources/').absolutePath, '--existing', file('src/main/resources/').absolutePath)
|
|
}
|
|
}
|
|
|
|
mods {
|
|
"${mod_id}" {
|
|
sourceSet(sourceSets.main)
|
|
}
|
|
coremod {
|
|
sourceSet project(':coremod').sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
// Include resources generated by data generators.
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
|
|
// Exclude compat packages for libraries without 1.26.1 support yet
|
|
sourceSets.main.java.exclude(
|
|
'**/compat/emi/**',
|
|
'**/compat/jade/**',
|
|
'**/compat/kubejs/**',
|
|
'**/compat/top/**'
|
|
)
|
|
|
|
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 = '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'
|
|
// Required for KubeJS
|
|
includeGroup 'com.github.rtyley'
|
|
}
|
|
}
|
|
maven {
|
|
name = 'EMI'
|
|
url = 'https://maven.terraformersmc.com'
|
|
content { includeGroup 'dev.emi' }
|
|
}
|
|
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
|
|
//compileOnly("mcjty.theoneprobe:theoneprobe:1.21_neo-${top_version}") {
|
|
// transitive = false
|
|
//}
|
|
// JADE OPTIONAL
|
|
//implementation("curse.maven:jade-324717:6291517")
|
|
// JEI OPTIONAL
|
|
compileOnly("mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}")
|
|
runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
|
|
// EMI OPTIONAL
|
|
//compileOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}:api")
|
|
//runtimeOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}")
|
|
// KubeJS OPTIONAL
|
|
//implementation("dev.architectury:architectury-neoforge:${architectury_version}")
|
|
//implementation("dev.latvian.mods:rhino:${rhino_version}")
|
|
//implementation("dev.latvian.mods:kubejs-neoforge:${kubejs_version}")
|
|
|
|
// ModKit DEV ONLY
|
|
implementation('com.github.thedarkcolour:ModKit:944589c2a7')
|
|
|
|
// Core mod
|
|
implementation(project(':coremod'))
|
|
jarJar(project(':coremod'))
|
|
|
|
// 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")
|
|
//compileOnly("curse.maven:alltheores-405593:5500624")
|
|
//implementation("curse.maven:inventorysorter-240633:4655091")
|
|
//implementation("curse.maven:cyclic-239286:4994392")
|
|
//implementation("curse.maven:flib-661261:4724762")
|
|
}
|
|
|
|
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/neoforge.mods.toml']) {
|
|
expand replaceProperties
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
|
}
|
|
|
|
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("NeoForge")
|
|
addGameVersion("Java 21")
|
|
|
|
mainArtifact(jar.archiveFile) {
|
|
displayName = "Ex Deorum ${project.version}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
modrinth {
|
|
token = System.getenv("MODRINTH_TOKEN")
|
|
projectId = "WP0FLyzv"
|
|
versionName = "Ex Deorum ${project.version}"
|
|
gameVersions = [mc_version]
|
|
loaders = ["neoforge"]
|
|
changelog = getChangelog(project.version)
|
|
|
|
uploadFile = jar
|
|
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}"
|
|
}
|