Skip to content

Commit e686aa0

Browse files
ALikhachevSpace Team
authored andcommitted
[BTA] Report IC compile iterations from daemon to build metrics reporter
^KT-78198 In Progress Relates to KT-78199
1 parent 72c8c46 commit e686aa0

File tree

1 file changed

+10
-1
lines changed
  • compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal

1 file changed

+10
-1
lines changed

compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/daemonAdapters.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ internal class DaemonCompilationResults(
9393
override fun add(compilationResultCategory: Int, value: Serializable) {
9494
// TODO propagate the values to the caller via callbacks, requires to make metrics a part of the API
9595
when (compilationResultCategory) {
96-
CompilationResultCategory.IC_COMPILE_ITERATION.code -> kotlinLogger.debug(value as? CompileIterationResult, rootProjectDir)
96+
CompilationResultCategory.IC_COMPILE_ITERATION.code -> {
97+
kotlinLogger.debug(value as? CompileIterationResult, rootProjectDir)
98+
val compileIterationResult = value as? CompileIterationResult
99+
if (compileIterationResult != null) {
100+
val sourceFiles = compileIterationResult.sourceFiles
101+
if (sourceFiles.any()) {
102+
buildMetricsReporter.addMetric(GradleBuildPerformanceMetric.COMPILE_ITERATION, 1)
103+
}
104+
}
105+
}
97106
CompilationResultCategory.BUILD_METRICS.code -> @Suppress("UNCHECKED_CAST") (value as? BuildMetrics<GradleBuildTime, GradleBuildPerformanceMetric>)?.let {
98107
buildMetricsReporter.addMetrics(it)
99108
}

0 commit comments

Comments
 (0)