From 68bd153b49e1536da01b44f6459a33f34af5d7e1 Mon Sep 17 00:00:00 2001 From: Michael Bull Date: Tue, 2 May 2023 13:22:53 +0100 Subject: [PATCH] Migrate to Gradle versions catalog --- build.gradle.kts | 27 +++++++------------ gradle/libs.versions.toml | 14 ++++++++++ .../michaelbull/logging/InlineLoggerTest.kt | 3 --- 3 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 4a4e232..66c10e5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,9 +13,10 @@ description = "A logger facilitating lazily-evaluated log calls via Kotlin's inl plugins { `maven-publish` signing - kotlin("multiplatform") version "1.8.21" - id("org.jetbrains.dokka") version "1.8.10" - id("com.github.ben-manes.versions") version "0.46.0" + + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.dokka) + alias(libs.plugins.versions) } tasks.withType { @@ -40,14 +41,16 @@ repositories { } kotlin { + jvmToolchain(8) + sourceSets { - named("commonMain") { + commonMain { dependencies { implementation(kotlin("stdlib-common")) } } - named("commonTest") { + commonTest { dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) @@ -57,27 +60,17 @@ kotlin { jvm { compilations.named("main") { - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs = listOf("-Xno-call-assertions", "-Xno-receiver-assertions", "-Xno-param-assertions") - } - dependencies { implementation(kotlin("stdlib-jdk8")) - implementation("org.slf4j:slf4j-api:2.0.7") + implementation(libs.slf4j.api) } } compilations.named("test") { - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs = listOf("-Xno-call-assertions", "-Xno-receiver-assertions", "-Xno-param-assertions") - } - dependencies { implementation(kotlin("test")) implementation(kotlin("test-junit")) - implementation("org.slf4j:slf4j-jdk14:2.0.7") + implementation(libs.slf4j.jdk14) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..fa21a72 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,14 @@ +[versions] +kotlin = "1.8.10" +dokka = "1.8.10" +slf4j = "2.0.7" +versions-plugin = "0.46.0" + +[libraries] +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } +slf4j-jdk14 = { module = "org.slf4j:slf4j-jdk14", version.ref = "slf4j" } + +[plugins] +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +versions = { id = "com.github.ben-manes.versions", version.ref = "versions-plugin" } diff --git a/src/jvmTest/kotlin/com/github/michaelbull/logging/InlineLoggerTest.kt b/src/jvmTest/kotlin/com/github/michaelbull/logging/InlineLoggerTest.kt index a0b6e60..7e5d6ef 100644 --- a/src/jvmTest/kotlin/com/github/michaelbull/logging/InlineLoggerTest.kt +++ b/src/jvmTest/kotlin/com/github/michaelbull/logging/InlineLoggerTest.kt @@ -1,5 +1,3 @@ -@file:Suppress("unused") - package com.github.michaelbull.logging import kotlin.test.Test @@ -24,5 +22,4 @@ class InlineLoggerTest { val logger = InlineLogger() assertEquals("com.github.michaelbull.logging.InlineLoggerTest", logger.name) } - }