mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Updated gradle to 9.1.0
This commit is contained in:
parent
48c9b4d7af
commit
97606578a4
2 changed files with 54 additions and 48 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import com.android.build.gradle.internal.tasks.factory.dependsOn
|
||||
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
|
||||
import com.google.gms.googleservices.GoogleServicesPlugin
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.BufferedReader
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
|
|
@ -31,57 +31,57 @@ if (firebaseCloudMessagingAvailable) {
|
|||
println("google-services.json not found, disabling CloudMessaging feature")
|
||||
}
|
||||
|
||||
var gitBranch = ByteArrayOutputStream()
|
||||
var gitVersion = "6.1.0-alpha"
|
||||
var gitBranch = ""
|
||||
try {
|
||||
val gitDescribe = ProcessBuilder()
|
||||
.command("git", "describe", "--abbrev=0")
|
||||
.directory(project.rootDir)
|
||||
.start()
|
||||
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||
.trim()
|
||||
println("Git describe: $gitDescribe")
|
||||
|
||||
task("getGitVersion") {
|
||||
val gitVersionStream = ByteArrayOutputStream()
|
||||
val gitCommitsCount = ByteArrayOutputStream()
|
||||
val gitCommitHash = ByteArrayOutputStream()
|
||||
val gitCommitsCount = ProcessBuilder()
|
||||
.command("git", "rev-list", "$gitDescribe..HEAD", "--count")
|
||||
.directory(project.rootDir)
|
||||
.start()
|
||||
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||
.trim()
|
||||
println("Git commits count: $gitCommitsCount")
|
||||
|
||||
try {
|
||||
exec {
|
||||
commandLine("git", "describe", "--abbrev=0")
|
||||
standardOutput = gitVersionStream
|
||||
}
|
||||
exec {
|
||||
commandLine(
|
||||
"git",
|
||||
"rev-list",
|
||||
gitVersionStream.toString().trim() + "..HEAD",
|
||||
"--count",
|
||||
)
|
||||
standardOutput = gitCommitsCount
|
||||
}
|
||||
exec {
|
||||
commandLine("git", "rev-parse", "--short", "HEAD")
|
||||
standardOutput = gitCommitHash
|
||||
}
|
||||
exec {
|
||||
commandLine("git", "name-rev", "--name-only", "HEAD")
|
||||
standardOutput = gitBranch
|
||||
}
|
||||
val gitCommitHash = ProcessBuilder()
|
||||
.command("git", "rev-parse", "--short", "HEAD")
|
||||
.directory(project.rootDir)
|
||||
.start()
|
||||
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||
.trim()
|
||||
println("Git commit hash: $gitCommitHash")
|
||||
|
||||
gitVersion =
|
||||
if (gitCommitsCount.toString().trim().toInt() == 0) {
|
||||
gitVersionStream.toString().trim()
|
||||
} else {
|
||||
gitVersionStream.toString().trim() + "." +
|
||||
gitCommitsCount.toString()
|
||||
.trim() + "+" + gitCommitHash.toString().trim()
|
||||
}
|
||||
println("Git version: $gitVersion")
|
||||
} catch (e: Exception) {
|
||||
println("Git not found [$e], using $gitVersion")
|
||||
}
|
||||
project.version = gitVersion
|
||||
gitBranch = ProcessBuilder()
|
||||
.command("git", "name-rev", "--name-only", "HEAD")
|
||||
.directory(project.rootDir)
|
||||
.start()
|
||||
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||
.trim()
|
||||
println("Git branch name: $gitBranch")
|
||||
|
||||
gitVersion =
|
||||
if (gitCommitsCount.toInt() == 0) {
|
||||
gitDescribe
|
||||
} else {
|
||||
"$gitDescribe.$gitCommitsCount+$gitCommitHash"
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
println("Git not found [$e], using $gitVersion")
|
||||
}
|
||||
project.tasks.preBuild.dependsOn("getGitVersion")
|
||||
println("Computed git version: $gitVersion")
|
||||
|
||||
configurations {
|
||||
implementation { isCanBeResolved = true }
|
||||
}
|
||||
task("linphoneSdkSource") {
|
||||
|
||||
tasks.register("linphoneSdkSource") {
|
||||
doLast {
|
||||
configurations.implementation.get().incoming.resolutionResult.allComponents.forEach {
|
||||
if (it.id.displayName.contains("linphone-sdk-android")) {
|
||||
|
|
@ -148,13 +148,16 @@ android {
|
|||
isDebuggable = true
|
||||
isJniDebuggable = true
|
||||
|
||||
val appVersion = gitVersion
|
||||
val appBranch = gitBranch
|
||||
println("Setting app version [$appVersion] app branch [$appBranch]")
|
||||
resValue("string", "linphone_app_version", appVersion)
|
||||
resValue("string", "linphone_app_branch", appBranch)
|
||||
if (useDifferentPackageNameForDebugBuild) {
|
||||
resValue("string", "file_provider", "$packageName.debug.fileprovider")
|
||||
} else {
|
||||
resValue("string", "file_provider", "$packageName.fileprovider")
|
||||
}
|
||||
resValue("string", "linphone_app_version", gitVersion.trim())
|
||||
resValue("string", "linphone_app_branch", gitBranch.toString().trim())
|
||||
resValue("string", "linphone_openid_callback_scheme", packageName)
|
||||
|
||||
if (crashlyticsAvailable) {
|
||||
|
|
@ -176,9 +179,12 @@ android {
|
|||
)
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
|
||||
val appVersion = gitVersion
|
||||
val appBranch = gitBranch
|
||||
println("Setting app version [$appVersion] app branch [$appBranch]")
|
||||
resValue("string", "linphone_app_version", appVersion)
|
||||
resValue("string", "linphone_app_branch", appBranch)
|
||||
resValue("string", "file_provider", "$packageName.fileprovider")
|
||||
resValue("string", "linphone_app_version", gitVersion.trim())
|
||||
resValue("string", "linphone_app_branch", gitBranch.toString().trim())
|
||||
resValue("string", "linphone_openid_callback_scheme", packageName)
|
||||
|
||||
if (crashlyticsAvailable) {
|
||||
|
|
|
|||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#Thu Jun 22 12:11:25 CEST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue