Slackbot
10/25/2022, 9:24 PMJendrik Johannes
10/26/2022, 6:18 AMproject.provider in the task action, because then the CC would need to serialzie this whole context - which it can't.
I assume that you used that code inside the task action. (If that's not the case, then please share a more complete example 🙂 )
If it is, inject ExecOpertations in your task and use that in the action. E.g:
@get:Inject
abstract val execOperations : ExecOperations
@TaskAction
fun runScript() {
execOperations.exec {
commandLine(...)
}
}
Full example:
https://github.com/jjohannes/playdate-sprite-match/blob/main/gradle/playdate-pictu[…]tlin/software/onepiece/playdate/gradle/tasks/PlaydateCompile.ktVampire
10/26/2022, 7:07 AM@UntrackedTask if it is a dedicated task class, or doNotTrackState() if it is an ad-hoc task. But this is not necessary and wouldn't change anything, as you most probably did not define inputs and outputs and so there is nothing to track and the task always out of date anyway.
The configuration cache is a new and still experimental feature, hopefully becoming stable in Gradle 8, where you can save the time needed in the configuration phase of a build, not it's execution phase. But for that to work you have to follow some rules that are documented in the user guide and you violated one of them by somehow accessing the script instance, for example by defining some variable outside your ad-hoc task and then using it in your task action.