[K/N] Remove LLVM coverage

The -Xcoverage feature has not worked and has been disabled for a while.
This fix removes it, and all of its uses.


Co-authored-by: Troels Lund <troels@google.com>


Merge-request: KOTLIN-MR-821
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
This commit is contained in:
Troels Bjerre Lund
2023-12-06 14:07:16 +00:00
committed by Space Cloud
parent e0c931f69d
commit 4f77434ea5
46 changed files with 24 additions and 1763 deletions
@@ -58,7 +58,6 @@ val buildSamplesWithPlatformLibs by tasks.creating {
dependsOn(":objc:assemble")
dependsOn(":opengl:assemble")
dependsOn(":uikit:assemble")
dependsOn(":coverage:assemble")
dependsOn(":watchos:assemble")
}
@@ -1,49 +0,0 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
}
kotlin {
// Determine host preset.
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
// Create a target for the host platform.
val hostTarget = when {
hostOs == "Mac OS X" -> macosX64("coverage")
hostOs == "Linux" -> linuxX64("coverage")
isMingwX64 -> mingwX64("coverage")
else -> throw GradleException("Host OS '$hostOs' is not supported in Kotlin/Native $project.")
}
hostTarget.apply {
binaries {
executable(listOf(DEBUG))
}
binaries.getTest("DEBUG").apply {
freeCompilerArgs += listOf("-Xlibrary-to-cover=${compilations["main"].output.classesDirs.singleFile.absolutePath}")
}
}
sourceSets {
val coverageMain by getting
val coverageTest by getting
}
}
tasks.create("createCoverageReport") {
dependsOn("coverageTest")
description = "Create coverage report"
doLast {
val testDebugBinary = kotlin.targets["coverage"].let { it as KotlinNativeTarget }.binaries.getTest("DEBUG").outputFile
exec {
commandLine("llvm-profdata", "merge", "$testDebugBinary.profraw", "-o", "$testDebugBinary.profdata")
}
exec {
commandLine("llvm-cov", "show", "$testDebugBinary", "-instr-profile", "$testDebugBinary.profdata")
}
}
}
@@ -1 +0,0 @@
kotlin.code.style=official
@@ -1,17 +0,0 @@
fun baz(args: Array<String>) {
if (args.size > 4) {
println("Too many")
} else {
println("Fine")
}
}
class A {
init {
println("A::init")
}
fun f() {
println("A::f")
}
}
@@ -1,3 +0,0 @@
fun main() {
baz(arrayOf("abc"))
}
@@ -1,15 +0,0 @@
import kotlin.test.Test
import kotlin.test.assertTrue
class CoverageTests {
@Test
fun testHello() {
main()
}
@Test
fun testA() {
val a = A()
a.f()
}
}
@@ -24,7 +24,6 @@ if (isMacos || isLinux || isWindows) {
include(":libcurl")
include(":videoplayer")
include(":workers")
include(":coverage")
}
if (isMacos || isLinux) {