Last active
June 21, 2022 08:10
-
-
Save jonnycaley/8ef3a52ac8d68c5956bc460099dd36f2 to your computer and use it in GitHub Desktop.
BuildDurationService - Capturing build time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BuildDurationService : BuildService<BuildServiceParameters.None>, BuildOperationListener, AutoCloseable { | |
var buildDuration: Long? = null | |
override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} | |
override fun finished(buildOperationDescriptor: BuildOperationDescriptor, operationFinishEvent: OperationFinishEvent) { | |
if (buildOperationDescriptor.details is RunRootBuildWorkBuildOperationType.Details) { | |
val details = buildOperationDescriptor.details as RunRootBuildWorkBuildOperationType.Details? | |
details?.buildStartTime?.let { buildStartTime -> | |
buildDuration = System.currentTimeMillis() - buildStartTime | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment