From eaf318bcc4c6fb92ad4f9b106d89d77f552a8ed3 Mon Sep 17 00:00:00 2001 From: Jun Sekine Date: Tue, 31 Dec 2024 10:15:59 +0900 Subject: [PATCH 1/5] [skip ci] use Version catalog --- build.gradle.kts | 15 +++++++-------- gradle/libs.versions.toml | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index bb521b0..2487373 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,10 +4,10 @@ import com.vanniktech.maven.publish.SonatypeHost import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - kotlin("multiplatform") version "2.1.0" - id("org.jetbrains.dokka") version "2.0.0" - id("org.jetbrains.kotlinx.kover") version "0.9.0" - id("com.vanniktech.maven.publish") version "0.30.0" + alias(libs.plugins.kotlinMultiplatform) + alias(libs.plugins.dokka) + alias(libs.plugins.kover) + alias(libs.plugins.mavenPublish) } group = "com.jsoizo" @@ -47,14 +47,13 @@ kotlin { jvm().compilations["main"].defaultSourceSet { dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") + implementation(libs.kotlinx.coroutines.core) } } jvm().compilations["test"].defaultSourceSet { dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") - implementation("io.kotest:kotest-runner-junit5:5.9.1") - implementation("io.kotest:kotest-assertions-core:5.9.1") + implementation(libs.kotest.runner.junit5) + implementation(libs.kotest.assertions.core) } } js().compilations["main"].defaultSourceSet { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..6008707 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,19 @@ +[versions] +kotlin = "2.1.0" +coroutines = "1.10.1" +maven-publish = "0.30.0" +kover = "0.8.2" +dokka = "2.0.0" +kotest = "5.9.1" + +[libraries] +#kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" } +kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } + +[plugins] +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" } From d1f52a072567c83e03815ffaf1da73a18f813d77 Mon Sep 17 00:00:00 2001 From: Jun Sekine Date: Tue, 31 Dec 2024 10:20:46 +0900 Subject: [PATCH 2/5] bundle kotest libraries --- build.gradle.kts | 3 +-- gradle/libs.versions.toml | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2487373..aea2dfc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,8 +52,7 @@ kotlin { } jvm().compilations["test"].defaultSourceSet { dependencies { - implementation(libs.kotest.runner.junit5) - implementation(libs.kotest.assertions.core) + implementation(libs.bundles.kotest) } } js().compilations["main"].defaultSourceSet { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6008707..03bd3a9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,6 +12,9 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" } kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } +[bundles] +kotest = ["kotest-runner-junit5", "kotest-assertions-core"] + [plugins] kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } From 748198e5b036a9361a2384d8f1698423093a85f9 Mon Sep 17 00:00:00 2001 From: Jun Sekine Date: Tue, 31 Dec 2024 13:45:59 +0900 Subject: [PATCH 3/5] bundle kotest libraries --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 3adc68f..1d4920e 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -29,7 +29,7 @@ jobs: path: | ~/.gradle/caches ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} restore-keys: | ${{ runner.os }}-gradle- From a2a1c425dc614514be870524e1d128ac82a532cc Mon Sep 17 00:00:00 2001 From: Jun Sekine Date: Tue, 31 Dec 2024 14:14:53 +0900 Subject: [PATCH 4/5] change CI setup-java version --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1d4920e..052444f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -18,7 +18,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '8' + java-version: '11' - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 From c42d82e9938ae1ce9ea737c5eb2e26838ca08466 Mon Sep 17 00:00:00 2001 From: Jun Sekine Date: Tue, 31 Dec 2024 14:17:08 +0900 Subject: [PATCH 5/5] change CI setup-java step name --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 052444f..9a7b1af 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v4 with: distribution: 'temurin'