1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Handle zero projects more gracefully.

This commit is contained in:
Cedric Beust 2016-08-12 00:24:22 -08:00
parent 2498284043
commit c2c4a156de
2 changed files with 23 additions and 17 deletions

View file

@ -59,7 +59,6 @@ class BuildListeners : IBuildListener, IBuildReportContributor {
fun formatMillisLeft(millis: Long, length: Int) = formatMillis(millis, "%1\$-$length.2f") fun formatMillisLeft(millis: Long, length: Int) = formatMillis(millis, "%1\$-$length.2f")
fun millisToSeconds(millis: Long) = (millis.toDouble() / 1000).toInt() fun millisToSeconds(millis: Long) = (millis.toDouble() / 1000).toInt()
val buildTime = millisToSeconds(System.currentTimeMillis() - buildStartTime!!)
val profiling = args.profiling val profiling = args.profiling
if (profiling) { if (profiling) {
@ -94,6 +93,11 @@ class BuildListeners : IBuildListener, IBuildReportContributor {
// } // }
} }
val buildTime =
if (buildStartTime != null)
millisToSeconds(System.currentTimeMillis() - buildStartTime!!)
else
0
// BUILD SUCCESSFUL / FAILED message // BUILD SUCCESSFUL / FAILED message
val message = val message =
if (hasFailures) { if (hasFailures) {

View file

@ -339,6 +339,7 @@ class DynamicGraphExecutor<T>(val graph : DynamicGraph<T>, val factory: IThreadW
} }
fun displayRegularLog(table: AsciiTable.Builder) : AsciiTable.Builder { fun displayRegularLog(table: AsciiTable.Builder) : AsciiTable.Builder {
if (historyLog.any()) {
val start = historyLog[0].timestamp val start = historyLog[0].timestamp
val projectStart = ConcurrentHashMap<String, Long>() val projectStart = ConcurrentHashMap<String, Long>()
historyLog.forEach { line -> historyLog.forEach { line ->
@ -360,6 +361,7 @@ class DynamicGraphExecutor<T>(val graph : DynamicGraph<T>, val factory: IThreadW
} }
table.addRow(row) table.addRow(row)
} }
}
return table return table
} }