forked from JingYeoh/FragmentRigger
-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.gradle
77 lines (69 loc) · 2.42 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
76
77
import java.util.regex.Matcher
import java.util.regex.Pattern
ext {
app = [
appVerCode : 1,
appVerName : "1.1.0" + "-${releaseTime()}",
applicationId : "com.yj.app",
versionNameSuffix: getCurrentVersionSuffix(),
minSdkVersion : 14
]
rigger = [
publishCode : 12,
publishVersion: "1.4.4",
userOrg : 'jkb',
groupId : 'com.justkiddingbaby',
artifactId : 'fragment-rigger',
desc : 'A powerfual library powered by aop to manage Fragments.',
website : 'https://github.com/JustKiddingBaby/FragmentRigger'
]
android = [
minSdkVersion : 14,
targetSdkVersion : 27,
compileSdkVersion : 28,
buildToolsVersion : "27.0.3",
sourceCompatibilityVersion: JavaVersion.VERSION_1_8,
targetCompatibilityVersion: JavaVersion.VERSION_1_8
]
dependencies = [
appcompatV7 : 'androidx.appcompat:appcompat:1.0.0',
design : 'com.google.android.material:material:1.0.0',
aspectJ : 'org.aspectj:aspectjrt:1.8.9',
javapoet : 'com.squareup:javapoet:1.11.1',
autoSerivice: 'com.google.auto.service:auto-service:1.0-rc3'
]
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 ""
}
}