Fix task timings

I noticed that the reports generated when using sbt.task.timings=true
made very little sense. They were displaying timings for tests that
couldn't possibly have been run. I tracked this down to the TaskTimings
be stored in the progressReport setting which meant they were reused
across multiple task runs. After this change, the reports made a lot
more sense.
This commit is contained in:
Ethan Atkins 2019-08-31 12:46:10 -07:00
parent a7dd86939f
commit 30ede13a09
1 changed files with 4 additions and 7 deletions

View File

@ -156,12 +156,8 @@ object EvaluateTask {
lazy private val sharedProgress = new TaskTimings(reportOnShutdown = true)
def taskTimingProgress: Option[ExecuteProgress[Task]] =
if (SysProp.taskTimings) {
if (SysProp.taskTimingsOnShutdown)
Some(sharedProgress)
else
Some(new TaskTimings(reportOnShutdown = false))
} else None
if (SysProp.taskTimingsOnShutdown) Some(sharedProgress)
else None
lazy private val sharedTraceEvent = new TaskTraceEvent()
def taskTraceEvent: Option[ExecuteProgress[Task]] =
@ -240,7 +236,8 @@ object EvaluateTask {
extracted,
structure
)
val reporters = maker map { _.progress }
val reporters = maker.map(_.progress) ++
(if (SysProp.taskTimings) new TaskTimings(reportOnShutdown = false) :: Nil else Nil)
// configure the logger for super shell
ConsoleAppender.setShowProgress((reporters collect {
case p: TaskProgress => ()