Mercurial > public > develkit
diff init40-git.gradle @ 327:1a7daef79467
handle non semver tags and ignore
author | Marc Davis <davis@ssdt-ohio.org> |
---|---|
date | Fri, 17 Feb 2023 12:06:01 -0500 |
parents | a49456faf505 |
children | 7bc7c6c79d7c |
line wrap: on
line diff
--- a/init40-git.gradle Thu Feb 09 14:24:44 2023 -0500 +++ b/init40-git.gradle Fri Feb 17 12:06:01 2023 -0500 @@ -798,9 +798,22 @@ def versions = "git tag".execute().text.split("\n") .findAll { it != null || it != "" } .collect { it.replace("v", "") } - .collect { new Version(*it.split('\\.')*.toInteger()) } + .collect { + Version v = null + try { + v = new Version(*it.split('\\.')*.toInteger()) + } catch (ignored) { + println "non semver tag found, ignoring" + //non semver tag found, ignoring + } + } + .findAll { it != null } .sort { v1, v2 -> v2 <=> v1 } - return versions ? versions.first().nextSnapshot() : new Version().nextSnapshot() + if (versions.isEmpty()) { + return new Version().nextSnapshot() + } else { + return versions.first().nextSnapshot() + } } catch (ex) { println ex return new Version().nextSnapshot()