Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class BuildTimeListener(
private val buildReporter: BuildReporter
) : BuildListener {
private val taskExecutionStatisticsEventAdapter = TaskExecutionStatisticsEventAdapter()
private var configuredTime: Long = 0
private var configuredTime: Long? = null

override fun settingsEvaluated(gradle: Settings) = Unit
override fun projectsLoaded(gradle: Gradle) = Unit
Expand All @@ -26,7 +26,13 @@ internal class BuildTimeListener(
}

override fun buildFinished(result: BuildResult) {
val buildData = buildDataFactory.buildData(result, taskExecutionStatisticsEventAdapter.statistics, configuredTime)
if (configuredTime == null) {
val gradle = result.gradle as DefaultGradle
val services = gradle.services

configuredTime = services[Clock::class.java].currentTime
}
val buildData = buildDataFactory.buildData(result, taskExecutionStatisticsEventAdapter.statistics, configuredTime!!)

println("Build data collected in ${buildData.buildDataCollectionOverhead} ms")

Expand Down