forked from huimumua/DashCamera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathother.gradle
49 lines (41 loc) · 1.27 KB
/
other.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
ext {
sdk = [
compileSdkVersion: 25,
buildToolsVersion: "26.0.2",
minSdkVersion : 23,
targetSdkVersion : 25,
]
version = [
versionCode: gitVersionCode(),
versionName: gitVersionTag(),
]
dependencies = [
junit : 'junit:junit:4.12',
appcompatV7 : 'com.android.support:appcompat-v7:25.4.0',
supportV4 : 'com.android.support:support-v4:25.4.0',
supportV13 : 'com.android.support:support-v13:25.4.0',
recyclerview : 'com.android.support:recyclerview-v7:24.2.1',
eventbus : 'org.greenrobot:eventbus:3.1.1',
exifinterface: 'com.android.support:exifinterface:25.4.0'
]
}
def gitVersionCode() {
def cmd = 'git rev-list HEAD --first-parent --count'
try {
cmd.execute().text.trim().toInteger()
} catch (Exception e) {
return 0
}
}
def gitVersionTag() {
def cmd = 'git describe --tags'
def version = cmd.execute().text.trim()
def pattern = "-(\\d+)-g"
def matcher = version =~ pattern
if (matcher) {
version = version.substring(0, matcher.start()) + "." + matcher[0][1]
} else {
version = version + ".0"
}
return version
}