[IC] Add filter on files for the CACHE_DIRECTORY_SIZE metric

Without the filter, we were walking both through subdirectories and their files, so some files might be counted twice. Moreover, the behaviour of `File.length` is unspecified for directories.
^KT-63010 In Progress
This commit is contained in:
Alexander.Likhachev
2023-10-31 00:02:33 +01:00
committed by Space Team
parent 4eccbd75c3
commit 06c1bcdc5d
@@ -421,7 +421,9 @@ abstract class IncrementalCompilerRunner<
GradleBuildPerformanceMetric.SNAPSHOT_SIZE,
(buildHistoryFile?.length() ?: 0) + lastBuildInfoFile.length() + abiSnapshotFile.length()
)
reporter.addMetric(GradleBuildPerformanceMetric.CACHE_DIRECTORY_SIZE, cacheDirectory.walk().sumOf { it.length() })
reporter.addMetric(
GradleBuildPerformanceMetric.CACHE_DIRECTORY_SIZE,
cacheDirectory.walk().filter { it.isFile }.sumOf { it.length() })
}
}