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

Cache gitVersion() result

Open robert3005 opened this issue 6 years ago • 1 comments

if you do

allprojects {
  version gitVersion()
}

you will compute version for every subproject even though they're in the same repo. This increases the runtime by around ~0.5s per subproject. We should cache the result since it won't change across projects.

robert3005 avatar Oct 03 '18 23:10 robert3005

We should cache the result since it won't change across projects.

It is a bit more complex than this. Consider the following use 2 cases:

  • some composite projects may reside in multiple repos, and will have different versions
    • in such case we can cache the version per repo-root.
  • the build may create tags internally
    • which means that we need a way to invalidate the cache
    • ideally there should be a cheap check (cheaper than describing the tag) to detect that the repo has been modified and invalidate automatically

ddimtirov avatar Dec 17 '18 02:12 ddimtirov