Skip to content

Commit

Permalink
Merge pull request #881 from mgroth0/custom-configs
Browse files Browse the repository at this point in the history
Find KSP Configurations that are Added Later
  • Loading branch information
Jolanrensen authored Oct 1, 2024
2 parents d50f021 + ac8f23c commit cab218c
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -67,19 +66,27 @@ class ConvenienceSchemaGeneratorPlugin : Plugin<Project> {
isMultiplatform -> listOf("kspJvm", "kspJvmTest")
else -> listOf("ksp", "kspTest")
}

val cfgsToAdd = configs.toMutableSet()

configs.forEach { cfg ->
try {
target.configurations.getByName(cfg).dependencies.add(
target.configurations.named { it == cfg }.configureEach {
cfgsToAdd.remove(cfg)
dependencies.add(
target.dependencies.create(
"org.jetbrains.kotlinx.dataframe:symbol-processor-all:$preprocessorVersion",
),
)
} catch (e: UnknownConfigurationException) {
}
}
target.gradle.projectsEvaluated {
cfgsToAdd.forEach { cfg ->
target.logger.warn(
"Configuration '$cfg' not found. Please make sure the KSP plugin is applied.",
"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<KspExtension>().arg(
"dataframe.resolutionDir",
Expand Down

0 comments on commit cab218c

Please sign in to comment.