Skip to content

Commit

Permalink
Fix issues when converting the classpath that contains ( ), where it …
Browse files Browse the repository at this point in the history
…would produce an additional ).
  • Loading branch information
bernaferrari committed Jan 24, 2019
1 parent 779dce6 commit 4d1e8c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gradlekotlinconverter.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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\"))"
}
}
Expand Down
1 change: 1 addition & 0 deletions tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit 4d1e8c0

Please sign in to comment.