2021-04-08 12:54:54 +02:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2021-04-08 10:18:46 +02:00
|
|
|
plugins {
|
|
|
|
kotlin("jvm") version "1.5.0-M2"
|
|
|
|
id("com.github.johnrengelman.shadow") version "6.1.0" apply false
|
|
|
|
id("architectury-plugin") version "3.0-SNAPSHOT"
|
|
|
|
id("forgified-fabric-loom") version "0.6-SNAPSHOT" apply false
|
|
|
|
}
|
|
|
|
|
|
|
|
group = "fr.username404"
|
|
|
|
version = "0.0.1"
|
|
|
|
val groupAndName = "${rootProject.group}.${rootProject.name.toLowerCase()}"
|
|
|
|
|
|
|
|
architectury {
|
|
|
|
minecraft = rootProject.property("minecraft") as String
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
2021-04-08 13:23:45 +02:00
|
|
|
lateinit var MappingsDep: Dependency
|
2021-04-08 10:52:09 +02:00
|
|
|
apply(plugin = "org.jetbrains.kotlin.jvm")
|
2021-04-08 10:18:46 +02:00
|
|
|
apply(plugin = "forgified-fabric-loom")
|
|
|
|
apply(plugin = "com.github.johnrengelman.shadow")
|
2021-04-08 12:57:08 +02:00
|
|
|
val shadowC by configurations.creating
|
|
|
|
tasks.withType(ShadowJar::class) { this.configurations = listOf(shadowC) }
|
2021-04-08 13:23:45 +02:00
|
|
|
extensions.configure<net.fabricmc.loom.LoomGradleExtension>("loom") {
|
|
|
|
MappingsDep = officialMojangMappings()
|
|
|
|
silentMojangMappingsLicense()
|
|
|
|
mixinConfig("snowygui-mixins.json")
|
|
|
|
refmapName = "snowygui-common-refmap.json"
|
|
|
|
}
|
2021-04-08 16:22:38 +02:00
|
|
|
this.sourceSets {
|
|
|
|
main {
|
|
|
|
resources {
|
|
|
|
val commonRes = project(":common").sourceSets.main.get().resources
|
|
|
|
if (!this.srcDirs.containsAll(commonRes.srcDirs)) {
|
|
|
|
srcDir(commonRes.srcDirs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-08 10:18:46 +02:00
|
|
|
dependencies {
|
2021-04-08 12:54:54 +02:00
|
|
|
shadowC(kotlin("stdlib-jdk8"))
|
2021-04-08 10:18:46 +02:00
|
|
|
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
|
2021-04-08 13:23:45 +02:00
|
|
|
"mappings"(MappingsDep)
|
2021-04-08 10:18:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
apply(plugin = "java")
|
|
|
|
apply(plugin = "architectury-plugin")
|
|
|
|
java {
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
2021-04-08 11:35:51 +02:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
2021-04-08 10:18:46 +02:00
|
|
|
}
|
|
|
|
tasks {
|
2021-04-08 12:54:54 +02:00
|
|
|
withType(ShadowJar::class) {
|
2021-04-08 10:18:46 +02:00
|
|
|
relocate("kotlin", "${rootProject.group}.kotlin")
|
2021-04-08 12:54:54 +02:00
|
|
|
archiveClassifier.set("shadow")
|
2021-04-08 10:18:46 +02:00
|
|
|
}
|
|
|
|
withType(Jar::class) {
|
2021-04-08 12:54:54 +02:00
|
|
|
manifest.attributes["Main-Class"] = "$groupAndName.exec.InfoKt"
|
|
|
|
from("$rootDir/LICENSE.txt")
|
2021-04-08 10:18:46 +02:00
|
|
|
archiveBaseName.set("${rootProject.name}-${rootProject.version}")
|
|
|
|
}
|
|
|
|
withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
|
|
|
with(kotlinOptions) {
|
|
|
|
freeCompilerArgs = listOf("-Xjvm-default=all")
|
|
|
|
useIR = true
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
languageVersion = "1.5"
|
|
|
|
apiVersion = "1.5"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
withType(JavaCompile::class) {
|
|
|
|
with(options) {
|
|
|
|
encoding = "UTF-8"
|
2021-04-08 11:35:51 +02:00
|
|
|
if (JavaVersion.current().isJava9Compatible) {
|
|
|
|
release.set(8)
|
|
|
|
}; isFork = true
|
2021-04-08 10:18:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
withType(net.fabricmc.loom.task.RemapJarTask::class) {
|
2021-04-08 12:54:54 +02:00
|
|
|
val shadowTask = getByName("shadowJar") as ShadowJar
|
|
|
|
dependsOn(shadowTask)
|
|
|
|
archiveBaseName.set(shadowTask.archiveBaseName)
|
|
|
|
input.set(shadowTask.archiveFile)
|
|
|
|
archiveClassifier.set(this@allprojects.name)
|
2021-04-08 14:13:37 +02:00
|
|
|
if (!archiveFileName.get().contains("common")) destinationDirectory.set(file("$rootDir/remappedJars"))
|
2021-04-08 10:18:46 +02:00
|
|
|
}
|
|
|
|
withType(ProcessResources::class) {
|
|
|
|
val modVersionPair: Pair<String, String> = "mod_version" to (rootProject.version as String)
|
2021-04-08 15:48:07 +02:00
|
|
|
filesMatching(listOf("*.json", "*.toml")) {
|
|
|
|
expand(mutableMapOf(modVersionPair))
|
|
|
|
}
|
2021-04-08 10:18:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|