(CoroutineDebugger) minimum supported version kotlinx-coroutines-core.1.3.8

Workaround for starting agent on windows removed, version upgraded in tests
 #KT-40073 fixed
This commit is contained in:
Vladimir Ilmov
2020-07-09 21:27:54 +02:00
parent cd896ae6c8
commit e49f3b567b
8 changed files with 11 additions and 39 deletions
@@ -43,18 +43,12 @@ class DebuggerConnection(
if (params is JavaParameters && modifyArgs) {
// gradle related logic in KotlinGradleCoroutineDebugProjectResolver
val kotlinxCoroutinesCore = params.classPath?.pathList?.firstOrNull { it.contains("kotlinx-coroutines-core") }
val kotlinxCoroutinesDebug = params.classPath?.pathList?.firstOrNull { it.contains("kotlinx-coroutines-debug") }
if (kotlinxCoroutinesCore != null) {
val coreVersion = determineCoreVersionMode(kotlinxCoroutinesCore)
val mode = if (coreVersion == CoroutineDebuggerMode.DISABLED && kotlinxCoroutinesDebug != null)
CoroutineDebuggerMode.VERSION_UP_TO_1_3_5
else
coreVersion
val mode = determineCoreVersionMode(kotlinxCoroutinesCore)
when (mode) {
CoroutineDebuggerMode.VERSION_1_3_6_AND_UP -> initializeCoroutineAgent(params, kotlinxCoroutinesCore)
CoroutineDebuggerMode.VERSION_UP_TO_1_3_5 -> initializeCoroutineAgent(params, kotlinxCoroutinesDebug)
CoroutineDebuggerMode.VERSION_1_3_8_AND_UP -> initializeCoroutineAgent(params, kotlinxCoroutinesCore)
else -> log.debug("CoroutineDebugger disabled.")
}
}
@@ -65,11 +59,11 @@ class DebuggerConnection(
private fun determineCoreVersionMode(kotlinxCoroutinesCore: String): CoroutineDebuggerMode {
val regex = Regex(""".+\Wkotlinx-coroutines-core-(.+)?\.jar""")
val matchResult = regex.matchEntire(kotlinxCoroutinesCore) ?: return CoroutineDebuggerMode.DISABLED
val versionToCompareTo = DefaultArtifactVersion("1.3.5-255")
val versionToCompareTo = DefaultArtifactVersion("1.3.7-255")
val artifactVersion = DefaultArtifactVersion(matchResult.groupValues[1])
return if (artifactVersion >= versionToCompareTo)
CoroutineDebuggerMode.VERSION_1_3_6_AND_UP
CoroutineDebuggerMode.VERSION_1_3_8_AND_UP
else
CoroutineDebuggerMode.DISABLED
}
@@ -122,5 +116,6 @@ class DebuggerConnection(
enum class CoroutineDebuggerMode {
DISABLED,
VERSION_UP_TO_1_3_5,
VERSION_1_3_6_AND_UP
VERSION_1_3_6_AND_UP,
VERSION_1_3_8_AND_UP,
}