From 4d1e8c09e621d0c49c7324464a559feab9f22758 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Thu, 24 Jan 2019 16:04:49 -0200 Subject: [PATCH] Fix issues when converting the classpath that contains ( ), where it would produce an additional ). --- gradlekotlinconverter.kts | 4 ++-- tests.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gradlekotlinconverter.kts b/gradlekotlinconverter.kts index f594c84..9132631 100755 --- a/gradlekotlinconverter.kts +++ b/gradlekotlinconverter.kts @@ -402,7 +402,7 @@ fun String.convertExcludeClasspath(): String { // classpath(kotlin("gradle-plugin", version = "$kotlin_version")) fun String.convertClasspathKotlin(): String { - val fullLineExp = "classpath.*\"org.jetbrains\\.kotlin:kotlin-gradle-plugin:.*\"".toRegex() + val fullLineExp = "classpath.*\"org.jetbrains\\.kotlin:kotlin-gradle-plugin:.*".toRegex() if (DEBUG) { println("[CCK] - reading this line: " + fullLineExp.find(this)?.value) @@ -413,7 +413,7 @@ fun String.convertClasspathKotlin(): String { return this.replace(fullLineExp) { isolatedLine -> // remove everything before $kotlin_version and the " after it. - val kVersion = isolatedLine.value.replace(removeExp, "").replace("\"","") + val kVersion = isolatedLine.value.replace(removeExp, "").replace("\"|\\)".toRegex(),"") "classpath(kotlin(\"gradle-plugin\", version = \"$kVersion\"))" } } diff --git a/tests.txt b/tests.txt index 4ed4bac..fb5bf64 100644 --- a/tests.txt +++ b/tests.txt @@ -28,6 +28,7 @@ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" +classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20") include ":app", ':diffutils'