File tree 1 file changed +19
-6
lines changed
1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ android {
25
25
buildToolsVersion ' 22.0.1'
26
26
27
27
defaultConfig {
28
- versionName = ' 1.9.2' + getGitCommitId ()
29
- versionCode = 30
28
+ versionName = ' 1.9.2' + getVersionNameSuffix ()
29
+ versionCode = getVersionCodeInteger()
30
30
minSdkVersion 15
31
31
targetSdkVersion 22
32
32
@@ -61,11 +61,24 @@ android {
61
61
}
62
62
}
63
63
64
- Object getGitCommitId () {
64
+ String getVersionNameSuffix () {
65
65
try {
66
66
def git = org.ajoberstar.grgit.Grgit . open(dir : ' ../..' )
67
- return " -${ git.head().abbreviatedId} "
68
- } catch (Exception ) {
67
+ def versionNameSuffix = " -${ git.head().abbreviatedId} "
68
+ git. close()
69
+ return versionNameSuffix
70
+ } catch (ignored) {
69
71
return " "
70
72
}
71
- }
73
+ }
74
+
75
+ def getVersionCodeInteger () {
76
+ try {
77
+ def git = org.ajoberstar.grgit.Grgit . open(dir : ' ../..' )
78
+ def versionCode = git. log(). size()
79
+ git. close()
80
+ return versionCode
81
+ } catch (ignored) {
82
+ return 1
83
+ }
84
+ }
You can’t perform that action at this time.
0 commit comments