File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
plugins/src/main/java/com/jraska/gradle/buildtime Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ internal class BuildTimeListener(
1414 private val buildReporter : BuildReporter
1515) : BuildListener {
1616 private val taskExecutionStatisticsEventAdapter = TaskExecutionStatisticsEventAdapter ()
17- private var configuredTime: Long = 0
17+ private var configuredTime: Long? = null
1818
1919 override fun settingsEvaluated (gradle : Settings ) = Unit
2020 override fun projectsLoaded (gradle : Gradle ) = Unit
@@ -26,7 +26,13 @@ internal class BuildTimeListener(
2626 }
2727
2828 override fun buildFinished (result : BuildResult ) {
29- val buildData = buildDataFactory.buildData(result, taskExecutionStatisticsEventAdapter.statistics, configuredTime)
29+ if (configuredTime == null ) {
30+ val gradle = result.gradle as DefaultGradle
31+ val services = gradle.services
32+
33+ configuredTime = services[Clock ::class .java].currentTime
34+ }
35+ val buildData = buildDataFactory.buildData(result, taskExecutionStatisticsEventAdapter.statistics, configuredTime!! )
3036
3137 println (" Build data collected in ${buildData.buildDataCollectionOverhead} ms" )
3238
You can’t perform that action at this time.
0 commit comments