(CoroutineDebugger) Enable agent for versions 1.3.8.*

Gradle artifact name gets changed from 'kotlinx-coroutines-core' to
'kotlinx-coroutines-core-jvm'. So it should support both.
This commit is contained in:
Vladimir Ilmov
2020-07-27 14:20:33 +02:00
parent c91858d470
commit 7eca13569b
2 changed files with 6 additions and 6 deletions
@@ -31,12 +31,12 @@ class KotlinGradleCoroutineDebugProjectResolver : AbstractProjectResolverExtensi
if (task instanceof Test || task instanceof JavaExec) {
def kotlinxCoroutinesCoreJar = task.classpath.find { it.name.startsWith("kotlinx-coroutines-core") }
if (kotlinxCoroutinesCoreJar) {
def results = (kotlinxCoroutinesCoreJar.getName() =~ /kotlinx-coroutines-core\-([\d\.]+)\.jar${'$'}/).findAll()
def results = (kotlinxCoroutinesCoreJar.getName() =~ /kotlinx-coroutines-core[a-z\-]+(\d[\w\.\-]+)\.jar${'$'}/).findAll()
if (results) {
def version = results.first()[1]
if (org.gradle.util.VersionNumber.parse( version ) >= org.gradle.util.VersionNumber.parse('1.3.8')) {
def referenceVersion = org.gradle.util.VersionNumber.parse('1.3.7-255')
if (org.gradle.util.VersionNumber.parse(version) > referenceVersion) {
task.jvmArgs ("-javaagent:${'$'}{kotlinxCoroutinesCoreJar?.absolutePath}", "-ea")
return
}
}
}
@@ -57,12 +57,12 @@ class DebuggerConnection(
}
private fun determineCoreVersionMode(kotlinxCoroutinesCore: String): CoroutineDebuggerMode {
val regex = Regex(""".+\Wkotlinx-coroutines-core-(.+)?\.jar""")
val regex = Regex(""".+\Wkotlinx-coroutines-core([\-a-z]+)(\d[\w\.\-]+)?\.jar""")
val matchResult = regex.matchEntire(kotlinxCoroutinesCore) ?: return CoroutineDebuggerMode.DISABLED
val versionToCompareTo = DefaultArtifactVersion("1.3.7-255")
val artifactVersion = DefaultArtifactVersion(matchResult.groupValues[1])
return if (artifactVersion >= versionToCompareTo)
val artifactVersion = DefaultArtifactVersion(matchResult.groupValues[2])
return if (artifactVersion > versionToCompareTo)
CoroutineDebuggerMode.VERSION_1_3_8_AND_UP
else
CoroutineDebuggerMode.DISABLED