quaedam/quilt/build.gradle.kts
xtex dca1482526
feat: add quilt support
It is not working at all
2023-08-01 16:56:38 +08:00

86 lines
2.5 KiB
Plaintext

plugins {
id("com.github.johnrengelman.shadow")
}
architectury {
platformSetupLoomIde()
loader("quilt")
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
val developmentQuilt: Configuration by configurations.getting
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
developmentQuilt.extendsFrom(common)
}
dependencies {
modImplementation("org.quiltmc:quilt-loader:${rootProject.property("quilt_loader_version")}")
modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.property("quilt_fabric_version")}")
modApi("dev.architectury:architectury-fabric:${rootProject.property("architectury_version")}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
modApi("org.quiltmc:qsl:${rootProject.property("quilt_standard_library_version")}")
modApi("org.quiltmc.quilt-kotlin-libraries:quilt-kotlin-libraries:${rootProject.property("quilt_kotlin_libraries_version")}")
common(project(":common", "namedElements")) {
isTransitive = false
}
shadowCommon(project(":common", "transformProductionQuilt")) {
isTransitive = false
}
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("quilt.mod.json") {
expand(
mapOf(
"version" to project.version,
"minecraft_version" to rootProject.property("minecraft_version"),
"architectury_version" to rootProject.property("architectury_version"),
"quilt_kotlin_libraries_version" to rootProject.property("quilt_kotlin_libraries_version"),
)
)
}
}
tasks.shadowJar {
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()
}
}