State

sbt.State
See theState companion object
final case class State(configuration: AppConfiguration, definedCommands: Seq[Command], exitHooks: Set[ExitHook], onFailure: Option[Exec], remainingCommands: List[Exec], history: History, attributes: AttributeMap, globalLogging: GlobalLogging, currentCommand: Option[Exec], next: Next) extends Identity

Data structure representing all command execution information.

Value parameters

attributes

custom command state. It is important to clean up attributes when no longer needed to avoid memory leaks and class loader leaks.

configuration

provides access to the launcher environment, including the application configuration, Scala versions, jvm/filesystem wide locking, and the launcher itself

definedCommands

the list of command definitions that evaluate command strings. These may be modified to change the available commands.

exitHooks

code to run before sbt exits, usually to ensure resources are cleaned up.

history

tracks the recently executed commands

next

the next action for the command processor to take. This may be to continue with the next command, adjust global logging, or exit.

onFailure

the command to execute when another command fails. onFailure is cleared before the failure handling command is executed.

remainingCommands

the sequence of commands to execute. This sequence may be modified to change the commands to be executed. Typically, the :: and ::: methods are used to prepend new commands to run.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Identity
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def +(newCommand: Command): State
Implicitly added by StateOpsImpl

Registers newCommand as an available command.

Registers newCommand as an available command.

Attributes

def ++(newCommands: Seq[Command]): State
Implicitly added by StateOpsImpl

Registers newCommands as available commands.

Registers newCommands as available commands.

Attributes

def ++:(newCommands: List[Exec]): State
Implicitly added by StateOpsImpl

Schedules commands to be run before any remaining commands.

Schedules commands to be run before any remaining commands.

Attributes

def +:(command: Exec): State
Implicitly added by StateOpsImpl

Schedules command to be run before any remaining commands.

Schedules command to be run before any remaining commands.

Attributes

def ::(command: String): State
Implicitly added by StateOpsImpl

Schedules command to be run before any remaining commands.

Schedules command to be run before any remaining commands.

Attributes

def :::(newCommands: List[String]): State
Implicitly added by StateOpsImpl

Schedules commands to be run before any remaining commands.

Schedules commands to be run before any remaining commands.

Attributes

def addExitHook(act: => Unit): State
Implicitly added by StateOpsImpl

Registers a new exit hook, which will run when sbt exits or restarts.

Registers a new exit hook, which will run when sbt exits or restarts.

Attributes

def baseDir: File
Implicitly added by StateOpsImpl

The application base directory, which is not necessarily the current working directory.

The application base directory, which is not necessarily the current working directory.

Attributes

def classLoaderCache: ClassLoaderCache
Implicitly added by StateOpsImpl

Get the class loader cache for the application.

Get the class loader cache for the application.

Attributes

Implicitly added by StateOpsImpl

Sets the next command processing action to be to rotate the global log and continue executing commands.

Sets the next command processing action to be to rotate the global log and continue executing commands.

Attributes

Implicitly added by StateOpsImpl

Sets the next command processing action to be to continue processing the next command.

Sets the next command processing action to be to continue processing the next command.

Attributes

def exit(ok: Boolean): State
Implicitly added by StateOpsImpl

Sets the next command processing action to be to exit with a zero exit code if ok is true and a nonzero exit code if ok if false.

Sets the next command processing action to be to exit with a zero exit code if ok is true and a nonzero exit code if ok if false.

Attributes

def fail: State
Implicitly added by StateOpsImpl

Marks the currently executing command as failing. This triggers failure handling by the command processor. See also State.onFailure

Marks the currently executing command as failing. This triggers failure handling by the command processor. See also State.onFailure

Attributes

def get[T](key: AttributeKey[T]): Option[T]
Implicitly added by StateOpsImpl

Gets the value associated with key from the custom attributes map.

Gets the value associated with key from the custom attributes map.

Attributes

