This message was deleted.
# configuration-cache
s
This message was deleted.
v
If after tasks is good too, yes. For before I think no
j
problem I need to copy files before another task is running
Copy code
target.gradle.taskGraph.beforeTask { task ->
    if (task.name == "some name") {
        // add files to build/some-dir
    }
}
I will have to rebuilt all of this then
v
Sounds like you definitely should not do that anyway
But other than that, you could just register a
doFirst
action with the task in question
j
This should be the same then?
Copy code
val task =
    target.tasks.named("some name").apply {
        configure {
            it.doFirst {
                // add files to build/some-dir
            }
        }
    }
Copy code
DefaultTaskContainer#NamedDomainObjectProvider.configure(Action) on task set cannot be executed in the current context.
c
The key is...what's the context?
So, you can configure another task, but you can't do it, for example, from another task
j
Yeah, the problem this was a mess, I am refactoring instead of trying to get it working because it is awful to maintain at this moment
v
So, you can configure another task, but you can't do it, for example, from another task
Of course you can, as long as you don't need configuration cache compatibility. But most often there are better ways.