-
Notifications
You must be signed in to change notification settings - Fork 12
/
version.gradle
70 lines (60 loc) · 2.69 KB
/
version.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
def version = "N/A",versionMajor = "0",versionMinor = "0",versionPatch = "0",versionBuild = "0"
def fullVersionTag = "",shaGit = "",dirty = null
def longVersionName = null
/*
* version.gradle
* Copyright (c) 2018
* Authors: Ionut Damian, Michael Dietz, Frank Gaibler, Daniel Langerenken, Simon Flutura,
* Vitalijs Krumins, Antonio Grieco
* *****************************************************
* This file is part of the Social Signal Interpretation for Java (SSJ) framework
* developed at the Lab for Human Centered Multimedia of the University of Augsburg.
*
* SSJ has been inspired by the SSI (http://openssi.net) framework. SSJ is not a
* one-to-one port of SSI to Java, it is an approximation. Nor does SSJ pretend
* to offer SSI's comprehensive functionality and performance (this is java after all).
* Nevertheless, SSJ borrows a lot of programming patterns from SSI.
*
* This library is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this library; if not, see <http://www.gnu.org/licenses/>.
*/
// Fetch the version according to git latest tag and "how far are we from last tag"
try {
longVersionName = "git -C . describe --tags --long --dirty".execute().text.trim()
(fullVersionTag, versionBuild, shaGit, dirty) = longVersionName.tokenize('-')
(versionMajor, versionMinor, versionPatch) = fullVersionTag.tokenize('.')
if (versionPatch == null)
versionPatch = "0"
if (versionMajor.charAt(0) == 'v')
versionMajor = versionMajor.substring(1)
version = "$versionMajor.$versionMinor"
if (versionBuild != "0")
version = "$version.$versionPatch.$versionBuild"
else if (versionPatch != "0")
version = "$version.$versionPatch"
if (dirty != null) //otherwise lesser will always be dirty
version = "$version-dirty"
// printf("DEBUG version: " + version)
}
catch(Exception e1) {
printf("> Error getting versioning info from git: " + e1.getMessage())
}
ext.getVerName = { ->
return version
}
ext.getVerCode = { ->
// Turn the version name into a version code
return versionMajor.toInteger() * 100000 +
versionMinor.toInteger() * 10000 +
versionPatch.toInteger() * 1000 +
versionBuild.toInteger()
}