def handleError(t: Throwable): State
Implicitly added by StateOpsImpl

Marks the currently executing command as failing due to the given exception. This displays the error appropriately and triggers failure handling by the command processor. Note that this does not throw an exception and returns normally. It is only once control is returned to the command processor that failure handling at the command level occurs.

Marks the currently executing command as failing due to the given exception. This displays the error appropriately and triggers failure handling by the command processor. Note that this does not throw an exception and returns normally. It is only once control is returned to the command processor that failure handling at the command level occurs.

Attributes

def has(key: AttributeKey[_]): Boolean
Implicitly added by StateOpsImpl

Returns true if key exists in the custom attributes map, false if it does not exist.

Returns true if key exists in the custom attributes map, false if it does not exist.

Attributes

Implicitly added by StateOpsImpl

Create and register a class loader cache. This should be called once at the application entry-point.

Create and register a class loader cache. This should be called once at the application entry-point.

Attributes

def interactive: Boolean
Implicitly added by StateOpsImpl

An advisory flag that is true if this application will execute commands based on user input.

An advisory flag that is true if this application will execute commands based on user input.

Attributes

Implicitly added by StateOpsImpl

Sets the next command processing action to be to keep the previous log and continue executing commands.

Sets the next command processing action to be to keep the previous log and continue executing commands.

Attributes

def locked[T](file: File)(t: => T): T
Implicitly added by StateOpsImpl

Evaluates the provided expression with a JVM-wide and machine-wide lock on file.

Evaluates the provided expression with a JVM-wide and machine-wide lock on file.

Attributes

def log: Logger
Implicitly added by StateOpsImpl

The Logger used for general command logging.

The Logger used for general command logging.

Attributes

def process(f: (Exec, State) => State): State
Implicitly added by StateOpsImpl
def put[T](key: AttributeKey[T], value: T): State
Implicitly added by StateOpsImpl

Sets the value associated with key in the custom attributes map.

Sets the value associated with key in the custom attributes map.

Attributes

def reboot(full: Boolean): State
Implicitly added by StateOpsImpl

Implementation of reboot.

Implementation of reboot.

Attributes

def reload: State
Implicitly added by StateOpsImpl

Restarts sbt without dropping loaded Scala classes. It is a shallower restart than reboot. This method takes a snapshot of the remaining commands and will resume executing those commands after reload. This means that any commands added to this State will be dropped.

Restarts sbt without dropping loaded Scala classes. It is a shallower restart than reboot. This method takes a snapshot of the remaining commands and will resume executing those commands after reload. This means that any commands added to this State will be dropped.

Attributes

def remove(key: AttributeKey[_]): State
Implicitly added by StateOpsImpl

Removes the key and any associated value from the custom attributes map.

Removes the key and any associated value from the custom attributes map.

Attributes

Implicitly added by StateOpsImpl

Runs any defined exitHooks and then clears them.

Runs any defined exitHooks and then clears them.

Attributes

def setInteractive(i: Boolean): State
Implicitly added by StateOpsImpl

Changes the advisory interactive flag.

Changes the advisory interactive flag.

Attributes

def setNext(n: Next): State
Implicitly added by StateOpsImpl

Sets the next command processing action to do.

Sets the next command processing action to do.

Attributes

def source: Option[CommandSource]
def update[T](key: AttributeKey[T])(f: Option[T] => T): State
Implicitly added by StateOpsImpl

Sets the value associated with key in the custom attributes map by transforming the current value.

Sets the value associated with key in the custom attributes map by transforming the current value.

Attributes

Inherited methods

final override def equals(a: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
Identity -> Any
Inherited from:
Identity
final override def hashCode: Int

Calculate a hash code value for the object.

Calculate a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Identity -> Any
Inherited from:
Identity
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
final override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Identity -> Any
Inherited from:
Identity

Concrete fields

lazy val combinedParser: Parser[() => State]
val s: State
Implicitly added by StateOpsImpl