From fdc9c5df5e92fae60b621734b1afa20969862948 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Thu, 19 Aug 2021 20:59:51 +0200 Subject: [PATCH] [web] [build] stricter guards for printTestBundleSize --- web/build.gradle.kts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/web/build.gradle.kts b/web/build.gradle.kts index 06ba457b3c..0741a1d6b0 100644 --- a/web/build.gradle.kts +++ b/web/build.gradle.kts @@ -35,22 +35,25 @@ subprojects { } } - val printTestBundleSize by tasks.registering { - doLast { - val bundlePath = buildDir.resolve( - "compileSync/test/testDevelopmentExecutable/kotlin/${rootProject.name}-${project.name}-test.js" - ) - if (bundlePath.exists()) { - val size = bundlePath.length() - println("##teamcity[buildStatisticValue key='testBundleSize::${project.name}' value='$size']") + pluginManager.withPlugin("kotlin-multiplatform") { + val printTestBundleSize by tasks.registering { + doLast { + val bundlePath = buildDir.resolve( + "compileSync/test/testDevelopmentExecutable/kotlin/${rootProject.name}-${project.name}-test.js" + ) + if (bundlePath.exists()) { + val size = bundlePath.length() + println("##teamcity[buildStatisticValue key='testBundleSize::${project.name}' value='$size']") + } } } - } - afterEvaluate { - tasks.named("jsTest") { finalizedBy(printTestBundleSize) } + afterEvaluate { + tasks.named("jsTest") { finalizedBy(printTestBundleSize) } + } } + if (isSampleProject()) { val printBundleSize by tasks.registering { dependsOn(tasks.named("jsBrowserDistribution"))