145 lines
4.2 KiB
Groovy
145 lines
4.2 KiB
Groovy
import java.util.stream.Collectors
|
|
import net.fabricmc.loom.util.gradle.SourceSetHelper
|
|
|
|
plugins {
|
|
id("quiet-fabric-loom")
|
|
id 'maven-publish'
|
|
}
|
|
|
|
boolean gui = enable_gui == "true"
|
|
if (gui) {
|
|
sourceSets.create("gui")
|
|
loom.createRemapConfigurations(sourceSets.gui)
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
mappings loom.officialMojangMappings()
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
|
|
|
|
runtimeOnly(project(":").sourceSets.main.output)
|
|
shadow(project(":"))
|
|
compileOnly(project(":"))
|
|
|
|
libs("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}") { setTransitive(false) }
|
|
libs("ca.spottedleaf:yamlconfig:${rootProject.yamlconfig_version}") { setTransitive(false) }
|
|
libs("org.yaml:snakeyaml:${rootProject.snakeyaml_version}")
|
|
|
|
if (gui) {
|
|
guiCompileOnly(project(":"))
|
|
runtimeOnly(sourceSets.gui.output)
|
|
shadow(sourceSets.gui.output)
|
|
modGuiImplementation "me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_version}"
|
|
modRuntimeOnly "me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_version}"
|
|
include "me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_version}"
|
|
modGuiImplementation "com.terraformersmc:modmenu:${rootProject.modmenu_version}"
|
|
modRuntimeOnly "com.terraformersmc:modmenu:${rootProject.modmenu_version}"
|
|
}
|
|
|
|
modImplementation platform(fabricApiLibs.bom)
|
|
modImplementation fabricApiLibs.command.api.v2
|
|
modImplementation fabricApiLibs.lifecycle.events.v1
|
|
include fabricApiLibs.command.api.v2
|
|
include fabricApiLibs.base
|
|
}
|
|
|
|
if (gui) {
|
|
afterEvaluate {
|
|
configurations.guiCompileOnly {
|
|
extendsFrom configurations.getByName("minecraftNamedCompile")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.processResources {
|
|
def properties = [
|
|
"version": project.version,
|
|
"minecraft_version": minecraft_version,
|
|
"loader_version": loader_version,
|
|
"mod_version": mod_version
|
|
]
|
|
inputs.properties(properties)
|
|
filesMatching("fabric.mod.json") {
|
|
expand properties
|
|
}
|
|
}
|
|
|
|
tasks.shadowJar {
|
|
archiveClassifier = "dev-all"
|
|
destinationDirectory = layout.buildDirectory.dir("libs")
|
|
configurations = [project.configurations.shadow]
|
|
relocate 'ca.spottedleaf.concurrentutil', 'ca.spottedleaf.moonrise.libs.ca.spottedleaf.concurrentutil'
|
|
relocate 'ca.spottedleaf.yamlconfig', 'ca.spottedleaf.moonrise.libs.ca.spottedleaf.yamlconfig'
|
|
relocate 'org.yaml.snakeyaml', 'ca.spottedleaf.moonrise.libs.org.yaml.snakeyaml'
|
|
}
|
|
|
|
publishMods {
|
|
file = remapJar.archiveFile
|
|
modLoaders = ["fabric"]
|
|
|
|
modrinth {
|
|
incompatible(
|
|
"notenoughcrashes",
|
|
"starlight",
|
|
"c2me-fabric"
|
|
)
|
|
}
|
|
curseforge {
|
|
incompatible(
|
|
"not-enough-crashes",
|
|
"starlight",
|
|
"c2me"
|
|
)
|
|
}
|
|
}
|
|
|
|
loom {
|
|
accessWidenerPath.set(getRootProject().file("src/main/resources/moonrise.accesswidener"))
|
|
mixin {
|
|
useLegacyMixinAp = false
|
|
}
|
|
runs.configureEach {
|
|
ideConfigGenerated true
|
|
}
|
|
mods {
|
|
main {
|
|
sourceSet("main")
|
|
sourceSet("main", project.rootProject)
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.test {
|
|
def classPathGroups = SourceSetHelper.getClasspath(loom.mods.main, getProject()).stream()
|
|
.map(File.&getAbsolutePath)
|
|
.collect(Collectors.joining(File.pathSeparator))
|
|
|
|
systemProperty("fabric.classPathGroups", classPathGroups)
|
|
}
|
|
|
|
afterEvaluate {
|
|
loom.runs.configureEach { cfg ->
|
|
runConfigCommon.systemProperties.get().each {
|
|
cfg.property it.key, it.value
|
|
}
|
|
}
|
|
}
|
|
|
|
// Setup a run with lithium for compatibility testing
|
|
sourceSets.create("lithium")
|
|
loom {
|
|
createRemapConfigurations(sourceSets.lithium)
|
|
runs {
|
|
register("lithiumClient") {
|
|
client()
|
|
}
|
|
}
|
|
}
|
|
configurations.modLithiumRuntimeOnly {
|
|
extendsFrom configurations.lithium
|
|
}
|
|
tasks.named("runLithiumClient", net.fabricmc.loom.task.RunGameTask.class) {
|
|
getClasspath().from(configurations.modRuntimeClasspathLithiumMapped)
|
|
}
|