[samples][coverage] Add support for Windows and Linux hosts.
This commit is contained in:
committed by
Sergey Bogolepov
parent
2b7c7be451
commit
625f14d9d1
@@ -19,7 +19,19 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macosX64("macos") {
|
// 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 {
|
binaries {
|
||||||
executable(listOf(DEBUG))
|
executable(listOf(DEBUG))
|
||||||
}
|
}
|
||||||
@@ -30,12 +42,12 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.create("createCoverageReport") {
|
tasks.create("createCoverageReport") {
|
||||||
dependsOn("macosTest")
|
dependsOn("coverageTest")
|
||||||
|
|
||||||
description = "Create coverage report"
|
description = "Create coverage report"
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val testDebugBinary = kotlin.targets["macos"].let { it as KotlinNativeTarget }.binaries.getExecutable("test", "debug").outputFile
|
val testDebugBinary = kotlin.targets["coverage"].let { it as KotlinNativeTarget }.binaries.getTest("DEBUG").outputFile
|
||||||
exec {
|
exec {
|
||||||
commandLine("llvm-profdata", "merge", "$testDebugBinary.profraw", "-o", "$testDebugBinary.profdata")
|
commandLine("llvm-profdata", "merge", "$testDebugBinary.profraw", "-o", "$testDebugBinary.profdata")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ if (isMacos || isLinux || isWindows) {
|
|||||||
include(":tetris")
|
include(":tetris")
|
||||||
include(":videoplayer")
|
include(":videoplayer")
|
||||||
include(":workers")
|
include(":workers")
|
||||||
|
include(":coverage")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMacos || isLinux) {
|
if (isMacos || isLinux) {
|
||||||
@@ -43,7 +44,6 @@ if (isMacos) {
|
|||||||
include(":objc")
|
include(":objc")
|
||||||
include(":opengl")
|
include(":opengl")
|
||||||
include(":uikit")
|
include(":uikit")
|
||||||
include(":coverage")
|
|
||||||
include(":watchos")
|
include(":watchos")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user