linphone-android/app/build.gradle
2024-07-15 16:10:43 +02:00

203 lines
No EOL
7 KiB
Groovy

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'org.jlleitschuh.gradle.ktlint' version '11.3.1'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
id 'androidx.navigation.safeargs.kotlin'
id 'com.google.firebase.crashlytics'
}
def packageName = "org.linphone"
def crashlyticsAvailable = new File(projectDir.absolutePath +'/google-services.json').exists() && new File(LinphoneSdkBuildDir + '/libs/').exists() && new File(LinphoneSdkBuildDir + '/libs-debug/').exists()
configurations {
customImplementation.extendsFrom implementation
}
def gitBranch = new ByteArrayOutputStream()
def gitVersion = new ByteArrayOutputStream()
task getGitVersion() {
def gitVersionStream = new ByteArrayOutputStream()
def gitCommitsCount = new ByteArrayOutputStream()
def gitCommitHash = new ByteArrayOutputStream()
try {
exec {
executable "git" args "describe", "--abbrev=0"
standardOutput = gitVersionStream
}
exec {
executable "git" args "rev-list", gitVersionStream.toString().trim() + "..HEAD", "--count"
standardOutput = gitCommitsCount
}
exec {
executable "git" args "rev-parse", "--short", "HEAD"
standardOutput = gitCommitHash
}
exec {
executable "git" args "name-rev", "--name-only", "HEAD"
standardOutput = gitBranch
}
if (gitCommitsCount.toString().toInteger() == 0) {
gitVersion = gitVersionStream.toString().trim()
} else {
gitVersion = gitVersionStream.toString().trim() + "." + gitCommitsCount.toString().trim() + "+" + gitCommitHash.toString().trim()
}
println("Git version: " + gitVersion)
} catch (ignored) {
println("Git not found [" + ignored + "], using " + gitVersion)
}
}
tasks.register('linphoneSdkSource') {
doLast {
configurations.customImplementation.getIncoming().each {
it.getResolutionResult().allComponents.each {
if (it.id.getDisplayName().contains("linphone-sdk-android")) {
println 'Linphone SDK used is ' + it.moduleVersion.version + ' from ' + it.properties["repositoryName"]
}
}
}
}
}
project.tasks.preBuild.dependsOn 'getGitVersion'
project.tasks.preBuild.dependsOn 'linphoneSdkSource'
android {
namespace 'org.linphone'
compileSdk 34
defaultConfig {
applicationId packageName
minSdk 28
targetSdk 34
versionCode 60000
versionName "6.0.0"
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
outputFileName = "linphone-android-${variant.buildType.name}-${versionName}.apk"
}
}
buildTypes {
debug {
debuggable true
jniDebuggable true
resValue "string", "file_provider", packageName + ".fileprovider"
resValue "string", "linphone_app_version", gitVersion.toString().trim()
resValue "string", "linphone_app_branch", gitBranch.toString().trim()
if (crashlyticsAvailable) {
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir file(LinphoneSdkBuildDir + '/libs-debug/').toString()
}
}
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue "string", "file_provider", packageName + ".fileprovider"
resValue "string", "linphone_app_version", gitVersion.toString().trim()
resValue "string", "linphone_app_branch", gitBranch.toString().trim()
}
}
compileOptions {
sourceCompatibility = 17
targetCompatibility = 17
}
kotlinOptions {
jvmTarget = '17'
}
buildFeatures {
dataBinding true
}
namespace 'org.linphone'
lint {
abortOnError false
}
}
dependencies {
implementation "androidx.annotation:annotation:1.7.1"
implementation "androidx.appcompat:appcompat:1.7.0-beta01"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.core:core-ktx:1.13.1"
implementation 'androidx.core:core-splashscreen:1.2.0-alpha01'
implementation "androidx.core:core-telecom:1.0.0-alpha03"
implementation "androidx.media:media:1.7.0"
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
implementation "androidx.window:window:1.2.0"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
// For VFS
implementation "androidx.security:security-crypto-ktx:1.1.0-alpha06"
def nav_version = "2.7.7"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
def emoji_version = "1.4.0"
implementation "androidx.emoji2:emoji2-emojipicker:$emoji_version"
// https://github.com/google/flexbox-layout/blob/main/LICENSE Apache v2.0
implementation 'com.google.android.flexbox:flexbox:3.0.0'
// https://github.com/material-components/material-components-android/blob/master/LICENSE Apache v2.0
implementation 'com.google.android.material:material:1.12.0'
// https://github.com/coil-kt/coil/blob/main/LICENSE.txt Apache v2.0
def coil_version = "2.6.0"
implementation("io.coil-kt:coil:$coil_version")
implementation("io.coil-kt:coil-gif:$coil_version")
implementation("io.coil-kt:coil-svg:$coil_version")
implementation("io.coil-kt:coil-video:$coil_version")
// https://github.com/tommybuonomo/dotsindicator/blob/master/LICENSE Apache v2.0
implementation("com.tbuonomo:dotsindicator:5.0")
// https://github.com/Baseflow/PhotoView/blob/master/LICENSE Apache v2.0
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation platform('com.google.firebase:firebase-bom:32.8.1')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-crashlytics-ndk'
// https://github.com/openid/AppAuth-Android/blob/master/LICENSE Apache v2.0
implementation 'net.openid:appauth:0.11.1'
//noinspection GroovyConstructorNamedArguments
android.defaultConfig.manifestPlaceholders = [appAuthRedirectScheme: 'org.linphone']
// To be able to parse native crash tombstone and print them with SDK logs the next time the app will start
implementation "com.google.protobuf:protobuf-javalite:3.22.3"
//noinspection GradleDynamicVersion
implementation 'org.linphone:linphone-sdk-android:5.4.+'
}
ktlint {
android = true
ignoreFailures = true
}
project.tasks.preBuild.dependsOn 'ktlintFormat'
if (crashlyticsAvailable) {
afterEvaluate {
assembleDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug)
packageDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug)
}
}