diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5c36a76..31ab372 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,4 +23,4 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: ./gradlew test jacocoTestReport sonar --no-daemon --continue --info + run: ./gradlew koverXmlReport sonar --no-daemon --continue --info diff --git a/build.gradle.kts b/build.gradle.kts index 7f27ea1..4fc9118 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,13 +16,18 @@ plugins { kotlin("jvm") + id("org.jetbrains.kotlinx.kover") id("org.sonarqube") - jacoco +} + +dependencies { + kover(project(":examples")) + kover(project(":library")) } allprojects { apply(plugin = "kotlin") - apply(plugin = "jacoco") + apply(plugin = "org.jetbrains.kotlinx.kover") group = "ch.icken" version = "0.1.0-SNAPSHOT" @@ -46,12 +51,6 @@ configure(subprojects) { tasks.test { useJUnitPlatform() } - tasks.jacocoTestReport { - reports { - html.required = true - xml.required = true - } - } kotlin { jvmToolchain(11) @@ -62,6 +61,17 @@ tasks.test { useJUnitPlatform() } +koverReport { + filters { + includes { + packages( + "ch.icken.processor", + "ch.icken.query" + ) + } + } +} + //Fixes issue with circular task dependency, //see https://github.com/quarkusio/quarkus/issues/29698#issuecomment-1671861607 project.afterEvaluate { @@ -74,10 +84,3 @@ project.afterEvaluate { .filterNot { it.get().name == "processResources" }) } } - -sonar { - properties { - property("sonar.projectKey", "Thijsiez_panache-kotlin-dsl_AYsggGcmXmm3_FAoLWCF") - property("sonar.projectName", "panache-kotlin-dsl") - } -} diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 41e2070..1973ca1 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -35,6 +35,11 @@ ksp { arg("addGeneratedAnnotation", "true") } -tasks.jacocoTestReport { - sourceSets(project(":library").sourceSets["main"]) +tasks.compileKotlin { + dependsOn(tasks.compileQuarkusGeneratedSourcesJava) +} +tasks.configureEach { + if (name == "kspKotlin") { + dependsOn(tasks.compileQuarkusGeneratedSourcesJava) + } } diff --git a/gradle.properties b/gradle.properties index a5959b6..5a303a8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # -# Copyright 2023 Thijs Koppen +# Copyright 2023-2024 Thijs Koppen # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,13 @@ kotlinPoetVersion=1.15.3 mockkVersion=1.13.8 #https://github.com/tschuchortdev/kotlin-compile-testing compileTestingVersion=1.5.0 +#https://github.com/Kotlin/kotlinx-kover +koverVersion=0.7.5 #https://github.com/SonarSource/sonar-scanner-gradle sonarqubeVersion=4.4.1.3373 kotlin.code.style=official + +sonar.projectKey=Thijsiez_panache-kotlin-dsl_AYsggGcmXmm3_FAoLWCF +sonar.projectName=panache-kotlin-dsl +sonar.coverage.jacoco.xmlReportPaths=**/build/reports/kover/report.xml diff --git a/settings.gradle.kts b/settings.gradle.kts index 13a42a6..09961b0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2023 Thijs Koppen + * Copyright 2023-2024 Thijs Koppen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ pluginManagement { val quarkusVersion: String by settings val kotlinVersion: String by settings val kspVersion: String by settings + val koverVersion: String by settings val sonarqubeVersion: String by settings repositories { @@ -31,6 +32,7 @@ pluginManagement { kotlin("plugin.allopen") version kotlinVersion kotlin("plugin.jpa") version kotlinVersion id("com.google.devtools.ksp") version kspVersion + id("org.jetbrains.kotlinx.kover") version koverVersion id("org.sonarqube") version sonarqubeVersion } }