170 lines
4.8 KiB
Groovy
170 lines
4.8 KiB
Groovy
plugins {
|
|
id "com.github.johnrengelman.shadow" version "7.0.0"
|
|
}
|
|
|
|
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
|
|
|
loom {
|
|
accessWidenerPath.set(project(":common").file("src/main/resources/lod.accesswidener"))
|
|
}
|
|
|
|
architectury {
|
|
platformSetupLoomIde()
|
|
fabric()
|
|
}
|
|
|
|
configurations {
|
|
compileClasspath.extendsFrom common
|
|
runtimeClasspath.extendsFrom common
|
|
developmentFabric.extendsFrom common
|
|
|
|
addModJar
|
|
include.extendsFrom addModJar
|
|
modImplementation.extendsFrom addModJar
|
|
}
|
|
|
|
repositories {
|
|
// Required for ModMenu
|
|
maven { url "https://maven.terraformersmc.com/" }
|
|
}
|
|
|
|
def addMod(path, enabled) {
|
|
if (enabled == "2")
|
|
dependencies { modImplementation(path) }
|
|
else if (enabled == "1")
|
|
dependencies { modCompileOnly(path) }
|
|
}
|
|
|
|
dependencies {
|
|
// Fabric loader
|
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
|
|
|
// Fabric API
|
|
addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version))
|
|
addModJar(fabricApi.module("fabric-key-binding-api-v1", rootProject.fabric_api_version))
|
|
addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version))
|
|
|
|
// Mod Menu
|
|
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") {
|
|
exclude(group: "net.fabricmc.fabric-api")
|
|
}
|
|
|
|
// Sodium
|
|
addMod("curse.maven:sodium-394468:${rootProject.sodium_version}", rootProject.enable_sodium)
|
|
implementation "org.joml:joml:1.10.2"
|
|
|
|
// Lithium
|
|
addMod("maven.modrinth:lithium:${rootProject.lithium_version}", rootProject.enable_lithium)
|
|
|
|
// Iris
|
|
addMod("maven.modrinth:iris:${rootProject.iris_version}", rootProject.enable_iris)
|
|
|
|
// Immersive Portals
|
|
/*
|
|
modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${rootProject.immersive_portals_version}") {
|
|
exclude(group: "net.fabricmc.fabric-api")
|
|
transitive(false)
|
|
}
|
|
modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version}") {
|
|
exclude(group: "net.fabricmc.fabric-api")
|
|
transitive(false)
|
|
}
|
|
modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version}") {
|
|
exclude(group: "net.fabricmc.fabric-api")
|
|
transitive(false)
|
|
}
|
|
*/
|
|
|
|
|
|
|
|
// Toml
|
|
shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {}
|
|
|
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
|
shadowMe(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
|
|
|
// Compression
|
|
common 'org.tukaani:xz:1.9'
|
|
common 'org.apache.commons:commons-compress:1.21'
|
|
shadowMe 'org.tukaani:xz:1.9'
|
|
shadowMe 'org.apache.commons:commons-compress:1.21'
|
|
}
|
|
|
|
// This method copies the access wideners from the common project to the fabric project. And it was generated by Github Copilot
|
|
task copyAccessWidener(type: Copy) {
|
|
from project(":common").file("src/main/resources/lod.accesswidener")
|
|
into file("src/generated/resources")
|
|
}
|
|
|
|
task copyCoreResources(type: Copy) {
|
|
from fileTree(project(":core").file("src/main/resources"))
|
|
into file("build/resources/main")
|
|
}
|
|
|
|
task deleteResources(type: Delete) {
|
|
delete file("build/resources/main")
|
|
}
|
|
|
|
task copyCommonResources(type: Copy) {
|
|
from fileTree(project(":common").file("src/main/resources"))
|
|
into file("build/resources/main")
|
|
}
|
|
|
|
runClient {
|
|
dependsOn(copyCoreResources)
|
|
dependsOn(copyCommonResources)
|
|
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
|
finalizedBy(deleteResources)
|
|
}
|
|
|
|
processResources {
|
|
dependsOn(copyAccessWidener)
|
|
}
|
|
|
|
shadowJar {
|
|
configurations = [project.configurations.shadowMe]
|
|
relocate 'org.tukaani', 'shaded.tukaani'
|
|
relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress'
|
|
relocate 'com.electronwill.nightconfig', 'shaded.electronwill.nightconfig'
|
|
|
|
relocate 'com.seibel.lod.common', 'fabric.com.seibel.lod.common'
|
|
|
|
classifier "dev-shadow"
|
|
}
|
|
|
|
remapJar {
|
|
input.set shadowJar.archiveFile
|
|
dependsOn shadowJar
|
|
classifier null
|
|
}
|
|
|
|
jar {
|
|
classifier "dev"
|
|
}
|
|
|
|
sourcesJar {
|
|
def commonSources = project(":common").sourcesJar
|
|
dependsOn commonSources
|
|
from commonSources.archiveFile.map { zipTree(it) }
|
|
}
|
|
|
|
components.java {
|
|
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
|
skip()
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenFabric(MavenPublication) {
|
|
artifactId = rootProject.archives_base_name + "-" + project.name
|
|
from components.java
|
|
}
|
|
}
|
|
|
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
repositories {
|
|
// Add repositories to publish to here.
|
|
}
|
|
}
|