diff options
author | Leonid Startsev <sandwwraith@users.noreply.github.com> | 2021-10-29 14:41:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 14:41:49 +0300 |
commit | e721ebea476ac0c81d6642d396a1bcb10a34d301 (patch) | |
tree | e06bf169fbffa05a2411c6768a489f8dd990d75c | |
parent | c06ebb45813dead80a76349fdd408a5b52de218c (diff) | |
download | kotlinx.serialization-e721ebea476ac0c81d6642d396a1bcb10a34d301.tar.gz |
Add Kover plugin (#1733)
Co-authored-by: Sergey.Shanshin <sergey.shanshin@jetbrains.com>
-rw-r--r-- | build.gradle | 9 | ||||
-rw-r--r-- | core/build.gradle | 2 | ||||
-rw-r--r-- | formats/cbor/build.gradle | 2 | ||||
-rw-r--r-- | formats/json/build.gradle | 2 | ||||
-rw-r--r-- | formats/properties/build.gradle | 2 | ||||
-rw-r--r-- | formats/protobuf/build.gradle | 2 | ||||
-rw-r--r-- | gradle.properties | 3 | ||||
-rw-r--r-- | gradle/kover.gradle | 21 |
8 files changed, 37 insertions, 6 deletions
diff --git a/build.gradle b/build.gradle index 9f010442..23537170 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,7 @@ buildscript { "-Xopt-in=kotlinx.serialization.InternalSerializationApi", "-Xopt-in=kotlin.ExperimentalUnsignedTypes" ] + ext.koverEnabled = property('kover.enabled') ?: true /* * This property group is used to build kotlinx.serialization against Kotlin compiler snapshot. @@ -64,6 +65,7 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" + classpath "org.jetbrains.kotlinx:kover:$kover_version" classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$validator_version" classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version" classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.5.3' // Android API check @@ -158,7 +160,9 @@ subprojects { subprojects { // Can't be applied to BOM - if (project.name == "kotlinx-serialization-bom" || project.name == "benchmark") return + if (project.name == "kotlinx-serialization-bom" || project.name == "benchmark" || project.name == "guide") return + + // Animalsniffer setup apply plugin: 'ru.vyarus.animalsniffer' afterEvaluate { // Can be applied only when the project is evaluated @@ -170,6 +174,9 @@ subprojects { signature 'org.codehaus.mojo.signature:java18:1.0@signature' } } + + // Kover setup + apply from: rootProject.file("gradle/kover.gradle") } apply from: rootProject.file('gradle/compiler-version.gradle') diff --git a/core/build.gradle b/core/build.gradle index c38da01b..703c3e59 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ apply plugin: 'kotlin-multiplatform' diff --git a/formats/cbor/build.gradle b/formats/cbor/build.gradle index c62eb596..d4b77067 100644 --- a/formats/cbor/build.gradle +++ b/formats/cbor/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ apply plugin: 'kotlin-multiplatform' diff --git a/formats/json/build.gradle b/formats/json/build.gradle index 824056d1..650d80ea 100644 --- a/formats/json/build.gradle +++ b/formats/json/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ apply plugin: 'kotlin-multiplatform' diff --git a/formats/properties/build.gradle b/formats/properties/build.gradle index b79c3e3b..7d4ee504 100644 --- a/formats/properties/build.gradle +++ b/formats/properties/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ apply plugin: 'kotlin-multiplatform' diff --git a/formats/protobuf/build.gradle b/formats/protobuf/build.gradle index ba1a1b4b..c2183b28 100644 --- a/formats/protobuf/build.gradle +++ b/formats/protobuf/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ apply plugin: 'java' // Needed for protobuf plugin only diff --git a/gradle.properties b/gradle.properties index aa4d579e..05148648 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,6 +18,9 @@ native.deploy= validator_version=0.7.1 knit_version=0.2.2 coroutines_version=1.3.9 +kover_version=0.3.0 + +kover.enabled=true kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.enableCompatibilityMetadataVariant=true diff --git a/gradle/kover.gradle b/gradle/kover.gradle new file mode 100644 index 00000000..9fd8a3ca --- /dev/null +++ b/gradle/kover.gradle @@ -0,0 +1,21 @@ +/* + * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +apply plugin: 'kover' + +tasks.withType(Test) { task -> + // Core is mainly uncovered because a lot of serializers are tested with JSON + def minPercentage = (project.name.contains("core") || project.name.contains("properties")) ? 50 : 80 + kover { + enabled = rootProject.ext.koverEnabled + generateXml = false + generateHtml = true + htmlReportDir.set(file("${rootProject.buildDir}/kover/${project.name}/html")) + verificationRule { + name = "Minimal line coverage rate in percents" + minValue = minPercentage + // valueType is 'COVERED_LINES_PERCENTAGE' by default + } + } +} |