diff --git a/src/main/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriter.kt b/src/main/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriter.kt index 7133d5e5..b92bf532 100644 --- a/src/main/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriter.kt +++ b/src/main/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriter.kt @@ -132,8 +132,7 @@ internal class KotlinBuildScriptDependenciesRewriter( rewriter.deleteWhitespaceToLeft(context.start) rewriter.deleteNewlineToRight(context.stop) } else if (a.isAnyChange()) { - val configuration = context.primaryExpression() - rewriter.replace(configuration.start, configuration.stop, a.toConfiguration) + rewriter.replace(context.start, context.stop, printer.toDeclaration(a).trim()) } } } diff --git a/src/test/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriterTest.kt b/src/test/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriterTest.kt index caaf4535..8e965786 100644 --- a/src/test/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriterTest.kt +++ b/src/test/kotlin/com/autonomousapps/internal/parse/KotlinBuildScriptDependenciesRewriterTest.kt @@ -130,6 +130,7 @@ internal class KotlinBuildScriptDependenciesRewriterTest { println("hello, world!") """.trimIndent() ) + val advice = setOf( Advice.ofChange(Coordinates.of(":marvin"), "api", "compileOnly"), Advice.ofChange(Coordinates.of("ford:prefect:1.0"), "api", "implementation"), @@ -149,7 +150,7 @@ internal class KotlinBuildScriptDependenciesRewriterTest { ":sad-robot" -> "\":depressed-robot\"" "magrathea:asleep:1000000" -> "deps.magrathea" "ford:prefect" -> "libs.fordPrefect" - else -> it + else -> null } } ),