[Gradle] Simplify regexp for extracting task output in integration tests
Gradle has slightly changed logging since 7.6, so the old way stopped working #KT-53811 In Progress
This commit is contained in:
committed by
Space Team
parent
4b1c7f1c11
commit
46e45b8137
+6
-10
@@ -721,16 +721,12 @@ abstract class BaseGradleIT {
|
||||
fun CompiledProject.getOutputForTask(taskName: String): String {
|
||||
@Language("RegExp")
|
||||
val taskOutputRegex = """
|
||||
(?:
|
||||
\[LIFECYCLE] \[class org\.gradle(?:\.internal\.buildevents)?\.TaskExecutionLogger] :$taskName|
|
||||
\[org\.gradle\.execution\.(?:plan|taskgraph)\.Default(?:Task)?PlanExecutor] :$taskName.*?started
|
||||
)
|
||||
([\s\S]+?)
|
||||
(?:
|
||||
Finished executing task ':$taskName'|
|
||||
\[org\.gradle\.execution\.(?:plan|taskgraph)\.Default(?:Task)?PlanExecutor] :$taskName.*?completed
|
||||
)
|
||||
""".trimIndent().replace("\n", "").toRegex()
|
||||
\[org\.gradle\.internal\.operations\.DefaultBuildOperationRunner] Build operation 'Task :$taskName' started
|
||||
([\s\S]+?)
|
||||
\[org\.gradle\.internal\.operations\.DefaultBuildOperationRunner] Build operation 'Task :$taskName' completed
|
||||
""".trimIndent()
|
||||
.replace("\n", "")
|
||||
.toRegex()
|
||||
|
||||
return taskOutputRegex.find(output)?.run { groupValues[1] } ?: error("Cannot find output for task $taskName")
|
||||
}
|
||||
|
||||
+2
-2
@@ -285,8 +285,8 @@ open class KaptIncrementalIT : KGPBaseTest() {
|
||||
val useBKt = javaSourcesDir().resolve("bar/useB.kt")
|
||||
assertCompiledKotlinSources(
|
||||
listOf(projectPath.relativize(bKt), projectPath.relativize(useBKt)),
|
||||
getOutputForTask("kaptGenerateStubs"),
|
||||
errorMessageSuffix = " in task 'kaptGenerateStubs'"
|
||||
getOutputForTask("kaptGenerateStubsKotlin"),
|
||||
errorMessageSuffix = " in task 'kaptGenerateStubsKotlin'"
|
||||
)
|
||||
|
||||
// java removal is detected
|
||||
|
||||
+4
-10
@@ -21,16 +21,10 @@ private val javaSrcRegex by lazy { Regex("\\[DEBUG] \\[[^]]*JavaCompiler] Compil
|
||||
private fun taskOutputRegex(
|
||||
taskName: String
|
||||
) = """
|
||||
(?:
|
||||
\[LIFECYCLE] \[class org\.gradle(?:\.internal\.buildevents)?\.TaskExecutionLogger] :$taskName|
|
||||
\[org\.gradle\.execution\.(?:plan|taskgraph)\.Default(?:Task)?PlanExecutor] :$taskName.*?started
|
||||
)
|
||||
([\s\S]+?)
|
||||
(?:
|
||||
Finished executing task ':$taskName'|
|
||||
\[org\.gradle\.execution\.(?:plan|taskgraph)\.Default(?:Task)?PlanExecutor] :$taskName.*?completed
|
||||
)
|
||||
""".trimIndent()
|
||||
\[org\.gradle\.internal\.operations\.DefaultBuildOperationRunner] Build operation 'Task :$taskName' started
|
||||
([\s\S]+?)
|
||||
\[org\.gradle\.internal\.operations\.DefaultBuildOperationRunner] Build operation 'Task :$taskName' completed
|
||||
""".trimIndent()
|
||||
.replace("\n", "")
|
||||
.toRegex()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user