nemerosa/versioning

Use JGit/EGit or the gradle-git plugin instead of native Git

miho opened this issue · 8 comments

miho commented

Not every developer has a native git executable in the path. If that's the case, the build.gradle file will fail with an exception. Telling developers/users to install yet another tool does not simplify the build process ;) IDEs such as Netbeans and Eclipse use a Java based Git infrastructure which works nicely in many cases. Another problem with native Git might be compatibility. Although the git repository-format is pretty stable, the native CLI might be incompatible with this plugin. IT is complicated to force a specific, well-tested git-version Therefore, I'm suggesting a switch from native Git to JGit/EGit or the gradle-git plugin.

Hi Michael,

I'll have a look at https://github.com/ajoberstar/grgit.

Best regards,
Damien.

miho commented

Hi Damien,

thanks for your response. Does that mean you will switch to grgit? Would be great! In the meantime I will use it directly.

Regards,
Michael

Hi Michael,

I'll probably use either grgit or jgit (done that in my other projects - but I'm using git describe and it's not available in JGit). I'll try to find some time to do the changes :)

Best regards,
Damien

miho commented

Thanks!

As I feared, the describe command is not complete in either grgit or jgit. The current version of the code of the plugin uses git describe --tags --exact-match --always HEAD in order to know if we are exactly on a tag or not. Those flags are not available in either grgit or jgit.

I have to find another way to get this information.

In the end, I'm using the long version (--long) of the describe command and parse the result to know if I'm on a tag.

Available in version 1.7.0 - published in Bintray, can take some time (< one hour) before it's available. Note that I keep using the git binary for testing the versioning plugin itself, but no longer at runtime.

What a pity! Please make this optional, like in Maven's git-commit-id plugin. Why would I want to use JGit when native git is available and MUCH faster?
See git-commit-id/git-commit-id-maven-plugin#462