Use FlowParameter for buildFinish event

Support build scan report for Gradle 8.1

#KT-55740: Fixed
#KT-58251: Fixed
This commit is contained in:
Nataliya.Valtman
2023-05-05 12:47:37 +02:00
committed by Space Team
parent 99e4ca65be
commit 06ac8a10cd
12 changed files with 616 additions and 145 deletions
@@ -20,7 +20,7 @@ class BuildSessionLogger(
private val maxProfileFiles: Int = DEFAULT_MAX_PROFILE_FILES,
private val maxFileSize: Long = DEFAULT_MAX_PROFILE_FILE_SIZE,
private val maxFileAge: Long = DEFAULT_MAX_FILE_AGE,
private val forceValuesValidation: Boolean = false
private val forceValuesValidation: Boolean = false,
) : IStatisticsValuesConsumer {
companion object {
@@ -131,7 +131,10 @@ class BuildSessionLogger(
}
@Synchronized
fun finishBuildSession(@Suppress("UNUSED_PARAMETER") action: String?, failure: Throwable?) {
fun finishBuildSession(
@Suppress("UNUSED_PARAMETER") action: String?,
buildFailed: Boolean,
) {
try {
// nanotime could not be used as build start time in nanotime is unknown. As result, the measured duration
// could be affected by system clock correction
@@ -142,7 +145,7 @@ class BuildSessionLogger(
}
report(NumericalMetrics.GRADLE_EXECUTION_DURATION, finishTime - it.projectEvaluatedTime)
report(NumericalMetrics.BUILD_FINISH_TIME, finishTime)
report(BooleanMetrics.BUILD_FAILED, failure != null)
report(BooleanMetrics.BUILD_FAILED, buildFailed)
}
buildSession = null
} finally {