diff --git a/app/build.gradle b/app/build.gradle index a6bba51a8..19bf0a5b9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,33 +1,24 @@ -apply plugin: 'com.android.application' - -apply plugin: 'kotlin-android' - -apply plugin: 'kotlin-kapt' - -apply plugin: "org.jlleitschuh.gradle.ktlint" - +plugins { + id 'com.android.application' + id 'kotlin-android' + id 'kotlin-kapt' + id 'org.jlleitschuh.gradle.ktlint' +} static def getPackageName() { return "org.linphone" } -def firebaseEnabled() { - File googleFile = new File(projectDir.absolutePath +'/google-services.json') - return googleFile.exists() -} +def firebaseEnabled = new File(projectDir.absolutePath +'/google-services.json').exists() -def crashlyticsEnabled() { - File googleFile = new File(projectDir.absolutePath +'/google-services.json') - File linphoneLibrary = new File(LinphoneSdkBuildDir + '/libs/') - File linphoneLibraryDebug = new File(LinphoneSdkBuildDir + '/libs-debug/') - return googleFile.exists() && linphoneLibrary.exists() && linphoneLibraryDebug.exists() -} +def crashlyticsEnabled = new File(projectDir.absolutePath +'/google-services.json').exists() && new File(LinphoneSdkBuildDir + '/libs/').exists() && new File(LinphoneSdkBuildDir + '/libs-debug/').exists() -if (firebaseEnabled()) { + +if (firebaseEnabled) { apply plugin: 'com.google.gms.google-services' } -if (crashlyticsEnabled()) { +if (crashlyticsEnabled) { apply plugin: 'com.google.firebase.crashlytics' } @@ -141,7 +132,7 @@ android { resValue "string", "file_provider", getPackageName() + ".fileprovider" resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" - if (!firebaseEnabled()) { + if (!firebaseEnabled) { resValue "string", "gcm_defaultSenderId", "none" } @@ -151,15 +142,13 @@ android { releaseWithCrashlytics { initWith release - if (crashlyticsEnabled()) { - resValue "bool", "crashlytics_enabled", "true" + resValue "bool", "crashlytics_enabled", crashlyticsEnabled.toString() + if (crashlyticsEnabled) { firebaseCrashlytics { nativeSymbolUploadEnabled true unstrippedNativeLibsDir file(LinphoneSdkBuildDir + '/libs-debug/').toString() } - } else { - resValue "bool", "crashlytics_enabled", "false" } } @@ -173,19 +162,17 @@ android { resValue "string", "file_provider", getPackageName() + ".debug.fileprovider" resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" - if (!firebaseEnabled()) { + if (!firebaseEnabled) { resValue "string", "gcm_defaultSenderId", "none" } - if (crashlyticsEnabled()) { - resValue "bool", "crashlytics_enabled", "true" + resValue "bool", "crashlytics_enabled", crashlyticsEnabled.toString() + if (crashlyticsEnabled) { firebaseCrashlytics { nativeSymbolUploadEnabled true unstrippedNativeLibsDir file(LinphoneSdkBuildDir + '/libs-debug/').toString() } - } else { - resValue "bool", "crashlytics_enabled", "false" } } } @@ -245,7 +232,7 @@ dependencies { implementation "androidx.security:security-crypto-ktx:1.1.0-alpha03" implementation 'com.google.android.material:material:1.4.0' - implementation 'com.google.android:flexbox:2.0.0' + implementation 'com.google.android.flexbox:flexbox:3.0.0' implementation 'androidx.emoji:emoji:1.1.0' implementation 'androidx.emoji:emoji-bundled:1.1.0' @@ -256,12 +243,12 @@ dependencies { implementation 'com.github.chrisbanes:PhotoView:2.3.0' implementation platform('com.google.firebase:firebase-bom:26.4.0') - if (crashlyticsEnabled()) { + if (crashlyticsEnabled) { implementation 'com.google.firebase:firebase-crashlytics-ndk' } else { compileOnly 'com.google.firebase:firebase-crashlytics-ndk' } - if (firebaseEnabled()) { + if (firebaseEnabled) { implementation 'com.google.firebase:firebase-messaging' } @@ -291,7 +278,7 @@ ktlint { project.tasks['preBuild'].dependsOn 'ktlintFormat' -if (crashlyticsEnabled()) { +if (crashlyticsEnabled) { afterEvaluate { assembleDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug) packageDebugBundle.finalizedBy(uploadCrashlyticsSymbolFileDebug) diff --git a/build.gradle b/build.gradle index 063b55d46..f159920a9 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,6 @@ buildscript { repositories { google() - jcenter() // For ktlint maven { url "https://plugins.gradle.org/m2/" } @@ -14,18 +13,18 @@ buildscript { } // for com.github.chrisbanes:PhotoView } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.2' classpath 'com.google.gms:google-services:4.3.8' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jlleitschuh.gradle:ktlint-gradle:9.1.1" + classpath "org.jlleitschuh.gradle:ktlint-gradle:10.1.0" classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' } } allprojects { repositories { + mavenCentral() google() - jcenter() // For ktlint maven { url "https://www.jitpack.io" } // for com.github.chrisbanes:PhotoView diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 67cca04be..eeb6c1764 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip