[Gradle] Escape TC service messages in debug logs unconditionally
Those messages are not required for the real TC reporting. They are printed just for debugging purposes of integration with K/N and K/JS test runners. ^KT-65295 Fixed
This commit is contained in:
committed by
Space Team
parent
e021411768
commit
a065b7adf8
-2
@@ -1,2 +0,0 @@
|
||||
# Enable escaping TC service messages in logs.
|
||||
teamcity=true
|
||||
+4
-8
@@ -30,7 +30,6 @@ data class TCServiceMessagesClientSettings(
|
||||
val stackTraceParser: (String) -> ParsedStackTrace? = { null },
|
||||
val ignoreOutOfRootNodes: Boolean = false,
|
||||
val ignoreLineEndingAfterMessage: Boolean = true,
|
||||
val escapeTCMessagesInLog: Boolean = false
|
||||
)
|
||||
|
||||
internal open class TCServiceMessagesClient(
|
||||
@@ -61,14 +60,11 @@ internal open class TCServiceMessagesClient(
|
||||
|
||||
override fun serviceMessage(message: ServiceMessage) {
|
||||
|
||||
// If a user uses TeamCity, this log may be treated by TC as an actual service message.
|
||||
// So, escape logged messages if the corresponding setting is specified.
|
||||
log.kotlinDebug {
|
||||
val messageString = if (settings.escapeTCMessagesInLog) {
|
||||
message.toString().replaceFirst("^##teamcity\\[".toRegex(), "##TC[")
|
||||
} else {
|
||||
message.toString()
|
||||
}
|
||||
// If a user uses TeamCity, TC may treat this log as an actual service message.
|
||||
// This message should be considered implementation detail and shouldn't be exposed "as is".
|
||||
// At this stage it's already parsed correctly, and it's safe to escape it.
|
||||
val messageString = message.toString().replaceFirst("^##teamcity\\[".toRegex(), "##TC[")
|
||||
"TCSM: $messageString"
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -32,7 +32,6 @@ internal class KotlinWasmD8(private val kotlinJsTest: KotlinJsTest) : KotlinJsTe
|
||||
|
||||
private val d8 = D8RootPlugin.apply(project.rootProject)
|
||||
private val d8Executable by project.provider { d8.requireConfigured().executablePath }
|
||||
private val isTeamCity = project.providers.gradleProperty(TCServiceMessagesTestExecutor.TC_PROJECT_PROPERTY)
|
||||
private val npmProjectDir by project.provider { compilation.npmProject.dir }
|
||||
|
||||
override val workingDir: Provider<Directory>
|
||||
@@ -55,7 +54,6 @@ internal class KotlinWasmD8(private val kotlinJsTest: KotlinJsTest) : KotlinJsTe
|
||||
prependSuiteName = true,
|
||||
stackTraceParser = ::parseNodeJsStackTraceAsJvm,
|
||||
ignoreOutOfRootNodes = true,
|
||||
escapeTCMessagesInLog = isTeamCity.isPresent
|
||||
)
|
||||
|
||||
val cliArgs = KotlinTestRunnerCliArgs(
|
||||
|
||||
-2
@@ -28,7 +28,6 @@ internal class KotlinWasmNode(private val kotlinJsTest: KotlinJsTest) : KotlinJs
|
||||
override val settingsState: String = "KotlinWasmNode"
|
||||
@Transient
|
||||
override val compilation: KotlinJsIrCompilation = kotlinJsTest.compilation
|
||||
private val isTeamCity = compilation.target.project.providers.gradleProperty(TCServiceMessagesTestExecutor.TC_PROJECT_PROPERTY)
|
||||
|
||||
@Transient
|
||||
private val target: KotlinJsIrTarget = compilation.target as KotlinJsIrTarget
|
||||
@@ -63,7 +62,6 @@ internal class KotlinWasmNode(private val kotlinJsTest: KotlinJsTest) : KotlinJs
|
||||
prependSuiteName = true,
|
||||
stackTraceParser = ::parseNodeJsStackTraceAsJvm,
|
||||
ignoreOutOfRootNodes = true,
|
||||
escapeTCMessagesInLog = isTeamCity.isPresent
|
||||
)
|
||||
|
||||
val cliArgs = KotlinTestRunnerCliArgs(
|
||||
|
||||
-3
@@ -72,8 +72,6 @@ class KotlinKarma(
|
||||
private var configDirectory: File by property {
|
||||
defaultConfigDirectory
|
||||
}
|
||||
private val isTeamCity = project.providers.gradleProperty(TCServiceMessagesTestExecutor.TC_PROJECT_PROPERTY)
|
||||
|
||||
private val npmProjectDir by project.provider { npmProject.dir }
|
||||
|
||||
override val requiredNpmDependencies: Set<RequiredKotlinJsDependency>
|
||||
@@ -396,7 +394,6 @@ class KotlinKarma(
|
||||
prependSuiteName = true,
|
||||
stackTraceParser = ::parseNodeJsStackTraceAsJvm,
|
||||
ignoreOutOfRootNodes = true,
|
||||
escapeTCMessagesInLog = isTeamCity.isPresent
|
||||
)
|
||||
|
||||
config.basePath = npmProjectDir.getFile().absolutePath
|
||||
|
||||
-2
@@ -31,7 +31,6 @@ class KotlinMocha(@Transient override val compilation: KotlinJsIrCompilation, pr
|
||||
private val project: Project = compilation.target.project
|
||||
private val npmProject = compilation.npmProject
|
||||
private val versions = project.rootProject.kotlinNodeJsExtension.versions
|
||||
private val isTeamCity = project.providers.gradleProperty(TCServiceMessagesTestExecutor.TC_PROJECT_PROPERTY)
|
||||
private val npmProjectDir by project.provider { npmProject.dir }
|
||||
|
||||
override val workingDir: Provider<Directory>
|
||||
@@ -65,7 +64,6 @@ class KotlinMocha(@Transient override val compilation: KotlinJsIrCompilation, pr
|
||||
prependSuiteName = true,
|
||||
stackTraceParser = ::parseNodeJsStackTraceAsJvm,
|
||||
ignoreOutOfRootNodes = true,
|
||||
escapeTCMessagesInLog = isTeamCity.isPresent
|
||||
)
|
||||
|
||||
val cliArgs = KotlinTestRunnerCliArgs(
|
||||
|
||||
-1
@@ -144,7 +144,6 @@ abstract class KotlinNativeTest : KotlinTest() {
|
||||
prependSuiteName = targetName != null,
|
||||
treatFailedTestOutputAsStacktrace = false,
|
||||
stackTraceParser = ::parseKotlinNativeStackTraceAsJvm,
|
||||
escapeTCMessagesInLog = providerFactory.gradleProperty(TC_PROJECT_PROPERTY).isPresent
|
||||
)
|
||||
|
||||
// The KotlinTest expects that the exit code is zero even if some tests failed.
|
||||
|
||||
Reference in New Issue
Block a user