diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Analysis/AnalysisEnvironment.kt | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/Analysis/AnalysisEnvironment.kt b/src/Analysis/AnalysisEnvironment.kt index 1d0631bb..164f76f5 100644 --- a/src/Analysis/AnalysisEnvironment.kt +++ b/src/Analysis/AnalysisEnvironment.kt @@ -16,10 +16,7 @@ import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.cli.jvm.config.addJavaSourceRoot -import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoot -import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots -import org.jetbrains.kotlin.cli.jvm.config.jvmClasspathRoots +import org.jetbrains.kotlin.cli.jvm.config.* import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.idea.caches.resolve.KotlinCacheService import org.jetbrains.kotlin.idea.caches.resolve.LibraryModificationTracker @@ -106,19 +103,23 @@ public class AnalysisEnvironment(val messageCollector: MessageCollector, body: A */ public fun addSources(list: List<String>) { list.forEach { - val file = File(it) - if (file.extension == "java") { - configuration.addJavaSourceRoot(file) - } else { - configuration.addKotlinSourceRoot(it) - } + configuration.add(CommonConfigurationKeys.CONTENT_ROOTS, contentRootFromPath(it)) } } + public fun addRoots(list: List<ContentRoot>) { + configuration.addAll(CommonConfigurationKeys.CONTENT_ROOTS, list) + } + /** * Disposes the environment and frees all associated resources. */ public override fun dispose() { Disposer.dispose(this) } -}
\ No newline at end of file +} + +public fun contentRootFromPath(path: String): ContentRoot { + val file = File(path) + return if (file.extension == "java") JavaSourceRoot(file) else KotlinSourceRoot(path) +} |