From a18bc3742d525c05378c3334df59525a30d78130 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 12 Aug 2023 20:10:44 +0200 Subject: [PATCH] start --- build.gradle.kts | 47 ++++++++++++++++++++++++--------------------- libs.versions.toml | 38 ++++++++++++++++++++++++++++++++++++ root.gradle.kts | 2 +- settings.gradle.kts | 10 +++++++++- 4 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 552bcf5..e2281dd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,8 +22,8 @@ import com.matthewprenger.cursegradle.Options import gg.essential.gradle.util.* plugins { - kotlin("jvm") version "1.6.10" - kotlin("plugin.serialization") version "1.4.21" + alias(libs.plugins.kotlin) + //kotlin("plugin.serialization") version "1.8.22" id("gg.essential.multi-version") id("gg.essential.defaults") id("com.github.johnrengelman.shadow") @@ -52,7 +52,7 @@ base { archivesName.set("$mod_name (${getMcVersionStr()}-${platform.loaderStr})") } -tasks.compileKotlin.setJvmDefault(if (platform.mcVersion >= 11400) "all" else "all-compatibility") +//tasks.compileKotlin.setJvmDefault(if (platform.mcVersion >= 11400) "all" else "all-compatibility") loom.noServerRunConfigs() loom { /*if (project.platform.isLegacyForge) launchConfigs.named("client") { @@ -78,39 +78,42 @@ val shade: Configuration by configurations.creating { } dependencies { - val elementaVersion = "590+markdown" - val universalVersion = "277" val elementaPlatform: String? by project val universalPlatform: String? by project - val essentialPlatform: String? by project if (platform.isFabric) { val fabricApiVersion: String by project val fabricLanguageKotlinVersion: String by project modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion") modImplementation("net.fabricmc:fabric-language-kotlin:$fabricLanguageKotlinVersion") - modCompileOnly("gg.essential:elementa-${elementaPlatform ?: platform}:$elementaVersion") - modImplementation("include"("gg.essential:universalcraft-${universalPlatform ?: platform}:$universalVersion")!!) + modCompileOnly("gg.essential:elementa-${elementaPlatform ?: platform}:${libs.versions.elementa}") + modImplementation("include"("gg.essential:universalcraft-${universalPlatform ?: platform}:${libs.versions.universal}")!!) } else if (platform.isForge) { - compileOnly("gg.essential:essential-${essentialPlatform ?: platform}:4166+ge3c5b9d02") if (platform.isLegacyForge) { - shade("gg.essential:loader-launchwrapper:1.1.3") { + /*shade("gg.essential:loader-launchwrapper:1.1.3") { isTransitive = false - } + }*/ + shade(libs.bundles.kotlin) { isTransitive = false } annotationProcessor("org.spongepowered:mixin:0.8.5:processor") compileOnly("org.spongepowered:mixin:0.8.5") } else { val kotlinForForgeVersion: String by project - runtimeOnly("thedarkcolour:kotlinforforge:$kotlinForForgeVersion") - shade("gg.essential:universalcraft-${universalPlatform ?: platform}:$universalVersion") { - isTransitive = false - } + implementation("thedarkcolour:kotlinforforge:$kotlinForForgeVersion") + } + shade("gg.essential:universalcraft-${universalPlatform ?: platform}:${libs.versions.universal}") { + isTransitive = false + } + } + listOf(libs.bundles.twelvemonkeys, libs.caffeine).forEach { + if (platform.isFabric) { + implementation(it) + include(it) + } else { + shade(it) { isTransitive = false } } } - shade("gg.essential:elementa-${elementaPlatform ?: platform}:$elementaVersion") { + shade("gg.essential:elementa-${elementaPlatform ?: platform}:${libs.versions.elementa}") { isTransitive = false } - shade("com.github.ben-manes.caffeine:caffeine:2.9.3") - shade("com.twelvemonkeys.imageio:imageio-webp:3.9.4") } tasks.processResources { @@ -160,10 +163,10 @@ tasks { configurations = listOf(shade) duplicatesStrategy = DuplicatesStrategy.EXCLUDE mergeServiceFiles() - relocate("com.github.benmanes.caffeine", "dev.dediamondpro.resourcify.libs.caffeine") - relocate("com.twelvemonkeys", "dev.dediamondpro.resourcify.libs.twelvemonkeys") - relocate("gg.essential.elementa", "dev.dediamondpro.resourcify.libs.elementa") - if (platform.isForge && !platform.isLegacyForge) { + if (platform.isForge) { + relocate("com.github.benmanes.caffeine", "dev.dediamondpro.resourcify.libs.caffeine") + relocate("com.twelvemonkeys", "dev.dediamondpro.resourcify.libs.twelvemonkeys") + relocate("gg.essential.elementa", "dev.dediamondpro.resourcify.libs.elementa") relocate("gg.essential.universal", "dev.dediamondpro.resourcify.libs.universal") } } diff --git a/libs.versions.toml b/libs.versions.toml new file mode 100644 index 0000000..696f0df --- /dev/null +++ b/libs.versions.toml @@ -0,0 +1,38 @@ +[versions] +kotlin = "1.8.22" +caffeine = "2.9.3" +twelvemonkeys = "3.9.4" +universal = "277" +elementa = "590+markdown" + +[libraries] +# Kotlin +kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } + +# Caching +caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" } + +# Image Dependencies +twelvemonkeys_core = { module = "com.twelvemonkeys.imageio:imageio-core", version.ref = "twelvemonkeys" } +twelvemonkeys_webp = { module = "com.twelvemonkeys.imageio:imageio-webp", version.ref = "twelvemonkeys" } +twelvemonkeys_metadata = { module = "com.twelvemonkeys.imageio:imageio-metadata", version.ref = "twelvemonkeys" } +twelvemonkeys_lang = { module = "com.twelvemonkeys.common:common-lang", version.ref = "twelvemonkeys" } +twelvemonkeys_io = { module = "com.twelvemonkeys.common:common-io", version.ref = "twelvemonkeys" } +twelvemonkeys_image = { module = "com.twelvemonkeys.common:common-image", version.ref = "twelvemonkeys" } + +[plugins] +# Kotlin +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } + +[bundles] +kotlin = [ + "kotlin" +] +twelvemonkeys = [ + "twelvemonkeys_core", + "twelvemonkeys_webp", + "twelvemonkeys_metadata", + "twelvemonkeys_lang", + "twelvemonkeys_io", + "twelvemonkeys_image" +] \ No newline at end of file diff --git a/root.gradle.kts b/root.gradle.kts index 1da764d..d2d225e 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -16,7 +16,7 @@ */ plugins { - kotlin("jvm") version "1.6.10" apply false + alias(libs.plugins.kotlin) apply false id("net.kyori.blossom") version "1.3.0" apply false id("com.github.johnrengelman.shadow") version "7.1.2" apply false id("gg.essential.multi-version.root") diff --git a/settings.gradle.kts b/settings.gradle.kts index 87d6b39..816b69d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,11 +25,19 @@ pluginManagement { maven("https://repo.essential.gg/repository/maven-public") } plugins { - val egtVersion = "0.2.1" + val egtVersion = "0.2.2" id("gg.essential.multi-version.root") version egtVersion } } +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("libs.versions.toml")) + } + } +} + val mod_name: String by settings rootProject.name = mod_name