You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.0 KiB
74 lines
2.0 KiB
3 years ago
|
plugins {
|
||
|
id("org.jetbrains.kotlin.multiplatform")
|
||
|
id("org.jetbrains.compose")
|
||
|
}
|
||
|
|
||
|
|
||
|
kotlin {
|
||
|
js(IR) {
|
||
3 years ago
|
browser {
|
||
3 years ago
|
testTask {
|
||
|
useKarma {
|
||
|
useChromeHeadless()
|
||
3 years ago
|
// useFirefox()
|
||
3 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
binaries.executable()
|
||
|
}
|
||
|
|
||
|
sourceSets {
|
||
|
val commonMain by getting {
|
||
|
dependencies {
|
||
|
implementation(compose.runtime)
|
||
2 years ago
|
implementation(project(":html-core"))
|
||
3 years ago
|
implementation(kotlin("stdlib-common"))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
val jsMain by getting {
|
||
|
dependencies {
|
||
|
implementation(kotlin("stdlib-js"))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
val jsTest by getting {
|
||
|
dependencies {
|
||
2 years ago
|
implementation(project(":html-test-utils"))
|
||
3 years ago
|
implementation(kotlin("test-js"))
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
val BENCHMARKS_PATH = "reports/tests/jsTest/classes/org.jetbrains.compose.web.tests.benchmarks.BenchmarkTests.html"
|
||
|
|
||
3 years ago
|
val printBenchmarkResults by tasks.registering {
|
||
|
doLast {
|
||
3 years ago
|
val report = buildDir.resolve(BENCHMARKS_PATH).readText()
|
||
3 years ago
|
val stdout = "#.*;".toRegex().findAll(report).map { it.value }.firstOrNull()
|
||
|
|
||
|
val benchmarks = stdout?.split(";")?.mapNotNull {
|
||
|
if (it.isEmpty()) {
|
||
|
null
|
||
|
} else {
|
||
|
val b = it.split(":")
|
||
|
val testName = b[0].replace("#", "")
|
||
|
val benchmarkMs = b[1].toInt()
|
||
|
|
||
|
testName to benchmarkMs
|
||
|
}
|
||
|
}?.toMap()
|
||
|
|
||
|
benchmarks?.forEach {
|
||
|
// TeamCity messages need to escape '[' and ']' using '|'
|
||
|
val testName = it.key
|
||
|
.replace("[", "|[")
|
||
|
.replace("]", "|]")
|
||
|
println("##teamcity[buildStatisticValue key='benchmark_$testName' value='${it.value}']")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
tasks.named("jsTest") { finalizedBy(printBenchmarkResults) }
|