-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathconfig.gradle
75 lines (66 loc) · 2.26 KB
/
config.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
import java.util.regex.Matcher
import java.util.regex.Pattern
ext {
app = [
appVerCode : 1,
appVerName : "0.0.1" + "-${releaseTime()}",
applicationId : "com.jkb.supportfragment.demo",
versionNameSuffix: getCurrentVersionSuffix(),
minSdkVersion : 14
]
slidemenu = [
publishCode : 6,
publishVersion: "1.3.0",
userOrg : 'jkb',
groupId : 'com.justkiddingbaby',
artifactId : 'slidemenu',
desc : 'An Android slide menu layout that support left slide and right slide.',
website : 'https://github.com/YangJing96/SlideMenuLayout'
]
android = [
minSdkVersion : 12,
targetSdkVersion : 23,
compileSdkVersion : 23,
buildToolsVersion : "25.0.0",
sourceCompatibilityVersion: JavaVersion.VERSION_1_7,
targetCompatibilityVersion: JavaVersion.VERSION_1_7
]
dependencies = [
appcompatV7: 'com.android.support:appcompat-v7:23.0.1',
design : 'com.android.support:design:24.0.0',
]
store = [
storeKey : '../sign/JustKiddingBaby.jks',
storePassword: 'mimajiushiwo',
keyAlias : 'JustKiddingBaby',
keyPassword : 'mimajiushiwo'
]
}
def static releaseTime() {
return new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+8"))
}
def getCurrentVersionSuffix() {
def currentFlavor = getCurrentFlavor()
if (currentFlavor == "prod") {
return "-prod"
} else if (currentFlavor == "uat") {
return "-uat"
} else if (currentFlavor == "dev") {
return "-dev"
}
}
def getCurrentFlavor() {
String taskRequestName = getGradle().getStartParameter().getTaskRequests().toString()
Pattern pattern;
if (taskRequestName.contains("assemble")) {
pattern = Pattern.compile("assemble(\\w+)(Release|Debug)")
} else {
pattern = Pattern.compile("generate(\\w+)(Release|Debug)")
}
Matcher matcher = pattern.matcher(taskRequestName)
if (matcher.find()) {
return matcher.group(1).toLowerCase()
} else {
return "";
}
}