diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 31aa26ac..0e05f0b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,7 +68,7 @@ jobs: path: '**/build/reports' - name: Run all tests with Gradle - run: ./gradlew check detekt sonar --info --no-daemon + run: ./gradlew check detekt --info --no-daemon env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle.kts b/build.gradle.kts index 485cc524..28960a61 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +@file:Suppress("UnstableApiUsage") + import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.dokka.gradle.DokkaTaskPartial import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -24,10 +26,6 @@ plugins { jacoco } -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get())) -} - reckon { stages("rc", "final") setScopeCalc(calcScopeFromProp().or(calcScopeFromCommitMessages())) @@ -86,31 +84,27 @@ tasks { } } +testing { + suites { + val test by getting(JvmTestSuite::class) { + useJUnitJupiter() + } + } +} + val kotlinSrcSet = "/src/main/kotlin" subprojects.forEach { subProject -> subProject.tasks { val kotlinVersion = libs.versions.kotlin.get() val kotlinApiLangVersion = kotlinVersion.subSequence(0, 3).toString() - val jvmTargetVersion = libs.versions.java.get() withType().configureEach { kotlinOptions { apiVersion = kotlinApiLangVersion languageVersion = kotlinApiLangVersion - jvmTarget = jvmTargetVersion - freeCompilerArgs = freeCompilerArgs + listOf("-opt-in=kotlin.RequiresOptIn") } } - withType().configureEach { - sourceCompatibility = jvmTargetVersion - targetCompatibility = jvmTargetVersion - } - withType { - useJUnitPlatform { - includeEngines("junit-jupiter", "kotest") - } - } withType().configureEach { dokkaSourceSets { configureEach { diff --git a/gradle-plugins/build.gradle.kts b/gradle-plugins/build.gradle.kts index 50f4aa10..2f27a8ac 100644 --- a/gradle-plugins/build.gradle.kts +++ b/gradle-plugins/build.gradle.kts @@ -1,3 +1,11 @@ +plugins { + kotlin("jvm") version "1.8.10" +} + +kotlin { + jvmToolchain(11) +} + val buildTask = tasks.register("buildPlugins") subprojects { diff --git a/gradle-plugins/publishing/build.gradle.kts b/gradle-plugins/publishing/build.gradle.kts index dabbac8a..c026ca9c 100644 --- a/gradle-plugins/publishing/build.gradle.kts +++ b/gradle-plugins/publishing/build.gradle.kts @@ -9,10 +9,6 @@ dependencies { implementation(libs.plugin.detekt) } -tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile::class.java).configureEach { - kotlinOptions.jvmTarget = libs.versions.java.get() -} - detekt { buildUponDefaultConfig = true config.from(file("../../config/detekt/detekt.yml")) diff --git a/gradle-plugins/verification/build.gradle.kts b/gradle-plugins/verification/build.gradle.kts index 5724351c..7a244b76 100644 --- a/gradle-plugins/verification/build.gradle.kts +++ b/gradle-plugins/verification/build.gradle.kts @@ -11,10 +11,6 @@ dependencies { implementation(libs.plugin.detekt) } -tasks.withType(KotlinJvmCompile::class.java).configureEach { - kotlinOptions.jvmTarget = libs.versions.java.get() -} - detekt { buildUponDefaultConfig = true config.from(file("../../config/detekt/detekt.yml")) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3e2a145a..8453a70a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,6 @@ nexusPublish = "1.1.0" reckon = "0.16.1" rxjava = "2.2.21" sonarqube = "3.5.0.2730" -testSets = "4.0.0" versions = "0.45.0" [libraries] @@ -40,8 +39,7 @@ plugin-reckon = { module = "org.ajoberstar.reckon:reckon-gradle", version.ref = [bundles] kotlin = ["kotlin-stdlib", "kotlin-reflect", "coroutines-core"] -testDeps = ["junitJupiter-api", "kotest-framework-api", "mockk", "kluent", "assertj-core"] -testEngines = ["junitJupiter-engine", "kotest-runner-junit5"] +testDeps = ["junitJupiter-api", "kotest-runner-junit5", "kotest-framework-api", "mockk", "kluent", "assertj-core"] [plugins] asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" } @@ -51,5 +49,4 @@ gitPublish = { id = "org.ajoberstar.git-publish", version.ref = "gitPublish" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublish" } reckon = { id = "org.ajoberstar.reckon", version.ref = "reckon" } sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" } -testSets = { id = "org.unbroken-dome.test-sets", version.ref = "testSets" } versions = { id = "com.github.ben-manes.versions", version.ref = "versions" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33c..42defcc9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/subprojects/kris-core/kris-core.gradle.kts b/subprojects/kris-core/kris-core.gradle.kts index 27e1a3b9..45b9cb18 100644 --- a/subprojects/kris-core/kris-core.gradle.kts +++ b/subprojects/kris-core/kris-core.gradle.kts @@ -14,11 +14,11 @@ dependencies { implementation(libs.coroutines.rx2) testImplementation(libs.bundles.testDeps) - testRuntimeOnly(libs.bundles.testEngines) } kotlin { explicitApi() + jvmToolchain(libs.versions.java.get().toInt()) } tasks { diff --git a/subprojects/kris-guide/kris-guide.gradle.kts b/subprojects/kris-guide/kris-guide.gradle.kts index bc0fd1a0..7e79756c 100644 --- a/subprojects/kris-guide/kris-guide.gradle.kts +++ b/subprojects/kris-guide/kris-guide.gradle.kts @@ -1,16 +1,10 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { `java-library` kotlin("jvm") } -tasks { - withType().configureEach { - kotlinOptions { - jvmTarget = libs.versions.java.get() - } - } +kotlin { + jvmToolchain(libs.versions.java.get().toInt()) } dependencies { @@ -19,5 +13,4 @@ dependencies { implementation(libs.bundles.kotlin) testImplementation(libs.bundles.testDeps) - testRuntimeOnly(libs.bundles.testEngines) } diff --git a/subprojects/kris-io/kris-io.gradle.kts b/subprojects/kris-io/kris-io.gradle.kts index 7d942956..8d597113 100644 --- a/subprojects/kris-io/kris-io.gradle.kts +++ b/subprojects/kris-io/kris-io.gradle.kts @@ -4,21 +4,44 @@ plugins { id("kris-publish") id("kris-jacoco") kotlin("jvm") - alias(libs.plugins.testSets) + `jvm-test-suite` alias(libs.plugins.dokka) } kotlin { explicitApi() + jvmToolchain(libs.versions.java.get().toInt()) } -testSets { - create("integrationTest") +testing { + suites { + val test by getting(JvmTestSuite::class) { + useJUnitJupiter() + } + + val integrationTest by registering(JvmTestSuite::class) { + dependencies { + implementation(project()) + } + + targets { + all { + testTask.configure { + shouldRunAfter(test) + } + } + } + } + } +} + +val integrationTestImplementation by configurations.getting { + extendsFrom(configurations.testImplementation.get()) } tasks { named("check") { - dependsOn("integrationTest") + dependsOn(testing.suites.named("integrationTest")) } val javadocJar by existing(Jar::class) { group = JavaBasePlugin.DOCUMENTATION_GROUP @@ -37,5 +60,4 @@ dependencies { implementation(libs.bundles.kotlin) testImplementation(libs.bundles.testDeps) - testRuntimeOnly(libs.bundles.testEngines) }