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.android.build.gradle.internal.tasks.factory.dependsOn
|
||||||
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
|
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
|
||||||
import com.google.gms.googleservices.GoogleServicesPlugin
|
import com.google.gms.googleservices.GoogleServicesPlugin
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.BufferedReader
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
|
|
||||||
|
|
@ -31,57 +31,57 @@ if (firebaseCloudMessagingAvailable) {
|
||||||
println("google-services.json not found, disabling CloudMessaging feature")
|
println("google-services.json not found, disabling CloudMessaging feature")
|
||||||
}
|
}
|
||||||
|
|
||||||
var gitBranch = ByteArrayOutputStream()
|
|
||||||
var gitVersion = "6.1.0-alpha"
|
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 gitCommitsCount = ProcessBuilder()
|
||||||
val gitVersionStream = ByteArrayOutputStream()
|
.command("git", "rev-list", "$gitDescribe..HEAD", "--count")
|
||||||
val gitCommitsCount = ByteArrayOutputStream()
|
.directory(project.rootDir)
|
||||||
val gitCommitHash = ByteArrayOutputStream()
|
.start()
|
||||||
|
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||||
|
.trim()
|
||||||
|
println("Git commits count: $gitCommitsCount")
|
||||||
|
|
||||||
try {
|
val gitCommitHash = ProcessBuilder()
|
||||||
exec {
|
.command("git", "rev-parse", "--short", "HEAD")
|
||||||
commandLine("git", "describe", "--abbrev=0")
|
.directory(project.rootDir)
|
||||||
standardOutput = gitVersionStream
|
.start()
|
||||||
}
|
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||||
exec {
|
.trim()
|
||||||
commandLine(
|
println("Git commit hash: $gitCommitHash")
|
||||||
"git",
|
|
||||||
"rev-list",
|
gitBranch = ProcessBuilder()
|
||||||
gitVersionStream.toString().trim() + "..HEAD",
|
.command("git", "name-rev", "--name-only", "HEAD")
|
||||||
"--count",
|
.directory(project.rootDir)
|
||||||
)
|
.start()
|
||||||
standardOutput = gitCommitsCount
|
.inputStream.bufferedReader().use(BufferedReader::readText)
|
||||||
}
|
.trim()
|
||||||
exec {
|
println("Git branch name: $gitBranch")
|
||||||
commandLine("git", "rev-parse", "--short", "HEAD")
|
|
||||||
standardOutput = gitCommitHash
|
|
||||||
}
|
|
||||||
exec {
|
|
||||||
commandLine("git", "name-rev", "--name-only", "HEAD")
|
|
||||||
standardOutput = gitBranch
|
|
||||||
}
|
|
||||||
|
|
||||||
gitVersion =
|
gitVersion =
|
||||||
if (gitCommitsCount.toString().trim().toInt() == 0) {
|
if (gitCommitsCount.toInt() == 0) {
|
||||||
gitVersionStream.toString().trim()
|
gitDescribe
|
||||||
} else {
|
} else {
|
||||||
gitVersionStream.toString().trim() + "." +
|
"$gitDescribe.$gitCommitsCount+$gitCommitHash"
|
||||||
gitCommitsCount.toString()
|
|
||||||
.trim() + "+" + gitCommitHash.toString().trim()
|
|
||||||
}
|
}
|
||||||
println("Git version: $gitVersion")
|
} catch (e: Exception) {
|
||||||
} catch (e: Exception) {
|
|
||||||
println("Git not found [$e], using $gitVersion")
|
println("Git not found [$e], using $gitVersion")
|
||||||
}
|
|
||||||
project.version = gitVersion
|
|
||||||
}
|
}
|
||||||
project.tasks.preBuild.dependsOn("getGitVersion")
|
println("Computed git version: $gitVersion")
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
implementation { isCanBeResolved = true }
|
implementation { isCanBeResolved = true }
|
||||||
}
|
}
|
||||||
task("linphoneSdkSource") {
|
|
||||||
|
tasks.register("linphoneSdkSource") {
|
||||||
doLast {
|
doLast {
|
||||||
configurations.implementation.get().incoming.resolutionResult.allComponents.forEach {
|
configurations.implementation.get().incoming.resolutionResult.allComponents.forEach {
|
||||||
if (it.id.displayName.contains("linphone-sdk-android")) {
|
if (it.id.displayName.contains("linphone-sdk-android")) {
|
||||||
|
|
@ -148,13 +148,16 @@ android {
|
||||||
isDebuggable = true
|
isDebuggable = true
|
||||||
isJniDebuggable = 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) {
|
if (useDifferentPackageNameForDebugBuild) {
|
||||||
resValue("string", "file_provider", "$packageName.debug.fileprovider")
|
resValue("string", "file_provider", "$packageName.debug.fileprovider")
|
||||||
} else {
|
} else {
|
||||||
resValue("string", "file_provider", "$packageName.fileprovider")
|
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)
|
resValue("string", "linphone_openid_callback_scheme", packageName)
|
||||||
|
|
||||||
if (crashlyticsAvailable) {
|
if (crashlyticsAvailable) {
|
||||||
|
|
@ -176,9 +179,12 @@ android {
|
||||||
)
|
)
|
||||||
signingConfig = signingConfigs.getByName("release")
|
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", "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)
|
resValue("string", "linphone_openid_callback_scheme", packageName)
|
||||||
|
|
||||||
if (crashlyticsAvailable) {
|
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
|
#Thu Jun 22 12:11:25 CEST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue