-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
61 lines (52 loc) · 2.11 KB
/
build.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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
versions = [
'javaVersion' : JavaVersion.VERSION_1_8, // JDK版本
'minSdk' : 14, // 最低版本
'compileSdk' : 28, // 编译版本
'targetSdk' : 28, // 目标版本
'androidPlugin' : '3.5.0', // Android Gradle版本
'majorNumber' : 2, // 大版本号
'minorNumber' : 5, // 小版本号
'revisionNumberCMD' : 'git rev-list HEAD --count', // 提交次数命令
'revisionDescriptionCMD': 'git describe --always', // 提交记录命令
]
// 获取 git 提交次数
try {
revisionNumber = versions.revisionNumberCMD.execute().getText().trim().toInteger()
} catch (Exception ignore) {
revisionNumber = 1
}
// 获取最后一次 git 记录码
try {
revisionDescription = versions.revisionDescriptionCMD.execute().getText().trim()
} catch (Exception ignore) {
revisionDescription = "1"
}
// 版本号
verCode = versions.majorNumber * 1000000 + versions.minorNumber * 10000 + revisionNumber
// 版本名(大版本.小版本.提交次数.提交记录码)
verName = versions.majorNumber + "." + versions.minorNumber + "." + revisionNumber + "." + revisionDescription
}
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:${versions.androidPlugin}"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}