VersionCatalogUpdateTask fails with configuration cache enabled
elvedincuskic-volvofinans opened this issue · 6 comments
Describe the issue
VersionCatalogUpdateTask
fails when configuration cache is enabled in gradle.properties
when running the task using command ./gradlew versionCatalogUpdate
Steps to reproduce
Enable configuration cache in a project by adding the line below in the gradle.properties
file:
org.gradle.unsafe.configuration-cache=true
and run the previously mentioned task. Using Gradle 7.6.
Workaround
Add below code in the build.gradle.kts root file:
tasks.withType<nl.littlerobots.vcu.plugin.VersionCatalogUpdateTask> {
notCompatibleWithConfigurationCache("Temporary until plugin supports configuration cache")
}
I hope there will be an update to be able to skip above workaround.
What is the exact error you are getting? Past issues around this pointed to the dependency versions plugin not being compatible, but that may have changed. I quickly tried to reproduce this using an included build but I got unrelated issues trying that. If you can supply a small project that reproduces that issue it would be very much appreciated 🙏
I'll see if I can supply a small sample project, until then here's the error:
FAILURE: Build failed with an exception.
* What went wrong:
Configuration cache problems found in this build.
9 problems were found storing the configuration cache, 3 of which seem unique.
- Task `:dependencyUpdates` of type `com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask`: cannot serialize Gradle script object references as these are not supported with the configuration cache.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:dependencyUpdates` of type `com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:versionCatalogUpdate` of type `nl.littlerobots.vcu.plugin.VersionCatalogUpdateTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
> Invocation of 'Task.project' by task ':dependencyUpdates' at execution time is unsupported.
> Invocation of 'Task.project' by task ':versionCatalogUpdate' at execution time is unsupported.
I get the same stacktrace with versions 0.44.0-0.46.0 of https://github.com/ben-manes/gradle-versions-plugin
Thanks, I think most of the Task.project
references are just logging statements that should be easy to fix, but there's one place where the project object is used to figure out the plugin ids, so that's something to look into then.
If you are able to try the 0.7.1-SNAPSHOT
build to verify that would be awesome. It looks like the versions plugin still gives a warning with configuration cache though.
While testing I had a few weird moments where it looks like the reports are empty when running the dependencyVersions
step resulting in an empty toml file (if you are not keeping unused dependencies), but I haven't been able to reproduce this consistently, so YMMV.
I gave it a try and it the task completed successfully the first time it ran but with the following warnings:
3 problems were found storing the configuration cache, 2 of which seem unique.
- Task `:dependencyUpdates` of type `com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask`: cannot serialize Gradle script object references as these are not supported with the configuration cache.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:dependencyUpdates` of type `com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
Running it a second time resulted in Build failed with the following message:
10 problems were found storing the configuration cache, 3 of which seem unique.
- Task `:dependencyUpdates` of type `com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask`: cannot serialize Gradle script object references as these are not supported with the configuration cache.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:dependencyUpdates` of type `com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:versionCatalogUpdate` of type `nl.littlerobots.vcu.plugin.VersionCatalogUpdateTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.6/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
Edit:
Nevermind. The task replaced the 0.7.1-SNAPSHOT
version with the 0.7.0
version (as I didn't pin it during my tests) and that's why it failed the second time around.
Seems to work now, good job! The warnings are still there as you mentioned but the task completes successfully so it's not an issue.
Nevermind. The task replaced the 0.7.1-SNAPSHOT version with the 0.7.0 version (as I didn't pin it during my tests) and that's why it failed the second time around.
😬
Thanks for testing! I'll probably release this next week.