-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.gradle
107 lines (86 loc) · 2.48 KB
/
constants.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
rootProject.ext {
compileSdkVersion = 30
minSdkVersion = 21
targetSdkVersion = 30
buildToolsVersion = "30.0.2"
versionCode = generateVersionCode()
versionName = generateVersionName()
androidx_arch_core = "2.1.0"
androidx_core = "1.3.2"
androidx_lifecycle = "2.2.0"
androidx_room = '2.2.5'
androidx_constraintlayout = "2.0.2"
androidx_annotation = "1.1.0"
androidx_appcompat = "1.2.0"
androidx_sqlite = "2.1.0"
androidx_startup_runtime = "1.0.0"
google_android_material = "1.2.1"
google_code_gson = "2.8.6"
junit = "4.13.1"
androidx_test = "1.3.0"
androidx_test_ext = "1.1.2"
androirx_test_espresso = "3.3.0"
reactivex_rxandroid = "2.1.1"
reactivex_rxjava = "2.2.19"
reactivex_rxkotlin = "2.4.0"
squareup_okio = "2.6.0"
squareup_okhttp3 = "4.7.2"
squareup_retrofit = "2.9.0"
squareup_sqlbrite3 = "3.2.0"
glide = "4.11.0"
modulePrefix = ":"
if (gradle.ext.has('xandroidModulePrefix')) {
modulePrefix += gradle.ext.xandroidModulePrefix
}
}
// 0
private static def majorVersion() {
return 1
}
// 0
private static def minorVersion() {
return 8
}
// 00
private static def revisionVersion() {
return 0
}
static def generateVersionCode() {
return majorVersion() * 100000 + minorVersion() * 1000 + revisionVersion()
}
static def generateVersionName() {
def versionName = "${majorVersion()}.${minorVersion()}.${revisionVersion()}"
def suffix = generateVersionSuffix()
if (suffix.isEmpty()) {
return versionName;
} else {
return "${versionName}.${suffix}-${commitId()}"
}
}
static def releaseTime() {
return new Date().format("yyMMddHHmm", TimeZone.getTimeZone("GMT+08:00"))
}
private static def commitVersion() {
Process process = "git rev-list --count HEAD".execute()
process.waitFor()
return process.getText().toInteger()
}
private static def commitId() {
Process process = "git rev-parse --short HEAD".execute()
process.waitFor()
return process.getText().trim()
}
private static def generateVersionSuffix() {
Process process = "git symbolic-ref --short -q HEAD".execute()
process.waitFor()
def branch = process.getText().trim();
System.println("generateVersionSuffix: Branch=" + branch)
switch (branch) {
case "master":
return "";
case "develop":
return "dev"
default:
return branch.replaceAll(File.pathSeparator, "-")
}
}