diff --git a/build.gradle.kts b/build.gradle.kts index 70c5a737ead..d9a28f35230 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -465,16 +465,6 @@ allprojects { outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true } } - tasks.withType().configureEach { - doFirst { - source.visit { - if (file.isDirectory && file.listFiles()?.isEmpty() == true) { - logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath) - } - } - } - } - normalization { runtimeClasspath { ignore("META-INF/MANIFEST.MF") @@ -534,6 +524,22 @@ allprojects { } } +gradle.buildFinished { + val taskGraph = gradle?.taskGraph + if (taskGraph != null) { + taskGraph.allTasks + .filterIsInstance() + .filter { it.didWork } + .forEach { + it.source.visit { + if (file.isDirectory && file.listFiles()?.isEmpty() == true) { + logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath) + } + } + } + } +} + gradle.taskGraph.whenReady { fun Boolean.toOnOff(): String = if (this) "on" else "off" val profile = if (isTeamcityBuild) "CI" else "Local"