Fix task progress blank line behavior

Run readyLog lazily.
This commit is contained in:
Eugene Yokota 2018-11-16 23:06:36 -08:00
parent d58b302a97
commit b00dcb1b9d
1 changed files with 12 additions and 8 deletions

View File

@ -29,6 +29,7 @@ private[sbt] final class TaskProgress(currentRef: ProjectRef) extends ExecutePro
private[this] val calledBy = new ConcurrentHashMap[Task[_], Task[_]] private[this] val calledBy = new ConcurrentHashMap[Task[_], Task[_]]
private[this] val anonOwners = new ConcurrentHashMap[Task[_], Task[_]] private[this] val anonOwners = new ConcurrentHashMap[Task[_], Task[_]]
private[this] val isReady = new AtomicBoolean(false) private[this] val isReady = new AtomicBoolean(false)
private[this] val isLogReady = new AtomicBoolean(false)
private[this] val isAllCompleted = new AtomicBoolean(false) private[this] val isAllCompleted = new AtomicBoolean(false)
override def initial: Unit = () override def initial: Unit = ()
@ -75,7 +76,6 @@ private[sbt] final class TaskProgress(currentRef: ProjectRef) extends ExecutePro
Thread.sleep(500) Thread.sleep(500)
} }
} }
readyLog()
while (!isAllCompleted.get) { while (!isAllCompleted.get) {
blocking { blocking {
report() report()
@ -86,13 +86,16 @@ private[sbt] final class TaskProgress(currentRef: ProjectRef) extends ExecutePro
private[this] val console = ConsoleOut.systemOut private[this] val console = ConsoleOut.systemOut
private[this] def readyLog(): Unit = { private[this] def readyLog(): Unit = {
console.println("") if (isLogReady.get) ()
console.println("") else {
console.println("") console.println("")
console.println("") console.println("")
console.println("") console.println("")
console.println("") console.println("")
console.print(CursorUp5) console.println("")
console.print(CursorUp5)
isLogReady.set(true)
}
} }
private[this] val stopReportTask = private[this] val stopReportTask =
@ -100,6 +103,7 @@ private[sbt] final class TaskProgress(currentRef: ProjectRef) extends ExecutePro
private[this] def report(): Unit = console.lockObject.synchronized { private[this] def report(): Unit = console.lockObject.synchronized {
val currentTasks = activeTasks.asScala.toList val currentTasks = activeTasks.asScala.toList
def report0: Unit = { def report0: Unit = {
readyLog()
console.print(s"$CursorDown1") console.print(s"$CursorDown1")
currentTasks foreach { currentTasks foreach {
case (task, start) => case (task, start) =>