File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,26 @@ apply plugin: 'kotlin-kapt'
6
6
7
7
apply plugin : " androidx.navigation.safeargs"
8
8
9
+ // 定义使用当前分支的commit次数作为int值,用于versionCode
10
+ static def getGitVersionCode () {
11
+ return ' git rev-list HEAD --first-parent --count' . execute(). text. trim(). toInteger()
12
+ }
13
+ // 使用git中的tag作为versionName
14
+ static def getGitVersionName () {
15
+ // 因为指令获取的是 v1.1.1-13-ge084397 格式的,所以需要有效部分即可
16
+ return ' git describe --tags' . execute(). text. trim(). substring(0 ,6 )
17
+ }
18
+
9
19
android {
10
20
compileSdkVersion 29
11
- buildToolsVersion = ' 29.0.0 '
21
+ buildToolsVersion = ' 29.0.1 '
12
22
13
23
defaultConfig {
14
24
applicationId " org.zhiwei.jetpack"
15
25
minSdkVersion 21
16
26
targetSdkVersion 29
17
- versionCode 2
18
- versionName " 1.1.2 "
27
+ versionCode getGitVersionCode()
28
+ versionName getGitVersionName()
19
29
testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
20
30
21
31
Original file line number Diff line number Diff line change 1
1
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
2
3
3
buildscript {
4
- ext. kotlin_version = ' 1.3.40 '
4
+ ext. kotlin_version = ' 1.3.41 '
5
5
repositories {
6
6
google()
7
7
jcenter()
8
8
}
9
9
dependencies {
10
- classpath ' com.android.tools.build:gradle:3.4.1 '
10
+ classpath ' com.android.tools.build:gradle:3.4.2 '
11
11
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
12
12
classpath " android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
13
13
You can’t perform that action at this time.
0 commit comments