From ae44265434ed08f1bbc036581532c3c799c5daec Mon Sep 17 00:00:00 2001 From: "Nataliya.Valtman" Date: Fri, 28 Jun 2024 11:43:50 +0200 Subject: [PATCH] Init configurationMetrics parameter with a default value #KTI-1611 Fixed (cherry picked from commit 3a2dd1bc84a33799d69e80a9238c4dfefe7010fa) --- .../kotlin/gradle/plugin/statistics/BuildFusService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/statistics/BuildFusService.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/statistics/BuildFusService.kt index c3c60aa9601ef..a1fc160f74022 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/statistics/BuildFusService.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/statistics/BuildFusService.kt @@ -128,6 +128,8 @@ abstract class BuildFusService : BuildService, AutoC }) spec.parameters.useBuildFinishFlowAction.set(GradleVersion.current().baseVersion >= GradleVersion.version("8.1")) spec.parameters.buildStatisticsConfiguration.set(KotlinBuildStatsConfiguration(project)) + //init value to avoid `java.lang.IllegalStateException: GradleScopeServices has been closed` exception on close + spec.parameters.configurationMetrics.add(MetricContainer()) }.also { buildService -> //DO NOT call buildService.get() before all parameters.configurationMetrics are set. // buildService.get() call will cause parameters calculation and configuration cache storage.