com.google.devtools.ksp.standalone.IncrementalKotlinPackageProviderFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of symbol-processing-cmdline Show documentation
Show all versions of symbol-processing-cmdline Show documentation
Symbol processing for K/N and command line
package com.google.devtools.ksp.standalone
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.analysis.api.platform.packages.KotlinCompositePackageProvider
import org.jetbrains.kotlin.analysis.api.platform.packages.KotlinPackageProvider
import org.jetbrains.kotlin.analysis.api.platform.packages.KotlinPackageProviderFactory
import org.jetbrains.kotlin.analysis.api.standalone.base.packages.KotlinStandalonePackageProviderFactory
import org.jetbrains.kotlin.psi.KtFile
class IncrementalKotlinPackageProviderFactory(
private val project: Project,
) : KotlinPackageProviderFactory {
private val staticFactories: MutableList = mutableListOf()
override fun createPackageProvider(searchScope: GlobalSearchScope): KotlinPackageProvider {
val providers = staticFactories.map { it.createPackageProvider(searchScope) }
return KotlinCompositePackageProvider.create(providers)
}
fun update(files: Collection) {
val staticFactory = KotlinStandalonePackageProviderFactory(project, files)
staticFactories.add(staticFactory)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy