From f67c93d4534ed9f422943474ff26f3a634c10bb7 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Thu, 29 Aug 2024 22:41:36 +0200 Subject: [PATCH] Add check if "test" target exist #638 --- .../ktorfit/gradle/KtorfitGradlePlugin.kt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt b/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt index a2390aae4..8eb88a814 100644 --- a/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt +++ b/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt @@ -86,20 +86,22 @@ class KtorfitGradlePlugin : Plugin { dependency, ) - dependencies.add( - "ksp${ - targetName.replaceFirstChar { - if (it.isLowerCase()) { - it.titlecase( - US, - ) - } else { - it.toString() + if (this.compilations.any { it.name == "test" }) { + dependencies.add( + "ksp${ + targetName.replaceFirstChar { + if (it.isLowerCase()) { + it.titlecase( + US, + ) + } else { + it.toString() + } } - } - }Test", - dependency, - ) + }Test", + dependency, + ) + } } kotlinExtension.sourceSets.named("commonMain").configure {