Add Kover plugin (#1733)

Co-authored-by: Sergey.Shanshin <sergey.shanshin@jetbrains.com>
diff --git a/build.gradle b/build.gradle
index 9f01044..2353717 100644
--- a/build.gradle
+++ b/build.gradle
@@ -23,6 +23,7 @@
                                       "-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 @@
         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 {
     // 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 @@
             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')