Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VersionCatalogUpdateTask fails with configuration cache enabled #103

Closed
elvedincuskic-volvofinans opened this issue Feb 23, 2023 · 6 comments · Fixed by #105
Closed

VersionCatalogUpdateTask fails with configuration cache enabled #103

elvedincuskic-volvofinans opened this issue Feb 23, 2023 · 6 comments · Fixed by #105

Comments

@elvedincuskic-volvofinans

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.

@hvisser
Copy link
Contributor

hvisser commented Feb 24, 2023

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 🙏

@elvedincuskic-volvofinans
Copy link
Author

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

@hvisser
Copy link
Contributor

hvisser commented Feb 24, 2023

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.

@hvisser
Copy link
Contributor

hvisser commented Mar 3, 2023

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.

@elvedincuskic-volvofinans
Copy link
Author

elvedincuskic-volvofinans commented Mar 6, 2023

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.

@hvisser
Copy link
Contributor

hvisser commented Mar 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants