Prevent rebuilding by avoid registering doFirst on source tasks (KTI-324)
Do the check for empty directories at the build end instead. Registering doFirst makes constant recompile when switching from Kotlin to Kotlin Native composite with the reason: ``` The task was not up-to-date because of the following reasons: One or more additional actions for task ':kotlin:kotlin-stdlib-common:compileKotlinCommon' have changed. ``` Exact reason why actions are different is not clear (there's a single action in both builds in comparison), but probably the reason in different types due to usage of composite build. #KTI-324 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
9250d86915
commit
a7f57646bf
+16
-10
@@ -465,16 +465,6 @@ allprojects {
|
|||||||
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
|
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<SourceTask>().configureEach {
|
|
||||||
doFirst {
|
|
||||||
source.visit {
|
|
||||||
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
|
|
||||||
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
normalization {
|
normalization {
|
||||||
runtimeClasspath {
|
runtimeClasspath {
|
||||||
ignore("META-INF/MANIFEST.MF")
|
ignore("META-INF/MANIFEST.MF")
|
||||||
@@ -534,6 +524,22 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gradle.buildFinished {
|
||||||
|
val taskGraph = gradle?.taskGraph
|
||||||
|
if (taskGraph != null) {
|
||||||
|
taskGraph.allTasks
|
||||||
|
.filterIsInstance<SourceTask>()
|
||||||
|
.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 {
|
gradle.taskGraph.whenReady {
|
||||||
fun Boolean.toOnOff(): String = if (this) "on" else "off"
|
fun Boolean.toOnOff(): String = if (this) "on" else "off"
|
||||||
val profile = if (isTeamcityBuild) "CI" else "Local"
|
val profile = if (isTeamcityBuild) "CI" else "Local"
|
||||||
|
|||||||
Reference in New Issue
Block a user