From f7d5a4af5c959cc74501fe6098d0d72cb5f85d5b Mon Sep 17 00:00:00 2001 From: Syer10 Date: Tue, 25 Jan 2022 21:08:12 -0500 Subject: [PATCH] Extract dependencies to versions catalog --- desktop/build.gradle.kts | 67 ++++++++++++++---------------- gradle/libs.versions.toml | 87 +++++++++++++++++++++++++++++++++++++++ settings.gradle.kts | 2 + 3 files changed, 119 insertions(+), 37 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 961c0628..5a497f78 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -24,67 +24,60 @@ dependencies { implementation(compose.uiTooling) implementation(compose.materialIconsExtended) implementation(compose("org.jetbrains.compose.ui:ui-util")) - implementation("ca.gosyer:compose-router:0.24.2-jetbrains-2") - implementation("ca.gosyer:accompanist-pager:0.18.1") - implementation("ca.gosyer:accompanist-flowlayout:0.18.1") - implementation("com.alialbaali.kamel:kamel-image:0.3.0") + implementation(libs.composeRouter) + implementation(libs.accompanistPager) + implementation(libs.accompanistFlowLayout) + implementation(libs.kamel) // UI (Swing) - implementation("com.github.weisj:darklaf-core:2.7.3") + implementation(libs.darklaf) // Threading - val coroutinesVersion = "1.6.0" - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:$coroutinesVersion") + implementation(libs.coroutinesCore) + implementation(libs.coroutinesSwing) // Json - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2") + implementation(libs.json) // Xml - val xmlutilVersion = "0.84.0" - implementation("io.github.pdvrieze.xmlutil:core-jvm:$xmlutilVersion") - implementation("io.github.pdvrieze.xmlutil:serialization-jvm:$xmlutilVersion") + implementation(libs.xmlUtilCore) + implementation(libs.xmlUtilSerialization) // Dependency Injection - val toothpickVersion = "3.1.0" - implementation("com.github.stephanenicolas.toothpick:ktp:$toothpickVersion") - kapt("com.github.stephanenicolas.toothpick:toothpick-compiler:$toothpickVersion") + implementation(libs.toothpickKsp) + kapt(libs.toothpickCompiler) // Http client - val ktorVersion = "1.6.7" - implementation("io.ktor:ktor-client-core:$ktorVersion") - implementation("io.ktor:ktor-client-okhttp:$ktorVersion") - implementation("io.ktor:ktor-client-serialization:$ktorVersion") - implementation("io.ktor:ktor-client-logging:$ktorVersion") - implementation("io.ktor:ktor-client-websockets:$ktorVersion") - implementation("io.ktor:ktor-client-auth:$ktorVersion") + implementation(libs.ktorCore) + implementation(libs.ktorOkHttp) + implementation(libs.ktorSerialization) + implementation(libs.ktorLogging) + implementation(libs.ktorWebsockets) + implementation(libs.ktorAuth) // Logging - val slf4jVersion = "1.7.32" - implementation("org.slf4j:slf4j-api:$slf4jVersion") - implementation("org.slf4j:jul-to-slf4j:$slf4jVersion") - val log4jVersion = "2.17.1" - implementation("org.apache.logging.log4j:log4j-api:$log4jVersion") - implementation("org.apache.logging.log4j:log4j-core:$log4jVersion") - implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion") - implementation("io.github.microutils:kotlin-logging-jvm:2.1.21") + implementation(libs.slf4jApi) + implementation(libs.slf4jJul) + implementation(libs.log4jApi) + implementation(libs.log4jCore) + implementation(libs.log4jSlf4j) + implementation(libs.ktlogging) // User storage - implementation("net.harawata:appdirs:1.2.1") + implementation(libs.appDirs) // Preferences - val multiplatformSettingsVersion = "0.8.1" - implementation("com.russhwolf:multiplatform-settings-jvm:$multiplatformSettingsVersion") - implementation("com.russhwolf:multiplatform-settings-serialization-jvm:$multiplatformSettingsVersion") - implementation("com.russhwolf:multiplatform-settings-coroutines-jvm:$multiplatformSettingsVersion") + implementation(libs.multiplatformSettingsCore) + implementation(libs.multiplatformSettingsSerialization) + implementation(libs.multiplatformSettingsCoroutines) // Utility - implementation("io.github.kerubistan.kroki:kroki-coroutines:1.22") + implementation(libs.krokiCoroutines) // Testing testImplementation(kotlin("test-junit")) testImplementation(compose("org.jetbrains.compose.ui:ui-test-junit4")) - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") + testImplementation(libs.coroutinesTest) } java { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..89d49762 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,87 @@ +[versions] +# Kotlin +kotlin = "1.6.10" +coroutines = "1.6.0" + +# Serialization +json = "1.3.2" +xmlUtil = "0.84.0" + +# Compose +composeRouter = "0.24.2-jetbrains-2" +accompanist = "0.18.1" +kamel = "0.3.0" + +# Swing +darklaf = "2.7.3" + +# Dependency Injection +toothpick = "3.1.0" + +# Network +ktor = "1.6.7" + +# Logging +slf4j = "1.7.32" +log4j = "2.17.1" +ktlogging = "2.1.21" + +# Storage +appDirs = "1.2.1" + +# Preferences +multiplatformSettings = "0.8.1" + +# Utility +kroki = "1.22" + +[libraries] +# Kotlin +coroutinesCore = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +coroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "coroutines" } +coroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } + +# Serialization +json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "json" } +xmlUtilCore = { module = "io.github.pdvrieze.xmlutil:core-jvm", version.ref = "xmlUtil" } +xmlUtilSerialization = { module = "io.github.pdvrieze.xmlutil:serialization-jvm", version.ref = "xmlUtil" } + +# Compose +composeRouter = { module = "ca.gosyer:compose-router", version.ref = "composeRouter" } +accompanistPager = { module = "ca.gosyer:accompanist-pager", version.ref = "accompanist" } +accompanistFlowLayout = { module = "ca.gosyer:accompanist-flowlayout", version.ref = "accompanist" } +kamel = { module = "com.alialbaali.kamel:kamel-image", version.ref = "kamel" } + +# Swing +darklaf = { module = "com.github.weisj:darklaf-core", version.ref = "darklaf" } + +# Dependency Injection +toothpickKsp = { module = "com.github.stephanenicolas.toothpick:ktp", version.ref = "toothpick" } +toothpickCompiler = { module = "com.github.stephanenicolas.toothpick:toothpick-compiler", version.ref = "toothpick" } + +# Network +ktorCore = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } +ktorOkHttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } +ktorSerialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" } +ktorLogging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } +ktorWebsockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } +ktorAuth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } + +# Logging +slf4jApi = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } +slf4jJul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" } +log4jApi = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j" } +log4jCore = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } +log4jSlf4j = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "log4j" } +ktlogging = { module = "io.github.microutils:kotlin-logging-jvm", version.ref = "ktlogging" } + +# Storage +appDirs = { module = "net.harawata:appdirs", version.ref = "appDirs" } + +# Preferences +multiplatformSettingsCore = { module = "com.russhwolf:multiplatform-settings-jvm", version.ref = "multiplatformSettings" } +multiplatformSettingsSerialization = { module = "com.russhwolf:multiplatform-settings-serialization-jvm", version.ref = "multiplatformSettings" } +multiplatformSettingsCoroutines = { module = "com.russhwolf:multiplatform-settings-coroutines-jvm", version.ref = "multiplatformSettings" } + +# Utility +krokiCoroutines = { module = "io.github.kerubistan.kroki:kroki-coroutines", version.ref = "kroki" } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index faa2ef24..930a71b6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,3 +9,5 @@ pluginManagement { rootProject.name = "Tachidesk-JUI" include("desktop") + +enableFeaturePreview("VERSION_CATALOGS")