Slackbot
07/26/2023, 2:43 PMChris Lee
07/26/2023, 2:45 PMChris Lee
07/26/2023, 2:49 PMdoLast
or doFirst
on that task which can be problematic.Miles Peele
07/26/2023, 2:51 PMtarget.subprojects.filter {
it.isAndroidApp()
}
This is called in a tasks.register(..)
block at configuration time, which could be a problem, no?Miles Peele
07/26/2023, 2:52 PMdoLast
or doFirst
blocks anywhere, we use dependsOn
everywhere thoughChris Lee
07/26/2023, 2:53 PMChris Lee
07/26/2023, 2:53 PMMiles Peele
07/26/2023, 2:54 PMsubProjects {...
but that doesn't break the configuration cache AFAIK, right?Chris Lee
07/26/2023, 2:55 PMVampire
07/26/2023, 3:42 PMgetProject
and then maybe follow where it comes from.Miles Peele
07/26/2023, 3:51 PMConcurrentModificationException: (no message)
line that I can't follow furtherChris Lee
07/26/2023, 3:52 PMMiles Peele
07/26/2023, 10:02 PMorg.gradle.api.InvalidUserCodeException: Execution of task ':keys:compileKotlin' caused invocation of 'Task.project' by task ':compose:components:synthesizeDependenciesDebug' at execution time which is unsupported.
If I run compileKotlin
by itself, no issues. If I run synthesizeDependenciesDebug
by itself, no issues. But if I run them together, in aggregate, like so:
register("someTask") {
dependsOn(compileDebugKotlin)
dependsOn(synthesizeDependenciesDebug)
}
then i get the configuration-cache issue. But if neither task calls Task.project
, how is that error saying one task caused the invocation of that by another task?Chris Lee
07/26/2023, 10:05 PMThere’s something cross-project going on - the paths are for different projects,Copy codeExecution of task ':keys:compileKotlin' caused invocation of 'Task.project' by task ':compose:components:synthesizeDependenciesDebug' at execution time which is unsupported.
keys
and :compose:components:synthesizeDependenciesDebug
. Are there places where tasks are wired across projects?Miles Peele
07/26/2023, 10:08 PMBaseProjectPlugin
unfortunately uses a bunch of subprojects {...
lambdas to tie things together, but like so:
register("detektScripts") {
project.subprojects.forEach { subProject ->
subProject.tasks.findByName("detektBuildScripts")?.let { dependsOn(it) }
}
}
I was of the understanding that anything like the above is configuration-cache safeChris Lee
07/26/2023, 10:10 PMChris Lee
07/26/2023, 10:11 PMMiles Peele
07/26/2023, 10:12 PMsubprojects
for a while but circumstances keep it there for now
Also I'm assuming you're saying
findByName
shouldn't be used - I should be using named
?Chris Lee
07/26/2023, 10:13 PMChris Lee
07/26/2023, 10:14 PMBe aware of that difference in behaviour. https://docs.gradle.org/current/userguide/task_configuration_avoidance.htmlis the closest equivalent, but will fail if the task does not exist. Usingnamed(String)
will cause tasks registered with the new API to be created/configured.findByName(String)
Miles Peele
07/26/2023, 10:14 PMMiles Peele
07/26/2023, 10:16 PMregister("something")
project.subprojects
But that shouldn't cause a configuration-cache issue, since that happens at configuration time, not execution time, right?Chris Lee
07/26/2023, 10:18 PMregister("detektScripts") {
project.subprojects.forEach { subProject ->
subProject.tasks.findByName("detektBuildScripts")?.let {
// unclear what the receiver for dependsOn is
dependsOn(it)
}
}
}
…try using named() as that will avoid a dependency on a concrete Task instance (which has a Project reference).Miles Peele
07/26/2023, 10:23 PMbut may store stuff that is not evaluated until execution time.What could this stuff be? If I inject
ProjectLayout
into a Task
, is that non-CC-safe?Chris Lee
07/26/2023, 10:27 PMMiles Peele
07/27/2023, 3:54 PMnamed
or withType
when applicable, and I'm still seeing that same error log:
execution of task :composition-locals:compileDebugKotlin📋 caused invocation of Task.project📋 in other task at execution time which is unsupported.
Trying to debug where this forced invocation is happening is proving to be fairly difficult - the CC report generated says like multiple task of a given project is not CC-safe, despite each of those tasks able to be stored in the CC when run individually
How would I begin to pin down what tasks cause the invocation of another?