diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-05-27 19:26:13 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-05-27 19:26:13 +0200 |
commit | bc0654e29891fa5e93b8d122518179779aae7e6a (patch) | |
tree | 60dd25e65d1ef19b315c99c06072244f4c37700d /src/Analysis | |
parent | 70a70ca9dad31477877251b271a329d048f7873f (diff) | |
download | dokka-bc0654e29891fa5e93b8d122518179779aae7e6a.tar.gz dokka-bc0654e29891fa5e93b8d122518179779aae7e6a.tar.bz2 dokka-bc0654e29891fa5e93b8d122518179779aae7e6a.zip |
allow to explicitly specify the type of root for every input path
Diffstat (limited to 'src/Analysis')
-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) +} |