Use dependency catalog for plugins

This commit is contained in:
Niels van Velzen 2021-08-19 15:33:37 +02:00
parent 2ba07a5cd4
commit 87e76dcffa
7 changed files with 22 additions and 28 deletions

View File

@ -1,8 +1,8 @@
plugins {
id("io.github.gradle-nexus.publish-plugin").version(Plugins.Versions.nexusPublish)
id("io.gitlab.arturbosch.detekt").version(Plugins.Versions.detekt)
id("org.jetbrains.dokka").version(Plugins.Versions.dokka)
id("org.jetbrains.kotlinx.binary-compatibility-validator").version(Plugins.Versions.binaryCompatibilityValidatorVersion)
alias(libs.plugins.nexuspublish)
alias(libs.plugins.detekt)
alias(libs.plugins.dokka)
alias(libs.plugins.binarycompatibilityvalidator)
}
// Versioning
@ -18,8 +18,8 @@ buildscript {
repositories.defaultRepositories()
dependencies {
classpath(Plugins.androidBuildTools)
classpath(Plugins.kotlin)
classpath(libs.android.gradle)
classpath(libs.kotlin.gradle)
}
}

View File

@ -4,18 +4,3 @@ fun RepositoryHandler.defaultRepositories() {
mavenCentral()
google()
}
object Plugins {
object Versions {
// Kotlin version should be consistent with version catalog in /gradle/libs.versions.toml!
const val kotlin = "1.5.10"
const val binaryCompatibilityValidatorVersion = "0.6.0"
const val detekt = "1.17.1"
const val nexusPublish = "1.1.0"
const val dokka = "1.4.32"
const val androidBuildTools = "7.0.0"
}
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
const val androidBuildTools = "com.android.tools.build:gradle:${Versions.androidBuildTools}"
}

View File

@ -1,20 +1,29 @@
[versions]
kotlin = "1.5.10"
kotlinlogging = "2.0.10"
kotlin-logging = "2.0.10"
kotlinx-coroutines = "1.5.0"
kotlinx-serialization = "1.2.1"
ktor = "1.6.0"
slf4j = "1.7.31"
[plugins]
binarycompatibilityvalidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.6.0" }
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.17.1" }
dokka = { id = "org.jetbrains.dokka", version = "1.4.32" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
nexuspublish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.1.0" }
[libraries]
android-gradle = { module = "com.android.tools.build:gradle", version = "7.0.0" }
androidx-annotation = { module = "androidx.annotation:annotation", version = "1.2.0" }
androidx-core = { module = "androidx.core:core-ktx", version = "1.5.0" }
clikt = { module = "com.github.ajalt.clikt:clikt", version = "3.2.0" }
kasechange = { module = "net.pearx.kasechange:kasechange", version = "1.3.0" }
koin = { module = "io.insert-koin:koin-core", version = "3.1.0" }
kotlinlogging = { module = "io.github.microutils:kotlin-logging", version.ref = "kotlinlogging" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = "kotlin-logging" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.8.0" }
kotlinpoet = { module = "com.squareup:kotlinpoet", version = "1.8.0" }
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }

View File

@ -26,7 +26,7 @@ kotlin {
implementation(libs.ktor.core)
implementation(libs.ktor.serialization)
implementation(libs.kotlinlogging)
implementation(libs.kotlin.logging)
}
}

View File

@ -12,7 +12,7 @@ dependencies {
api(libs.ktor.http)
// Logging
implementation(libs.kotlinlogging)
implementation(libs.kotlin.logging)
testImplementation(libs.slf4j.simple)
// Testing

View File

@ -1,6 +1,6 @@
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization") version Plugins.Versions.kotlin
alias(libs.plugins.kotlin.serialization)
}
kotlin {

View File

@ -23,7 +23,7 @@ dependencies {
implementation(libs.kasechange)
// Kotlin code generation
implementation(libs.kotlinPoet)
implementation(libs.kotlinpoet)
// Dependency Injection
implementation(libs.koin)