diff --git a/build.gradle.kts b/build.gradle.kts index edc538a..bc499d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,18 +51,18 @@ repositories { // Versions of plugins are now configured once in pluginManagement block in settings.gradle.kts. plugins { - kotlin("multiplatform") - id("io.gitlab.arturbosch.detekt") - id("org.jlleitschuh.gradle.ktlint") - id("com.github.ben-manes.versions") - id("com.android.library") - id("maven-publish") - id("co.touchlab.kmmbridge") + alias(libs.plugins.kotlinMultiplatform) + alias(libs.plugins.detektPlugin) + alias(libs.plugins.ktlinPlugin) + alias(libs.plugins.versionsPlugin) + alias(libs.plugins.androidLibrary) + `maven-publish` + alias(libs.plugins.kmmbridgePlugin) } dependencies { - detektPlugins("io.gitlab.arturbosch.detekt:detekt-cli:${properties["version.plugin.detekt"]}") - detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${properties["version.plugin.detekt"]}") + detektPlugins(libs.detektCliPlugin) + detektPlugins(libs.detektFormattingPlugin) } apply(plugin = "io.gitlab.arturbosch.detekt") @@ -138,18 +138,9 @@ kotlin { sourceSets { val commonMain by getting { dependencies { - implementation( - "co.touchlab:stately-concurrency:" + - "${properties["version.stately.concurrency"]}", - ) - implementation( - "org.jetbrains.kotlinx:kotlinx-coroutines-core:" + - "${properties["version.kotlin.coroutines"]}", - ) - implementation( - "org.jetbrains.kotlinx:kotlinx-datetime:" + - "${properties["version.kotlin.datetime"]}", - ) + implementation(libs.stately) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.datetime) } } val jvmMain by getting diff --git a/gradle.properties b/gradle.properties index 0f0d858..7c38592 100644 --- a/gradle.properties +++ b/gradle.properties @@ -42,16 +42,3 @@ android.nonTransitiveRClass=true build.android.minimumSdk=24 build.android.targetSdk=34 build.android.compileSdk=34 - -# Plugins: -version.plugin.androidGradle=8.1.2 -version.plugin.ktlintGradle=11.6.1 -version.plugin.detekt=1.23.3 -version.plugin.outdated=0.49.0 -version.plugin.kmmbridge=0.5.5 - -# Dependencies: -version.kotlin=1.9.23 -version.kotlin.coroutines=1.7.3 -version.kotlin.datetime=0.4.1 -version.stately.concurrency=1.2.3 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..8c48ab3 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,25 @@ +[versions] +kotlin="1.9.23" +coroutines="1.7.3" +datetime="0.4.1" +stately="1.2.3" +androidGradle="8.1.2" +ktlint="11.6.1" +detekt="1.23.3" +outdated="0.49.0" +kmmbridge="0.5.5" + +[libraries] +stately = { module = "co.touchlab:stately-concurrency", version.ref = "stately" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "datetime"} +detektFormattingPlugin = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } +detektCliPlugin = { module = "io.gitlab.arturbosch.detekt:detekt-cli", version.ref = "detekt" } + +[plugins] +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +detektPlugin = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +ktlinPlugin = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } +versionsPlugin = { id = "com.github.ben-manes.versions", version.ref = "outdated" } +androidLibrary = { id = "com.android.library", version.ref = "androidGradle" } +kmmbridgePlugin = { id = "co.touchlab.kmmbridge", version.ref = "kmmbridge" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 04774d3..1dd2825 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,21 +25,6 @@ pluginManagement { google() mavenCentral() } - - resolutionStrategy { - val props = extra.properties - - eachPlugin { - when ("${requested.id}") { - "org.jetbrains.kotlin.multiplatform" -> useVersion("${props["version.kotlin"]}") - "io.gitlab.arturbosch.detekt" -> useVersion("${props["version.plugin.detekt"]}") - "org.jlleitschuh.gradle.ktlint" -> useVersion("${props["version.plugin.ktlintGradle"]}") - "com.github.ben-manes.versions" -> useVersion("${props["version.plugin.outdated"]}") - "com.android.library" -> useVersion("${props["version.plugin.androidGradle"]}") - "co.touchlab.kmmbridge" -> useVersion("${props["version.plugin.kmmbridge"]}") - } - } - } } dependencyResolutionManagement {