gradle-git-version
gradle-git-version copied to clipboard
Unable to use this plugin with Gradle 8.1
What happened?
Recently upgraded my project to Gradle 8.1 and now it crashes on configuration stage:
* What went wrong:
Configuration cache problems found in this build.
3 problems were found storing the configuration cache, 2 of which seem unique.
- Build file 'app/build.gradle': external process started 'git describe --tags --always --first-parent --abbrev=7 --match=* HEAD'
See https://docs.gradle.org/8.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Build file 'app/build.gradle': external process started 'git version'
See https://docs.gradle.org/8.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
It seems that new gradle does not like then plugins run process at the configuration stage. I'm currently use this plugin to get a version details so that I can then use it in extensions to configure other things and obviously this has to be known at configuration stage.
As a workaround I implemented the same functionality I was using in this plugin by using jgit, which solves the probem.
Seems like this section of gradle documentation contains details on how to proceed with migration: https://docs.gradle.org/8.0/userguide/configuration_cache.html#config_cache:requirements:external_processes
The best workaround for now appears to be to disable the configuration cache, which is not ideal. https://docs.gradle.org/8.0/userguide/configuration_cache.html#config_cache:usage:enable
This has been broken for a relatively long time now.
Is this plugin no longer being maintained?
@dant3 did you happen to make a plugin to replace this one?
I have an old plugin that was abandon-ware... it doesn't work right now, but I've decided to resurrect it, since it didn't fork, instead preferrring jgit (which I think won't). Hopeful that I'll get it working by the end of the day.
https://github.com/xenoterracide/gradle-semver
@dant3 did you happen to make a plugin to replace this one?
I've replaced all usages of this plugin with jgit tasks. Not really a plugin, but it could be extracted to become one I suppose. Howerver it does not resolve the issue because jgit also does Process.exec under the hood in certain situations. I also set those gradle properties
org.gradle.unsafe.configuration-cache=true
org.gradle.configuration-cache.problems=warn
So that it only gives warnings instead of errors. I sometimes see this warning that jgit did called git (to resolve git configuration) but it doesn't happen every time.
those are caused by https://github.com/eclipse-jgit/jgit/issues/24 people can feel free to weigh in there. Mine is making reasonable progress, would love feedback, I've been messing around with the api quite a bit. I'll probably make some final decisions for 0.9.0 today.
I think I'm personally generally happy with my API, although at least one person mentioned maybe wanting a provider so if anyone has any opinions on that. Checkout https://github.com/xenoterracide/gradle-semver and give me feedback. I'm not certain 0.9.x will be the final API before 1.0. I'm going to work on a publish to the plugin portal now, and then dogfooding.
I'm going to stop commenting on here now, I feel like I'm now spamming someone else's project about my own.
So, breaking my promise of spamming here... sorry if you tried my thing, and it was a bit unstable. I'm now building in some better dog-fooding so that my plugin can easily consume its own pre-releases before pushing to the plugin portal.
Given that, I'm hoping this is the last time I break my API and contract. I'd love feedback before I do, even if you don't plan on using it.
Would you want the branch name included? https://github.com/xenoterracide/gradle-semver/issues/173
How do you feel about it moving to just a provider? https://github.com/xenoterracide/gradle-semver/issues/171
Any additional feedback? obviously it's not a drop in for this plugin but I hope it's able to service the primary need or two.