Skip to content

Commit

Permalink
Add check if "test" target exist #638
Browse files Browse the repository at this point in the history
  • Loading branch information
Foso committed Aug 29, 2024
1 parent f67c93d commit ded5f61
Showing 1 changed file with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,25 @@ class KtorfitGradlePlugin : Plugin<Project> {

kotlinExtension.targets.configureEach {
if (targetName == "metadata") return@configureEach
dependencies.add(
"ksp${
targetName.replaceFirstChar {
if (it.isLowerCase()) {
it.titlecase(
US,
)
} else {
it.toString()
}
val capitalizedTargetName =
targetName.replaceFirstChar {
if (it.isLowerCase()) {
it.titlecase(
US,
)
} else {
it.toString()
}
}",
}
dependencies.add(
"ksp$capitalizedTargetName",
dependency,
)

if (this.compilations.any { it.name == "test" }) {
dependencies.add(
"ksp${
targetName.replaceFirstChar {
if (it.isLowerCase()) {
it.titlecase(
US,
)
} else {
it.toString()
}
}
capitalizedTargetName
}Test",
dependency,
)
Expand Down

0 comments on commit ded5f61

Please sign in to comment.