@@ -5,6 +5,7 @@ import org.gradle.api.Plugin
5
5
import org.gradle.api.Project
6
6
import org.gradle.api.artifacts.UnknownConfigurationException
7
7
import org.gradle.kotlin.dsl.getByType
8
+ import org.jetbrains.kotlin.gradle.plugin.extraProperties
8
9
import java.util.Properties
9
10
10
11
@Suppress(" unused" )
@@ -32,7 +33,7 @@ class ConvenienceSchemaGeneratorPlugin : Plugin<Project> {
32
33
// configure it to depend on symbol-processor-all
33
34
target.plugins.whenPluginAdded {
34
35
if (" com.google.devtools.ksp" in this .javaClass.packageName) {
35
- val isMultiplatform =
36
+ val isMultiplatform by lazy {
36
37
when {
37
38
target.plugins.hasPlugin(" org.jetbrains.kotlin.jvm" ) -> false
38
39
@@ -45,29 +46,26 @@ class ConvenienceSchemaGeneratorPlugin : Plugin<Project> {
45
46
false
46
47
}
47
48
}
48
- val mainKspCfg = if (isMultiplatform) " kspJvm" else " ksp"
49
- val testKspCfg = if (isMultiplatform) " kspJvmTest" else " kspTest"
50
- try {
51
- target.configurations.getByName(mainKspCfg).dependencies.add(
52
- target.dependencies.create(
53
- " org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion " ,
54
- ),
55
- )
56
- } catch (e: UnknownConfigurationException ) {
57
- target.logger.warn(
58
- " Configuration '$mainKspCfg ' not found. Please make sure the KSP plugin is applied." ,
59
- )
60
49
}
61
- try {
62
- target.configurations.getByName(testKspCfg).dependencies.add(
63
- target.dependencies.create(
64
- " org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion " ,
65
- ),
66
- )
67
- } catch (e: UnknownConfigurationException ) {
68
- target.logger.warn(
69
- " Configuration '$testKspCfg ' not found. Please make sure the KSP plugin is applied." ,
70
- )
50
+ val overriddenConfigs =
51
+ target.properties.get(" kotlin.dataframe.ksp.configs" )?.let { (it as String )}?.split(" ," )
52
+ val configs = when {
53
+ overriddenConfigs != null -> overriddenConfigs
54
+ isMultiplatform -> listOf (" kspJvm" ," kspJvmTest" )
55
+ else -> listOf (" ksp" ," kspTest" )
56
+ }
57
+ configs.forEach { cfg ->
58
+ try {
59
+ target.configurations.getByName(cfg).dependencies.add(
60
+ target.dependencies.create(
61
+ " org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion " ,
62
+ ),
63
+ )
64
+ } catch (e: UnknownConfigurationException ) {
65
+ target.logger.warn(
66
+ " Configuration '$cfg ' not found. Please make sure the KSP plugin is applied." ,
67
+ )
68
+ }
71
69
}
72
70
target.logger.info(" Added DataFrame dependency to the KSP plugin." )
73
71
target.extensions.getByType<KspExtension >().arg(
0 commit comments