Implement remote part of the new repl state handling

This commit is contained in:
Ilya Chernikov
2017-02-06 14:09:31 +01:00
parent f9dedab8c8
commit c5bc58ad32
9 changed files with 369 additions and 186 deletions
@@ -16,10 +16,7 @@
package org.jetbrains.kotlin.daemon.common
import org.jetbrains.kotlin.cli.common.repl.ReplCheckResult
import org.jetbrains.kotlin.cli.common.repl.ReplCodeLine
import org.jetbrains.kotlin.cli.common.repl.ReplCompileResult
import org.jetbrains.kotlin.cli.common.repl.ReplEvalResult
import org.jetbrains.kotlin.cli.common.repl.*
import java.io.File
import java.io.Serializable
import java.rmi.Remote
@@ -38,8 +35,6 @@ interface CompileService : Remote {
METADATA
}
companion object {
val NO_SESSION: Int = 0
}
@@ -107,6 +102,7 @@ interface CompileService : Remote {
// TODO: consider adding async version of shutdown and release
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
@Throws(RemoteException::class)
fun remoteCompile(
sessionId: Int,
@@ -119,6 +115,7 @@ interface CompileService : Remote {
operationsTracer: RemoteOperationsTracer?
): CallResult<Int>
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
@Throws(RemoteException::class)
fun remoteIncrementalCompile(
sessionId: Int,
@@ -143,6 +140,7 @@ interface CompileService : Remote {
@Throws(RemoteException::class)
fun clearJarCache()
@Deprecated("The usages should be replaced with other `leaseReplSession` method", ReplaceWith("leaseReplSession"))
@Throws(RemoteException::class)
fun leaseReplSession(
aliveFlagPath: String?,
@@ -162,12 +160,14 @@ interface CompileService : Remote {
@Throws(RemoteException::class)
fun releaseReplSession(sessionId: Int): CallResult<Nothing>
@Deprecated("The usages should be replaced with `replCheck` method", ReplaceWith("replCheck"))
@Throws(RemoteException::class)
fun remoteReplLineCheck(
sessionId: Int,
codeLine: ReplCodeLine
): CallResult<ReplCheckResult>
@Deprecated("The usages should be replaced with `replCompile` method", ReplaceWith("replCompile"))
@Throws(RemoteException::class)
fun remoteReplLineCompile(
sessionId: Int,
@@ -175,10 +175,39 @@ interface CompileService : Remote {
history: List<ReplCodeLine>?
): CallResult<ReplCompileResult>
@Deprecated("Evaluation on daemon is not supported")
@Throws(RemoteException::class)
fun remoteReplLineEval(
sessionId: Int,
codeLine: ReplCodeLine,
history: List<ReplCodeLine>?
): CallResult<ReplEvalResult>
@Throws(RemoteException::class)
fun leaseReplSession(
aliveFlagPath: String?,
compilerArguments: Array<out String>,
compilationOptions: CompilationOptions,
servicesFacade: CompilerServicesFacadeBase,
templateClasspath: List<File>,
templateClassName: String,
scriptArgsWithTypes: ScriptArgsWithTypes?
): CallResult<Int>
@Throws(RemoteException::class)
fun replCreateState(sessionId: Int): CallResult<ReplStateFacade>
@Throws(RemoteException::class)
fun replCheck(
sessionId: Int,
replStateId: Int,
codeLine: ReplCodeLine
): CallResult<ReplCheckResult>
@Throws(RemoteException::class)
fun replCompile(
sessionId: Int,
replStateId: Int,
codeLine: ReplCodeLine
): CallResult<ReplCompileResult>
}
@@ -29,6 +29,7 @@ import java.rmi.RemoteException
* the reason for having common facade is attempt to reduce number of connections between client and daemon
* Note: non-standard naming convention used to denote combining several entities in one facade - prefix <entityName>_ is used for every function belonging to the entity
*/
@Deprecated("The usages should be replaced with `compile` method and `CompilerServicesFacadeBase` implementations", ReplaceWith("CompilerServicesFacadeBase"))
interface CompilerCallbackServicesFacade : Remote {
@Throws(RemoteException::class)
@@ -0,0 +1,30 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.daemon.common
import org.jetbrains.kotlin.cli.common.repl.ILineId
import java.rmi.Remote
interface ReplStateFacade : Remote {
val id: Int
val historySize: Int
fun historyGet(index: Int): ILineId
fun historyResetTo(id: ILineId): List<ILineId>
}