Print recompilation reasons in build report

This commit is contained in:
Alexey Tsvetkov
2019-01-29 02:41:50 +03:00
parent 47bb938b94
commit 01c23510c7
6 changed files with 55 additions and 23 deletions
@@ -34,6 +34,7 @@ internal class RemoteICReporter(
CompilationResultCategory.IC_COMPILE_ITERATION.code in compilationOptions.requestedCompilationResults
private val shouldReportICLog = CompilationResultCategory.IC_LOG.code in compilationOptions.requestedCompilationResults
private val icLogLines = arrayListOf<String>()
private val recompilationReason = HashMap<File, String>()
override fun report(message: () -> String) {
reportImpl(isMessageVerbose = false, message = message)
@@ -64,9 +65,18 @@ internal class RemoteICReporter(
}
if (shouldReportICLog && incremental) {
icLogLines.add("Compile iteration:")
sourceFiles.relativePaths(rootDir).forEach {
icLogLines.add(" $it")
sourceFiles.relativePaths(rootDir).forEach { file ->
val reason = recompilationReason[file]?.let { " <- $it" } ?: ""
icLogLines.add(" $file$reason")
}
recompilationReason.clear()
}
}
override fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String) {
super.reportMarkDirty(affectedFiles, reason)
if (shouldReportICLog) {
affectedFiles.forEach { recompilationReason[it] = reason }
}
}