gradle-git-version icon indicating copy to clipboard operation
gradle-git-version copied to clipboard

Unable to use this plugin with Gradle 8.1

Open dant3 opened this issue 2 years ago • 9 comments

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.

dant3 avatar May 05 '23 09:05 dant3

As a workaround I implemented the same functionality I was using in this plugin by using jgit, which solves the probem.

dant3 avatar May 05 '23 18:05 dant3

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

dant3 avatar May 11 '23 16:05 dant3

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?

mandrachek avatar Sep 22 '23 17:09 mandrachek

@dant3 did you happen to make a plugin to replace this one?

xenoterracide avatar Feb 15 '24 20:02 xenoterracide

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

xenoterracide avatar Feb 16 '24 13:02 xenoterracide

@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.

dant3 avatar Feb 23 '24 18:02 dant3

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.

xenoterracide avatar Feb 23 '24 18:02 xenoterracide

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.

xenoterracide avatar Feb 23 '24 21:02 xenoterracide

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.

xenoterracide avatar Oct 25 '24 15:10 xenoterracide