Improved use of git version
This commit is contained in:
parent
64799c119a
commit
bfc7a386ee
2 changed files with 24 additions and 27 deletions
|
@ -23,6 +23,25 @@ static def isLocalAarAvailable() {
|
||||||
return isLocalDebugAarAvailable() || isLocalReleaseAarAvailable()
|
return isLocalDebugAarAvailable() || isLocalReleaseAarAvailable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task getGitVersion() {
|
||||||
|
def gitVersion = "4.1"
|
||||||
|
def gitVersionStream = new ByteArrayOutputStream()
|
||||||
|
|
||||||
|
def result = exec {
|
||||||
|
def command = "git describe --always"
|
||||||
|
ignoreExitValue = true
|
||||||
|
executable "bash" args "-l", "-c", command
|
||||||
|
standardOutput = gitVersionStream
|
||||||
|
}
|
||||||
|
if (result.getExitValue() == 0) {
|
||||||
|
gitVersion = gitVersionStream.toString().trim()
|
||||||
|
println("Git version: " + gitVersion)
|
||||||
|
} else {
|
||||||
|
println("Git not found")
|
||||||
|
}
|
||||||
|
project.version = gitVersion
|
||||||
|
}
|
||||||
|
|
||||||
///// Exclude Files /////
|
///// Exclude Files /////
|
||||||
|
|
||||||
def excludeFiles = []
|
def excludeFiles = []
|
||||||
|
@ -41,29 +60,6 @@ excludePackage.add('**/libopenh264**')
|
||||||
excludePackage.add('**/**tester**')
|
excludePackage.add('**/**tester**')
|
||||||
excludePackage.add('**/LICENSE.txt')
|
excludePackage.add('**/LICENSE.txt')
|
||||||
|
|
||||||
|
|
||||||
def gitVersion = new ByteArrayOutputStream()
|
|
||||||
|
|
||||||
task getGitVersion {
|
|
||||||
doLast {
|
|
||||||
def result = exec {
|
|
||||||
def command = "git describe --always"
|
|
||||||
ignoreExitValue = true
|
|
||||||
executable "bash" args "-l", "-c", command
|
|
||||||
standardOutput = gitVersion
|
|
||||||
}
|
|
||||||
if (result.getExitValue() == 0) {
|
|
||||||
gitVersion = gitVersion.toString().trim()
|
|
||||||
println("Git version: " + gitVersion)
|
|
||||||
} else {
|
|
||||||
gitVersion = "unknown"
|
|
||||||
println("Git not found")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project.tasks['preBuild'].dependsOn 'getGitVersion'
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -73,6 +69,8 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.tasks['preBuild'].dependsOn 'getGitVersion'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
|
@ -83,7 +81,7 @@ android {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 4124
|
versionCode 4124
|
||||||
versionName "4.1"
|
versionName "${project.version}"
|
||||||
applicationId getPackageName()
|
applicationId getPackageName()
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
manifestPlaceholders = [linphone_address_mime_type:"vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"]
|
manifestPlaceholders = [linphone_address_mime_type:"vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"]
|
||||||
|
@ -91,7 +89,7 @@ android {
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all {
|
variant.outputs.all {
|
||||||
outputFileName = "linphone-android-${variant.buildType.name}-${gitVersion.toString().trim()}.apk"
|
outputFileName = "linphone-android-${variant.buildType.name}-${project.version}.apk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +124,6 @@ android {
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
debuggable true
|
debuggable true
|
||||||
jniDebuggable true
|
jniDebuggable true
|
||||||
versionNameSuffix '-debug'
|
|
||||||
|
|
||||||
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
||||||
resValue "string", "file_provider", getPackageName() + ".provider"
|
resValue "string", "file_provider", getPackageName() + ".provider"
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class AboutActivity extends MainActivity {
|
||||||
aboutVersion.setText(
|
aboutVersion.setText(
|
||||||
String.format(
|
String.format(
|
||||||
getString(R.string.about_version),
|
getString(R.string.about_version),
|
||||||
BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")"));
|
BuildConfig.VERSION_NAME + " (" + BuildConfig.BUILD_TYPE + ")"));
|
||||||
|
|
||||||
TextView privacyPolicy = findViewById(R.id.privacy_policy_link);
|
TextView privacyPolicy = findViewById(R.id.privacy_policy_link);
|
||||||
privacyPolicy.setOnClickListener(
|
privacyPolicy.setOnClickListener(
|
||||||
|
|
Loading…
Reference in a new issue