Mercurial > public > develkit
diff init40-git.gradle @ 331:7bc7c6c79d7c
check for current release and hotfix branches when looking for latest snapshot
author | Marc Davis <davis@ssdt-ohio.org> |
---|---|
date | Mon, 06 Mar 2023 13:37:28 -0500 |
parents | 1a7daef79467 |
children | ae546c35dee4 |
line wrap: on
line diff
--- a/init40-git.gradle Fri Mar 03 22:02:56 2023 -0500 +++ b/init40-git.gradle Mon Mar 06 13:37:28 2023 -0500 @@ -802,17 +802,24 @@ Version v = null try { v = new Version(*it.split('\\.')*.toInteger()) + return v } catch (ignored) { - println "non semver tag found, ignoring" //non semver tag found, ignoring } } .findAll { it != null } .sort { v1, v2 -> v2 <=> v1 } - if (versions.isEmpty()) { + + def branches = "git branch --remote".execute().text.split("\n") + .findAll { it.contains('release') || it.contains('hotfix') } + .collect { it.replaceAll('\\s+', ' ').split(' ')[1].split('/')[2] - 'v' } + .collect { new Version(*it.split('\\.')*.toInteger()) } + + def results = (branches + versions).sort { v1, v2 -> v2 <=> v1 } + if (results.isEmpty()) { return new Version().nextSnapshot() } else { - return versions.first().nextSnapshot() + return results.first().nextSnapshot() } } catch (ex) { println ex