quaedam/forge/build.gradle.kts
2023-06-29 20:35:27 +08:00

91 lines
2.5 KiB
Plaintext

plugins {
id("com.github.johnrengelman.shadow")
}
architectury {
platformSetupLoomIde()
forge()
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
forge.apply {
convertAccessWideners.set(true)
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
mixinConfig("quaedam-common.mixins.json")
mixinConfig("quaedam.mixins.json")
}
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
val developmentForge: Configuration by configurations.getting
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
developmentForge.extendsFrom(common)
}
repositories {
maven {
name = "Kotlin for Forge"
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
}
}
dependencies {
forge("net.minecraftforge:forge:${rootProject.property("forge_version")}")
modApi("dev.architectury:architectury-forge:${rootProject.property("architectury_version")}")
common(project(":common", "namedElements")) { isTransitive = false }
shadowCommon(project(":common", "transformProductionForge")) { isTransitive = false }
implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlin_for_forge_version")}")
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("META-INF/mods.toml") {
expand(mapOf(
"version" to project.version,
"minecraft_version" to rootProject.property("minecraft_version"),
"architectury_version" to rootProject.property("architectury_version"),
"kotlin_for_forge_version" to rootProject.property("kotlin_for_forge_version")
))
}
}
tasks.shadowJar {
exclude("fabric.mod.json")
exclude("architectury.common.json")
configurations = listOf(shadowCommon)
archiveClassifier.set("dev-shadow")
}
tasks.remapJar {
injectAccessWidener.set(true)
inputFile.set(tasks.shadowJar.get().archiveFile)
dependsOn(tasks.shadowJar)
archiveClassifier.set(null as String?)
}
tasks.jar {
archiveClassifier.set("dev")
}
tasks.sourcesJar {
val commonSources = project(":common").tasks.getByName<Jar>("sourcesJar")
dependsOn(commonSources)
from(commonSources.archiveFile.map { zipTree(it) })
}
components.getByName("java") {
this as AdhocComponentWithVariants
this.withVariantsFromConfiguration(project.configurations["shadowRuntimeElements"]) {
skip()
}
}