-
Notifications
You must be signed in to change notification settings - Fork 0
/
configurations.gradle
43 lines (35 loc) · 1.36 KB
/
configurations.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
ext.versionConfig = [
major: 1,
minor: 0,
patch: 0
]
def currentDate = new Date()
def buildCode = devOptimizationEnabled() ? devVersionCode() : buildCode(currentDate)
def buildTime = devOptimizationEnabled() ? "devOptimization" : buildTime(currentDate)
ext.appConfig = [
compileSdk : 30,
buildTools : "30.0.2",
minSdk : 23,
targetSdk : 29,
multiDexEnabled: true,
versionCode : buildCode,
versionName : "${versionConfig.major}.${versionConfig.minor}.${versionConfig.patch}",
buildTime : "${buildTime}"
]
ext.instrumentationConfig = [
testInstrumentationRunner: "com.ml.hostverifier.EspressoAppTestRunner",
]
def devOptimizationEnabled() {
def devOptimizationEnabled = project.getProperties().get("devOptimization")
return devOptimizationEnabled != null ? devOptimizationEnabled : false
}
def devVersionCode() {
return versionConfig.major * 100 + versionConfig.minor * 10 + versionConfig.patch
}
static def buildCode(currentDate) { Integer.parseInt(formatDate("yyMMddHHmm", currentDate)) }
static def buildTime(currentDate) { formatDate("yyyy-MM-dd-HH:mm", currentDate) }
static def formatDate(format, date) {
def df = new java.text.SimpleDateFormat(format)
df.setTimeZone(TimeZone.getTimeZone("Asia/Singapore"))
df.format(date)
}