File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ android {
99 applicationId " com.xxmassdeveloper.mpchartexample"
1010 minSdkVersion 19
1111 targetSdkVersion 33
12- versionCode 57
13- versionName ' 3.1.0 '
12+ versionCode getGitCommitCount()
13+ versionName getTag()
1414 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
1515 testInstrumentationRunnerArguments useTestStorageService : ' true'
1616 }
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ android {
99 minSdkVersion 19
1010 targetSdkVersion 33
1111
12+ // VERSION_NAME no longer available as of 4.1
13+ // https://issuetracker.google.com/issues/158695880
14+ buildConfigField ' String' , ' VERSION_NAME' , " \" ${ getTag()} \" "
15+
1216 consumerProguardFiles ' proguard-project.txt'
1317 }
1418 buildTypes {
Original file line number Diff line number Diff line change @@ -18,3 +18,15 @@ allprojects {
1818 mavenCentral()
1919 }
2020}
21+
22+ @SuppressWarnings (' unused' )
23+ static def getTag () {
24+ def process = " git describe --tags --abbrev=0" . execute()
25+ return process. text. toString(). trim()
26+ }
27+
28+ @SuppressWarnings (' unused' )
29+ static def getGitCommitCount () {
30+ def process = " git rev-list HEAD --count" . execute()
31+ return process. text. toInteger()
32+ }
You can’t perform that action at this time.
0 commit comments