diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/InfrastructureLogged.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/InfrastructureLogged.kt new file mode 100644 index 00000000000..e114aa91a87 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/InfrastructureLogged.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.gradle.targets.js.webpack + +class InfrastructureLogged( + var value: Boolean +) \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackRunner.kt index 21573f1fbf2..048a1dfe1be 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/KotlinWebpackRunner.kt @@ -48,9 +48,10 @@ internal data class KotlinWebpackRunner( private fun configureClient( clientType: LogType, - progressLogger: ProgressLogger? + progressLogger: ProgressLogger?, + infrastructureLogged: InfrastructureLogged, ): TeamCityMessageCommonClient { - return WebpackLogClient(clientType, logger) + return WebpackLogClient(clientType, logger, infrastructureLogged) .apply { if (progressLogger != null) { this.progressLogger = progressLogger @@ -66,14 +67,16 @@ internal data class KotlinWebpackRunner( "${this}: Entry file not existed \"${config.entry}\"" } - val standardClient = configureClient(LogType.LOG, progressLogger) + val infrastructureLogged = InfrastructureLogged(false) + + val standardClient = configureClient(LogType.LOG, progressLogger, infrastructureLogged) execFactory.standardOutput = TCServiceMessageOutputStreamHandler( client = standardClient, onException = { }, logger = standardClient.log ) - val errorClient = configureClient(LogType.ERROR, progressLogger) + val errorClient = configureClient(LogType.ERROR, progressLogger, infrastructureLogged) execFactory.errorOutput = TCServiceMessageOutputStreamHandler( client = errorClient, onException = { }, diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/WebpackLogClient.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/WebpackLogClient.kt index cba0cd262c3..37ef33db250 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/WebpackLogClient.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/webpack/WebpackLogClient.kt @@ -11,10 +11,12 @@ import org.jetbrains.kotlin.gradle.internal.TeamCityMessageCommonClient class WebpackLogClient( clientType: LogType, - log: Logger + log: Logger, + private val infrastructureLogged: InfrastructureLogged, ) : TeamCityMessageCommonClient(clientType, log) { override fun regularText(text: String) { - if (WEBPACK_INITIAL_REGEX.matches(text)) { + if (WEBPACK_INFRASTRUCTURE_REGEX.matches(text)) { + infrastructureLogged.value = true printMessage(text, LogType.LIFECYCLE) } else { super.regularText(text) @@ -22,7 +24,7 @@ class WebpackLogClient( } override fun printMessage(text: String, type: LogType?) { - if (WEBPACK_COMPILED_REGEX.matches(text)) { + if (infrastructureLogged.value && WEBPACK_COMPILED_REGEX.matches(text)) { super.printMessage(text, LogType.LIFECYCLE) } else { super.printMessage(text, type) @@ -31,6 +33,6 @@ class WebpackLogClient( companion object { internal val WEBPACK_COMPILED_REGEX = "webpack (.+) compiled (.+) in .+\\s".toRegex() - internal val WEBPACK_INITIAL_REGEX = " \\[.+] .+\\s".toRegex() + internal val WEBPACK_INFRASTRUCTURE_REGEX = " \\[.+] .+\\s".toRegex() } } \ No newline at end of file