NetworkClient

sbt.internal.client.NetworkClient
See theNetworkClient companion object
class NetworkClient(arguments: Arguments, console: ConsoleInterface, inputStream: InputStream, errorStream: PrintStream, printStream: PrintStream, useJNI: Boolean) extends AutoCloseable

A NetworkClient connects to a running sbt instance or starts a new instance if there isn't already one running. Once connected, it can send commands for sbt to run, it can send completions to sbt and print the completions to stdout so that a shell can consume the completions or it can enter an interactive sbt shell session in which it relays io bytes between sbt and the terminal.

Attributes

arguments

the arguments for the forked sbt server if the client needs to start it. It also contains the sbt command arguments to send to the server if any are present.

console

a logging instance. This can use a ConsoleAppender or just simply print to a PrintStream.

errorStream

the sink for messages that we always want to be printed. It is usually System.err but could be overridden in tests or set to a null OutputStream if the NetworkClient needs to be silent.

inputStream

the InputStream from which the client reads bytes. It is not hardcoded to System.in so that a NetworkClient can be remotely controlled by a java process, which is useful in testing.

printStream

the sink for standard out messages. It is typically System.out but in the case of completions, the bytes written to System.out are usually treated as completion results so we need to reroute standard out messages to System.err. It's also useful to override this in testing.

useJNI

toggles whether or not to use the jni based implementations in org.scalasbt.ipcsocket. These are only available on 64 bit linux, mac and windows. Any other platform will need to fall back on jna.

Companion:
object
Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Constructors

def this(configuration: AppConfiguration, arguments: Arguments)
def this(configuration: AppConfiguration, args: List[String])

Concrete methods

def batchExecute(userCommands: List[String]): Int
override def close(): Unit

Attributes

Definition Classes
AutoCloseable
def connect(log: Boolean, promptCompleteUsers: Boolean): Boolean
def getCompletions(query: String): Seq[String]
def init(promptCompleteUsers: Boolean, retry: Boolean): ServerConnection
def messageTypeToLevel(severity: Long): Value
def onNotification(msg: JsonRpcNotificationMessage): Unit
def onRequest(msg: JsonRpcRequestMessage): Unit
def onResponse(msg: JsonRpcResponseMessage): Unit
def onReturningReponse(msg: JsonRpcResponseMessage): Unit

Called on the response for a returning message.

Called on the response for a returning message.

Attributes

def run(): Int
def sendCancelAllCommand(): LinkedBlockingQueue[Boolean]
def sendCommand(command: CommandMessage): Unit
def sendCommandResponse(method: String, command: EventMessage, id: String): Unit
def sendExecCommand(commandLine: String): LinkedBlockingQueue[Integer]
def sendJson(method: String, params: String): String
def sendJson(method: String, params: String, uuid: String): Unit
def sendNotification(method: String, params: String): Unit
def splitDiagnostics(params: PublishDiagnosticsParams): Vector[(Value, String)]
def splitLogMessage(params: LogMessageParams): Vector[(Value, String)]
def waitForServer(portfile: File, log: Boolean, startServer: Boolean): Unit

Forks another instance of sbt in the background. This instance must be shutdown explicitly via sbt -client shutdown

Forks another instance of sbt in the background. This instance must be shutdown explicitly via sbt -client shutdown

Attributes