From b23bf371cf06f55abd1dc07579117ca9496a6628 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Mon, 27 Aug 2018 17:16:56 +0300 Subject: [PATCH] Always pass languageVersion explicitly to JPS compiler When 'languageVersion' isn't passed explicitly, compiler will choose 'LATEST_STABLE'. This may lead to spurious migration of a project to the next major version after plugin update (e.g. when user had project of major version X and then installed plugin of version X+1 -- in such case, meaning of "no language version" suddenly changes). So, we set it to RELEASED_VERSION, which is exactly the version that is safe to use as the fallback. --- .../src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index be2d855cb69..761a4c7c543 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -40,9 +40,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO import org.jetbrains.kotlin.cli.common.messages.MessageCollectorUtil import org.jetbrains.kotlin.compilerRunner.* -import org.jetbrains.kotlin.config.IncrementalCompilation -import org.jetbrains.kotlin.config.KotlinModuleKind -import org.jetbrains.kotlin.config.Services +import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.daemon.common.isDaemonEnabled import org.jetbrains.kotlin.incremental.* import org.jetbrains.kotlin.incremental.components.ExpectActualTracker @@ -345,6 +343,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val commonArguments = representativeTarget.compilerArgumentsForChunk(chunk).apply { reportOutputFiles = true version = true // Always report the version to help diagnosing user issues if they submit the compiler output + if (languageVersion == null) languageVersion = VersionView.RELEASED_VERSION.versionString } if (LOG.isDebugEnabled) {