aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-27 16:05:59 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-27 16:05:59 +0300
commit13c4cb93f55693f3bfa396ccad9549d8654ec3f9 (patch)
treed0af242a455f14d051251eeabb2b1dcc6d6db700 /core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
parentcc2a478ff0f1831be2333bf97712e1ffe9d764fe (diff)
downloaddokka-13c4cb93f55693f3bfa396ccad9549d8654ec3f9.tar.gz
dokka-13c4cb93f55693f3bfa396ccad9549d8654ec3f9.tar.bz2
dokka-13c4cb93f55693f3bfa396ccad9549d8654ec3f9.zip
Add language version arguments
Diffstat (limited to 'core/src/main/kotlin/Analysis/AnalysisEnvironment.kt')
-rw-r--r--core/src/main/kotlin/Analysis/AnalysisEnvironment.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
index 3eb235e5..003c6835 100644
--- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
@@ -69,7 +69,6 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
val projectFileIndex = CoreProjectFileIndex(environment.project,
environment.configuration.getList(JVMConfigurationKeys.CONTENT_ROOTS))
- environment.configuration.put(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS, LanguageVersionSettingsImpl.DEFAULT)
val moduleManager = object : CoreModuleManager(environment.project, this) {
override fun getModules(): Array<out Module> = arrayOf(projectFileIndex.module)
@@ -142,7 +141,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
},
CompilerEnvironment,
packagePartProviderFactory = { info, content ->
- JvmPackagePartProvider(LanguageVersionSettingsImpl.DEFAULT, content.moduleContentScope).apply {
+ JvmPackagePartProvider(configuration.languageVersionSettings, content.moduleContentScope).apply {
addRoots(javaRoots)
}
},
@@ -157,6 +156,12 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
return DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule)
}
+ fun loadLanguageVersionSettings(languageVersionString: String?, apiVersionString: String?) {
+ val languageVersion = LanguageVersion.fromVersionString(languageVersionString) ?: LanguageVersion.LATEST_STABLE
+ val apiVersion = apiVersionString?.let { ApiVersion.parse(it) } ?: ApiVersion.createByLanguageVersion(languageVersion)
+ configuration.languageVersionSettings = LanguageVersionSettingsImpl(languageVersion, apiVersion)
+ }
+
/**
* Classpath for this environment.
*/