(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:
+3
-3
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user