Sebastian Lehrbaum
07/09/2025, 1:17 PMExecution failed for task ':compileKotlin'.
> Error while evaluating property 'disableMultiModuleIC' of task ':compileKotlin'.
> Invocation of 'Task.project' by task ':compileKotlin' at execution time is unsupported with the configuration cache.
We traced it back to this line in the Kotlin compiler: https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plug[…]ommon/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompile.kt
It only happens on jenkins, locally all is fine.
It is reproducible and happens in a cleaned workspace (also in a dirty one).
We are unsure why the error only happens on jenkins. Maybe a timing issue with the lazy? Any idea what that could be?tapchicoma
07/09/2025, 1:27 PMtapchicoma
07/09/2025, 1:28 PMVampire
07/09/2025, 1:32 PMProperty<Boolean>
should be better, for example to wire the value lazily into some other property conveniently, by lazy
should in this aspect here also be fine.
The result of the by lazy
is calculated at the end of the configuration phase and put into the configuration cache entry, so at runtime the line you mentioned should not be executed.
You can easily test with
abstract class Foo : DefaultTask() {
@get:Input
val input: Boolean by lazy {
println("input: ${project.name}")
true
}
}
val foo by tasks.registering(Foo::class) {
doLast { println("foo: $input") }
}
You will see that the input
line is only executed when the CC entry is calculated and if CC entry is reused, the result is taken from the CC entry.Vampire
07/09/2025, 1:36 PM@Input
it is still evaluated early and does not trigger the check. Only if I make the property @Internal
and disable CC, I get the deprecation warning that project
is accessed at execution time.Sebastian Lehrbaum
07/09/2025, 1:48 PMVampire
07/09/2025, 1:49 PMSebastian Lehrbaum
07/09/2025, 1:53 PMVampire
07/09/2025, 1:55 PMproject
being referenced at execution time imho.
Can you gather a build --scan
from the problem, or if not at least a --stacktrace
?Vampire
07/09/2025, 1:55 PMSebastian Lehrbaum
07/09/2025, 2:06 PMtapchicoma
07/09/2025, 2:13 PMSebastian Lehrbaum
07/09/2025, 2:25 PMtapchicoma
07/09/2025, 3:09 PMtask.project
in that place is suspicious and we should redo itVampire
07/09/2025, 5:05 PMI'm still trying to understand it deeper, honestly I don't even know what it means to be referenced at "execution time".It means that while task logic is executed a call to
Task#getProject
was done which is deprecated without CC and an error with CC.
Anyway invokingWhy do you think it is suspicious? I don't see why the pure usage at that spot should be a problem. How it is used is questionable though. 😄 Using a lazy API to eagerly get a value which will only work like expected if the value happens to be only calculated after all tasks were configured already.in that place is suspicious and we should redo ittask.project
Sebastian Lehrbaum
07/10/2025, 7:43 AM