mirror of https://github.com/sbt/sbt.git
* Prefix printed continuous compilation line with run number
* Added 'reset' command to reset JLine terminal. This needs to be run after suspending and then resuming sbt.
This commit is contained in:
parent
a2126f19db
commit
87f79a3f8c
6
notes
6
notes
|
|
@ -1,3 +1,9 @@
|
||||||
|
Added:
|
||||||
|
1. prefix continuous compilation with run number
|
||||||
|
2. Added pomRepositoryFilter(repo: MavenRepository): Boolean that excludes local repositories by default
|
||||||
|
3. Added pomPostProcess(pom: Node): Node to make advanced manipulation of the default pom easier (pomExtra covers basic cases)
|
||||||
|
4. Added 'reset' command to reset JLine terminal. This needs to be run after suspending and then resuming sbt.
|
||||||
|
|
||||||
|
|
||||||
- script tasks (in 'scripts' branch). To use:
|
- script tasks (in 'scripts' branch). To use:
|
||||||
1) add implementation of jsr223 to project/build/lib, declare in project/plugins, or add to sbt startup classpath
|
1) add implementation of jsr223 to project/build/lib, declare in project/plugins, or add to sbt startup classpath
|
||||||
|
|
|
||||||
|
|
@ -40,24 +40,32 @@ abstract class JLine extends LineReader
|
||||||
private object JLine
|
private object JLine
|
||||||
{
|
{
|
||||||
def terminal = jline.Terminal.getTerminal
|
def terminal = jline.Terminal.getTerminal
|
||||||
def createReader() =
|
def resetTerminal() = withTerminal { _ => jline.Terminal.resetTerminal }
|
||||||
terminal.synchronized
|
private def withTerminal[T](f: jline.Terminal => T): T =
|
||||||
|
synchronized
|
||||||
{
|
{
|
||||||
val cr = new ConsoleReader
|
val t = terminal
|
||||||
terminal.enableEcho()
|
t.synchronized { f(t) }
|
||||||
cr.setBellEnabled(false)
|
}
|
||||||
cr
|
def createReader() =
|
||||||
|
withTerminal { t =>
|
||||||
|
t.synchronized
|
||||||
|
{
|
||||||
|
val cr = new ConsoleReader
|
||||||
|
t.enableEcho()
|
||||||
|
cr.setBellEnabled(false)
|
||||||
|
cr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
def withJLine[T](action: => T): T =
|
def withJLine[T](action: => T): T =
|
||||||
{
|
withTerminal { t =>
|
||||||
val t = terminal
|
t.synchronized
|
||||||
t.synchronized
|
{
|
||||||
{
|
t.disableEcho()
|
||||||
t.disableEcho()
|
try { action }
|
||||||
try { action }
|
finally { t.enableEcho() }
|
||||||
finally { t.enableEcho() }
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
object SimpleReader extends JLine
|
object SimpleReader extends JLine
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,7 @@ class xMain extends xsbti.AppMain
|
||||||
arguments match
|
arguments match
|
||||||
{
|
{
|
||||||
case "" :: tail => continue(project, tail, failAction)
|
case "" :: tail => continue(project, tail, failAction)
|
||||||
|
case ResetCommand :: tail => JLine.resetTerminal(); continue(project, tail, failAction)
|
||||||
case x :: tail if x.startsWith(";") => continue(project, x.split("""\s*;\s*""").toList ::: tail, failAction)
|
case x :: tail if x.startsWith(";") => continue(project, x.split("""\s*;\s*""").toList ::: tail, failAction)
|
||||||
case (ExitCommand | QuitCommand) :: _ => result( Exit(NormalExitCode) )
|
case (ExitCommand | QuitCommand) :: _ => result( Exit(NormalExitCode) )
|
||||||
case RebootCommand :: tail => reload( tail )
|
case RebootCommand :: tail => reload( tail )
|
||||||
|
|
@ -366,7 +367,11 @@ class xMain extends xsbti.AppMain
|
||||||
val ShowProjectsAction = "projects"
|
val ShowProjectsAction = "projects"
|
||||||
val ExitCommand = "exit"
|
val ExitCommand = "exit"
|
||||||
val QuitCommand = "quit"
|
val QuitCommand = "quit"
|
||||||
|
/** The name of the command that resets JLine. This is necessary when resuming from suspension.*/
|
||||||
|
val ResetCommand = "reset"
|
||||||
|
/** The name of the command that switches to the builder project.*/
|
||||||
val BuilderCommand = "builder"
|
val BuilderCommand = "builder"
|
||||||
|
/** The name of the command that loads the interactive shell.*/
|
||||||
val InteractiveCommand = "shell"
|
val InteractiveCommand = "shell"
|
||||||
/** The list of lowercase command names that may be used to terminate the program.*/
|
/** The list of lowercase command names that may be used to terminate the program.*/
|
||||||
val TerminateActions: Iterable[String] = ExitCommand :: QuitCommand :: Nil
|
val TerminateActions: Iterable[String] = ExitCommand :: QuitCommand :: Nil
|
||||||
|
|
@ -721,10 +726,12 @@ class xMain extends xsbti.AppMain
|
||||||
val actionValid = checkAction(project, action)
|
val actionValid = checkAction(project, action)
|
||||||
if(actionValid)
|
if(actionValid)
|
||||||
{
|
{
|
||||||
|
var count = 0
|
||||||
SourceModificationWatch.watchUntil(project, ContinuousCompilePollDelaySeconds)(shouldTerminate)
|
SourceModificationWatch.watchUntil(project, ContinuousCompilePollDelaySeconds)(shouldTerminate)
|
||||||
{
|
{
|
||||||
|
count += 1
|
||||||
handleAction(project, action)
|
handleAction(project, action)
|
||||||
Console.println("Waiting for source changes... (press enter to interrupt)")
|
Console.println(count + ". Waiting for source changes... (press enter to interrupt)")
|
||||||
}
|
}
|
||||||
while (System.in.available() > 0) System.in.read()
|
while (System.in.available() > 0) System.in.read()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue