Skip to content

Commit

Permalink
Use printer.toDeclaration to update dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
wsutina committed Nov 10, 2024
1 parent d49c025 commit cf85b18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -149,7 +150,7 @@ internal class KotlinBuildScriptDependenciesRewriterTest {
":sad-robot" -> "\":depressed-robot\""
"magrathea:asleep:1000000" -> "deps.magrathea"
"ford:prefect" -> "libs.fordPrefect"
else -> it
else -> null
}
}
),
Expand Down

0 comments on commit cf85b18

Please sign in to comment.