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 dd88122ba9..4d734e2f81 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 @@ -30,19 +30,27 @@ class ConvenienceSchemaGeneratorPlugin : Plugin { // configure it to depend on symbol-processor-all target.plugins.whenPluginAdded { if ("com.google.devtools.ksp" in this.javaClass.packageName) { + val isMultiplatform = + when { + target.plugins.hasPlugin("org.jetbrains.kotlin.jvm") -> false + target.plugins.hasPlugin("org.jetbrains.kotlin.multiplatform") -> true + else -> throw Exception("Kotlin plugin must be applied first so we know whether to use multiplatform configurations or not") + } + val mainKspCfg = if (isMultiplatform) "kspJvm" else "ksp" + val testKspCfg = if (isMultiplatform) "kspJvmTest" else "kspTest" try { - target.configurations.getByName("ksp").dependencies.add( + target.configurations.getByName(mainKspCfg).dependencies.add( target.dependencies.create("org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion") ) } catch (e: UnknownConfigurationException) { - target.logger.warn("Configuration 'ksp' not found. Please make sure the KSP plugin is applied.") + target.logger.warn("Configuration '$mainKspCfg' not found. Please make sure the KSP plugin is applied.") } try { - target.configurations.getByName("kspTest").dependencies.add( + target.configurations.getByName(testKspCfg).dependencies.add( target.dependencies.create("org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion") ) } catch (e: UnknownConfigurationException) { - target.logger.warn("Configuration 'kspTest' not found. Please make sure the KSP plugin is applied.") + target.logger.warn("Configuration '$testKspCfg' not 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", target.projectDir.absolutePath)