Files
distant-horizons-sharded/fabric/build.gradle
T
2022-01-18 00:43:13 +06:00

181 lines
4.9 KiB
Groovy

plugins {
id "com.github.johnrengelman.shadow" version "7.1.0"
id 'fabric-loom' version '0.10-SNAPSHOT'
id "com.modrinth.minotaur" version "1.2.1"
}
loom {
accessWidenerPath.set(project(":common").file("src/main/resources/lod.accesswidener"))
}
architectury {
platformSetupLoomIde()
fabric()
}
configurations {
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
}
repositories {
// Required for ModMenu
maven { url "https://maven.terraformersmc.com/" }
// Required for Sodium
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
// Required for Starlight
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}
dependencies {
// Fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
// Fabric API
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
// Mod Menu
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
// Starlight
// modImplementation "curse.maven:starlight-521783:${project.starlight_version_fabric}"
// Sodium
modImplementation "maven.modrinth:sodium:${project.sodium_version}"
implementation "org.joml:joml:1.10.2"
// Iris
// modImplementation "maven.modrinth:iris:${project.iris_version}"
// Immersive Portals
/*
modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${project.immersive_portals_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${project.immersive_portals_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
*/
// Toml
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
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)
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
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.
}
}