This message was deleted.
# configuration-cache
s
This message was deleted.
v
Really error, or warning? If I execute
Copy code
val foo by tasks.registering {
    doLast {
        println(project)
    }
}
with CC on, I get a failed build with the error, if I add
notCompatibleWithConfigurationCache("")
, I get successful build with the same as warning.
k
I tried your example and I get the same result as you (as expected), but I get this when running
artifactoryPublish
Copy code
Configuration cache entry discarded with 12 problems.

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache problems found in this build.

12 problems were found storing the configuration cache, 6 of which seem unique.
- Task `:artifactoryDeploy` of type `org.jfrog.gradle.plugin.artifactory.task.DeployTask`: cannot serialize object of type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
  See <https://docs.gradle.org/8.5/userguide/configuration_cache.html#config_cache:requirements:task_access>
- Task `:artifactoryDeploy` of type `org.jfrog.gradle.plugin.artifactory.task.DeployTask`: cannot serialize object of type 'org.jfrog.gradle.plugin.artifactory.task.ExtractModuleTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
  See <https://docs.gradle.org/8.5/userguide/configuration_cache.html#config_cache:requirements:task_access>
- Task `:artifactoryDeploy` of type `org.jfrog.gradle.plugin.artifactory.task.DeployTask`: execution of task ':artifactoryDeploy' caused invocation of 'Task.project' in other task at execution time which is unsupported.
  See <https://docs.gradle.org/8.5/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution>
- Task `:artifactoryDeploy` of type `org.jfrog.gradle.plugin.artifactory.task.DeployTask`: invocation of 'Task.project' at execution time is unsupported.
  See <https://docs.gradle.org/8.5/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution>
- Task `:artifactoryPublish` of type `org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask`: invocation of 'Task.project' at execution time is unsupported.
  See <https://docs.gradle.org/8.5/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution>
- Task `:extractModuleInfo` of type `org.jfrog.gradle.plugin.artifactory.task.ExtractModuleTask`: invocation of 'Task.project' at execution time is unsupported.
  See <https://docs.gradle.org/8.5/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution>

See the complete report at file:///C:/Users/KarimHouari/Projects/artifactory-test/build/reports/configuration-cache/dm1lvqb8ei0ngfz0eolaeibxf/8vclmwydv802cim4ls27xzj9v/configuration-cache-report.html
> Invocation of 'Task.project' by task ':artifactoryPublish' at execution time is unsupported.
> Invocation of 'Task.project' by task ':extractModuleInfo' at execution time is unsupported.
> Invocation of 'Task.project' by task ':artifactoryDeploy' at execution time is unsupported.
> Execution of task ':artifactoryDeploy' caused invocation of 'Task.project' by task ':artifactoryPublish' at execution time which is unsupported.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.

BUILD FAILED in 1s
with this in build.gradle.kts
Copy code
tasks {
    artifactoryPublish {
        notCompatibleWithConfigurationCache("")
    }
}
v
Maybe it is not the
project
usage at runtime, but the referencing from
DeployTask
to
ExtractModuleTask
? 🤷‍♂️
k
ah right, yeh maybe that's it
I assumed using
notCompatibleWithConfigurationCache
would mean any config cache related issues would be ignored as the config cache won't be used, but I suppose that's not the case
c
I suffered the same last week. What I see is that any usage of
Task.project
fails the build even when you use
notCompatibleWithConfigurationCache
And I would expect it to work because I understand Gradle should disable CC when any of the tasks is not compatible.
v
Please see my first comment @CristianGM
c
¿? It's not a warning but a failure Now I would need to find the scan again (or reproduce it) but I didn't see any other issue in the log.
v
Could maybe be helpful to determine what exactly is the failure condition, yeah. :-)
c
Invocation of 'Task.project' by task 'kotlin scripting dependencies maven allproguard' at execution time is unsupported.
Execution of task 'kotlin scripting dependencies maven allresultJar' caused invocation of 'Task.project' by task 'kotlin scripting dependencies maven allproguard' at execution time which is unsupported.
Invocation of 'Task.project' by task 'kotlin reflectproguard' at execution time is unsupported.
Execution of task 'kotlin reflectresult' caused invocation of 'Task.project' by task 'kotlin reflectproguard' at execution time which is unsupported.
Invocation of 'Task.project' by task 'kotlin compilerproguard' at execution time is unsupported.
maybe the key is:
Execution of task 'kotlin scripting dependencies maven allresultJar' caused invocation of 'Task.project' by task 'kotlin scripting dependencies maven allproguard' at execution time which is unsupported.
(I had other examples just running proguard and failing, but I don't see them)
v
Possible, that was also in the list of OP issues. But I don't even have an idea how to trigger that specific violation
c
in my case
jar
task uses the outputs of
proguard
(the task that uses Task.project in execution time)
v
This just gives the normal message:
Copy code
val foo by tasks.registering {
    notCompatibleWithConfigurationCache("")
    doLast {
        println(project)
    }
}
tasks.jar {
    from(foo)
}
Oh, that's ugly. According to the integ test testing this it happens when "innocent" uses "project" at configuration time, and "offender" causes "innocent" to be configured during its execution phase.
🤔 1
c
uses "project" at configuration time
Execution time, right?
v
No, configuration time, or it wouldn't be innocent
c
haha, ok. Link to that integ test?
v
And that's also why
notCompatibelWithConfigurationCache
does not work
The same why
Copy code
val foo by tasks.registering {
    doLast {
        println(project)
    }
}
tasks.jar {
    notCompatibleWithConfigurationCache("")
    from(foo)
}
fails if you execute
jar
So if you would declare
resultJar
as incompatible and if @Karim Houari would declare
artifactoryDeploy
as incompatible it would probably work as expected
👀 1
c
yes, but in my case that's nonsense because it means all jar tasks, so CC would be always disabled. I opened a PR to proguard to fix the original issue. In any case...this is confusing from the user PoV
v
Definitely
Instead of marking all jar tasks as incompatible, I think you could just cause configuration of "innocent" at configuration time. If you need the result of the task, there should anyway better be a task dependency (optimally implicit) which would already cause "innocent" to be configured at configuration time.
c
True, I'm sure I'll have to come back to this soon (after I fix a ton of errors because I updated proguard from a 5 YO version)
k
Thanks for your help! @Vampire After trying your suggestion of marking
artifactoryDeploy
as incompatible I have found that I need to mark both that and
extractModuleInfo
. Certainly not great user experience but at least I don't have to disable the config cache externally to the project where
artifactoryPublish
is used
👌 1