[Wasm]Log webpack result only in there was infrastructure logging before
This commit is contained in:
+10
@@ -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
|
||||
)
|
||||
+7
-4
@@ -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 = { },
|
||||
|
||||
+6
-4
@@ -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 = "<i> \\[.+] .+\\s".toRegex()
|
||||
internal val WEBPACK_INFRASTRUCTURE_REGEX = "<i> \\[.+] .+\\s".toRegex()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user