Skip to content

Commit

Permalink
Use TOML versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikvaa committed Oct 25, 2024
1 parent e914737 commit 807a48a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 49 deletions.
33 changes: 12 additions & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
15 changes: 0 additions & 15 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 807a48a

Please sign in to comment.