This message was deleted.
# community-support
s
This message was deleted.
j
This sounds like a complicated way of Gradle to tell you that you can't use
project.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:
Copy code
@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.kt
v
Not exactly I'd say. The error is about Gradle script object, not Project. I don't think he used a dedicated task class, but an ad-hoc task. But yeah, as Jendrik said, please provide your code. Also regarding your second question, whether the task will execute each time has nothing to do with the configuration cache. You can mark your task with
@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.