From 4fce19bad474a2cc3f78b46b39419f38c19974ef Mon Sep 17 00:00:00 2001 From: aminecmi Date: Mon, 12 Dec 2022 22:26:12 +0100 Subject: [PATCH] Trying to set code coverage. --- .drone.yml | 2 +- androidApp/build.gradle.kts | 1 + build.gradle.kts | 17 ++++++++++++++++- shared/build.gradle.kts | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0f97e3f..73377ae 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,7 +11,7 @@ steps: - mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true\npushCache=false\nsystemProp.org.gradle.internal.http.connectionTimeout=180000\nsystemProp.org.gradle.internal.http.socketTimeout=180000" >> ~/.gradle/gradle.properties - echo "---------------------------------------------------------" - echo "Analysing..." - - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN + - ./gradlew koverMergedXmlReport && ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN - echo "---------------------------------------------------------" - echo "Building..." - ./gradlew build -x test diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index f7cb456..87c566f 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -8,6 +8,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.mikepenz.aboutlibraries.plugin") + id("org.jetbrains.kotlinx.kover") version "0.6.1" } fun Project.execWithOutput(cmd: String, ignore: Boolean = false): String { diff --git a/build.gradle.kts b/build.gradle.kts index 51f97aa..51cffac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,8 +11,9 @@ plugins { id("com.android.library").version("7.3.1").apply(false) kotlin("android").version("1.7.20").apply(false) kotlin("multiplatform").version("1.7.20").apply(false) - id("org.sonarqube").version("3.4.0.2513").apply(false) + id("org.sonarqube").version("3.4.0.2513") id("com.mikepenz.aboutlibraries.plugin").version("10.5.1").apply(false) + id("org.jetbrains.kotlinx.kover") version "0.6.1" } apply(plugin = "org.sonarqube") @@ -30,3 +31,17 @@ allprojects { tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } + + + +sonarqube { + properties { + property("sonar.coverage.jacoco.xmlReportPaths", "${rootProject.buildDir}/reports/kover/merged/xml/report.xml") + } +} + +project.tasks["sonarqube"].dependsOn "koverMergedXmlReport" + +koverMerged { + enable() +} \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index c02b27b..8408522 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -10,6 +10,7 @@ plugins { id("com.android.library") id("com.squareup.sqldelight") kotlin("plugin.serialization") version "1.4.10" + id("org.jetbrains.kotlinx.kover") version "0.6.1" } kotlin {