diff --git a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt index 59469fbe134..994a0f662e8 100644 --- a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt +++ b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt @@ -20,7 +20,7 @@ import java.io.File import java.io.Serializable open class CompilationOptions( - val compilerMode: CompileService.CompilerMode, + val compilerMode: CompilerMode, val targetPlatform: CompileService.TargetPlatform, val reportCategories: Array, val reportSeverity: Int, @@ -38,7 +38,7 @@ class IncrementalCompilationOptions( val workingDir: File, val customCacheVersionFileName: String, val customCacheVersion: Int, - compilerMode: CompileService.CompilerMode, + compilerMode: CompilerMode, targetPlatform: CompileService.TargetPlatform, reportCategories: Array, reportSeverity: Int, @@ -48,3 +48,9 @@ class IncrementalCompilationOptions( const val serialVersionUID: Long = 0 } } + +enum class CompilerMode : Serializable { + NON_INCREMENTAL_COMPILER, + INCREMENTAL_COMPILER, + JPS_COMPILER +} \ No newline at end of file diff --git a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompileService.kt b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompileService.kt index 43995702e9a..bf8bdbd23cd 100644 --- a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompileService.kt +++ b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompileService.kt @@ -36,11 +36,7 @@ interface CompileService : Remote { METADATA } - enum class CompilerMode : Serializable { - NON_INCREMENTAL_COMPILER, - INCREMENTAL_COMPILER, - JPS_COMPILER - } + companion object { val NO_SESSION: Int = 0 diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt index bb4edcb5710..ab1f7475b04 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt @@ -332,7 +332,7 @@ class CompileServiceImpl( val targetPlatform = compilationOptions.targetPlatform return when (compilerMode) { - CompileService.CompilerMode.JPS_COMPILER -> { + CompilerMode.JPS_COMPILER -> { val jpsServicesFacade = servicesFacade as JpsCompilerServicesFacade doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler -> @@ -340,12 +340,12 @@ class CompileServiceImpl( execCompiler(compilationOptions.targetPlatform, services, compilerArguments, messageCollector) } } - CompileService.CompilerMode.NON_INCREMENTAL_COMPILER -> { + CompilerMode.NON_INCREMENTAL_COMPILER -> { doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler -> execCompiler(targetPlatform, Services.EMPTY, compilerArguments, messageCollector) } } - CompileService.CompilerMode.INCREMENTAL_COMPILER -> { + CompilerMode.INCREMENTAL_COMPILER -> { if (targetPlatform != CompileService.TargetPlatform.JVM) { throw IllegalStateException("Incremental compilation is not supported for target platform: $targetPlatform") } diff --git a/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt b/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt index e4f20cfb84d..3d207d68a12 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt @@ -101,7 +101,7 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { } val res = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId -> - val compilerMode = CompileService.CompilerMode.JPS_COMPILER + val compilerMode = CompilerMode.JPS_COMPILER val verbose = compilerArgs.verbose val options = CompilationOptions(compilerMode, targetPlatform, reportCategories(verbose), reportSeverity(verbose), requestedCompilationResults = emptyArray()) daemon.compile(sessionId, compilerArgs, options, JpsCompilerServicesFacadeImpl(environment), null) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt index bac973cba61..5cadc7fef67 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt @@ -164,7 +164,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil val verbose = environment.compilerArgs.verbose val compilationOptions = CompilationOptions( - compilerMode = CompileService.CompilerMode.NON_INCREMENTAL_COMPILER, + compilerMode = CompilerMode.NON_INCREMENTAL_COMPILER, targetPlatform = targetPlatform, reportCategories = reportCategories(verbose), reportSeverity = reportSeverity(verbose), @@ -197,7 +197,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil reportCategories = reportCategories(verbose), reportSeverity = reportSeverity(verbose), requestedCompilationResults = arrayOf(CompilationResult.IC_COMPILE_ITERATION.code), - compilerMode = CompileService.CompilerMode.INCREMENTAL_COMPILER, + compilerMode = CompilerMode.INCREMENTAL_COMPILER, targetPlatform = CompileService.TargetPlatform.JVM ) val servicesFacade = GradleIncrementalCompilerServicesFacadeImpl(project, environment)