-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon_config.gradle
51 lines (45 loc) · 1.57 KB
/
common_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
project.ext {
versionName = "1.0.0"
versionCode = versionCode()
compileSdkVersion = 28
buildToolsVersion = "29.0.0"
minSdkVersion = 21
targetSdkVersion = 28
applicationId = "com.deepinsoul"
supportVersion = "28.0.0"
constraintLayoutVersion = '1.1.3'
isSoulLoginDebug = false //false:为module,true:为application
isSoulPictureDebug = false
isSoulMusicDebug = false
isSoulVideoDebug = false
setDefaultConfig = {
extension -> //闭包参数extension相当于android 对象
extension.compileSdkVersion project.ext.compileSdkVersion
extension.buildToolsVersion project.ext.buildToolsVersion
extension.defaultConfig {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode project.ext.versionCode
versionName project.ext.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
}
def versionCode() {
def versionName = project.ext.versionName
println(versionName)
String[] split = versionName.split("\\.")
List<String> versions = split.toList()
if (split.length < 3) {
for (i in split.length..2) {
versions.add("0")
}
}
StringBuilder builder = new StringBuilder()
for (s in versions) {
builder.append(String.format("%02d", Integer.parseInt(s)))
}
def versionCode = Integer.parseInt(builder.toString())
println(versionCode)
return versionCode
}