From 3775e741bfa2616b49605b678e2460d632d4e47a Mon Sep 17 00:00:00 2001 From: mgroth0 Date: Mon, 23 Sep 2024 17:49:56 -0400 Subject: [PATCH 1/2] find ksp configurations as they are added --- .../ConvenienceSchemaGeneratorPlugin.kt | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt b/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt index 0257465a8e..c774062235 100644 --- a/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt +++ b/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt @@ -67,19 +67,23 @@ class ConvenienceSchemaGeneratorPlugin : Plugin { isMultiplatform -> listOf("kspJvm", "kspJvmTest") else -> listOf("ksp", "kspTest") } + + val cfgsToAdd = configs.toMutableSet() + configs.forEach { cfg -> - try { - target.configurations.getByName(cfg).dependencies.add( - target.dependencies.create( - "org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion", - ), - ) - } catch (e: UnknownConfigurationException) { - target.logger.warn( - "Configuration '$cfg' not found. Please make sure the KSP plugin is applied.", + target.configurations.named { it == cfg }.configureEach { + cfgsToAdd.remove(cfg) + dependencies.add( + target.dependencies.create("org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion") ) } } + target.gradle.projectsEvaluated { + cfgsToAdd.forEach { cfg -> + target.logger.warn("Configuration '$cfg' was never found. Please make sure the KSP plugin is applied.") + } + } + target.logger.info("Added DataFrame dependency to the KSP plugin.") target.extensions.getByType().arg( "dataframe.resolutionDir", From ac8f23c92928c1acbd0d2fc94aa4aa452509cd56 Mon Sep 17 00:00:00 2001 From: mgroth0 Date: Mon, 30 Sep 2024 10:37:30 -0400 Subject: [PATCH 2/2] ktlintFormat --- .../dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt b/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt index c774062235..b05d5c2a10 100644 --- a/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt +++ b/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt @@ -3,7 +3,6 @@ package org.jetbrains.dataframe.gradle import com.google.devtools.ksp.gradle.KspExtension import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.artifacts.UnknownConfigurationException import org.gradle.kotlin.dsl.getByType import java.util.Properties @@ -74,13 +73,17 @@ class ConvenienceSchemaGeneratorPlugin : Plugin { target.configurations.named { it == cfg }.configureEach { cfgsToAdd.remove(cfg) dependencies.add( - target.dependencies.create("org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion") + target.dependencies.create( + "org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion", + ), ) } } target.gradle.projectsEvaluated { cfgsToAdd.forEach { cfg -> - target.logger.warn("Configuration '$cfg' was never found. Please make sure the KSP plugin is applied.") + target.logger.warn( + "Configuration '$cfg' was never found. Please make sure the KSP plugin is applied.", + ) } }