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 { apply(plugin = "forgified-fabric-loom") apply(plugin = "com.github.johnrengelman.shadow") dependencies { "minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}") } } allprojects { apply(plugin = "java") apply(plugin = "architectury-plugin") java { targetCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11 } tasks { withType(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class) { relocate("kotlin", "${rootProject.group}.kotlin") relocate("fr.username404.sharplapis", "${rootProject.group}.${rootProject.name.toLowerCase()}.${this@allprojects.name}") } withType(Jar::class) { manifest.attributes["Main-Class"] = "$groupAndName.installer.InstallerKt" from("$rootDir/LICENSE") 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" release.set(8) isFork = true } } withType(net.fabricmc.loom.task.RemapJarTask::class) { if (!archiveBaseName.get().startsWith("common")) destinationDirectory.set(file("$rootDir/remappedJars")) } withType(ProcessResources::class) { val modVersionPair: Pair = "mod_version" to (rootProject.version as String) filesMatching("fabric.mod.json") { expand(modVersionPair) } from(sourceSets.main.get().resources.srcDirs) { include("META-INF/mods.toml") expand(mutableMapOf(modVersionPair)) } from(sourceSets.main.get().resources.srcDirs) { exclude("META-INF/mods.toml") } inputs.property("mod_version" , rootProject.version) } } }