Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MPChartExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.xxmassdeveloper.mpchartexample"
minSdkVersion 19
targetSdkVersion 33
versionCode 57
versionName '3.1.0'
versionCode getGitCommitCount()
versionName getTag()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments useTestStorageService: 'true'
}
Expand Down
4 changes: 4 additions & 0 deletions MPChartLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ android {
minSdkVersion 19
targetSdkVersion 33

// VERSION_NAME no longer available as of 4.1
// https://issuetracker.google.com/issues/158695880
buildConfigField 'String', 'VERSION_NAME', "\"${getTag()}\""

consumerProguardFiles 'proguard-project.txt'
}
buildTypes {
Expand Down
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,15 @@ allprojects {
mavenCentral()
}
}

@SuppressWarnings('unused')
static def getTag() {
def process = "git describe --tags --abbrev=0".execute()
return process.text.toString().trim()
}

@SuppressWarnings('unused')
static def getGitCommitCount() {
def process = "git rev-list HEAD --count".execute()
return process.text.toInteger()
}