Updated gradle from 4.2.2 to 7.0.2 + bumped ktlint dependency

This commit is contained in:
Sylvain Berfini 2021-09-03 09:07:05 +02:00
parent ecc318d084
commit 06a3124ee6
3 changed files with 25 additions and 39 deletions

View file

@ -1,33 +1,24 @@
apply plugin: 'com.android.application' plugins {
id 'com.android.application'
apply plugin: 'kotlin-android' id 'kotlin-android'
id 'kotlin-kapt'
apply plugin: 'kotlin-kapt' id 'org.jlleitschuh.gradle.ktlint'
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
static def getPackageName() { static def getPackageName() {
return "org.linphone" return "org.linphone"
} }
def firebaseEnabled() { def firebaseEnabled = new File(projectDir.absolutePath +'/google-services.json').exists()
File googleFile = new File(projectDir.absolutePath +'/google-services.json')
return googleFile.exists()
}
def crashlyticsEnabled() { def crashlyticsEnabled = new File(projectDir.absolutePath +'/google-services.json').exists() && new File(LinphoneSdkBuildDir + '/libs/').exists() && new File(LinphoneSdkBuildDir + '/libs-debug/').exists()
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()
}
if (firebaseEnabled()) {
if (firebaseEnabled) {
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
} }
if (crashlyticsEnabled()) { if (crashlyticsEnabled) {
apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.firebase.crashlytics'
} }
@ -141,7 +132,7 @@ android {
resValue "string", "file_provider", getPackageName() + ".fileprovider" resValue "string", "file_provider", getPackageName() + ".fileprovider"
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
if (!firebaseEnabled()) { if (!firebaseEnabled) {
resValue "string", "gcm_defaultSenderId", "none" resValue "string", "gcm_defaultSenderId", "none"
} }
@ -151,15 +142,13 @@ android {
releaseWithCrashlytics { releaseWithCrashlytics {
initWith release initWith release
if (crashlyticsEnabled()) { resValue "bool", "crashlytics_enabled", crashlyticsEnabled.toString()
resValue "bool", "crashlytics_enabled", "true" if (crashlyticsEnabled) {
firebaseCrashlytics { firebaseCrashlytics {
nativeSymbolUploadEnabled true nativeSymbolUploadEnabled true
unstrippedNativeLibsDir file(LinphoneSdkBuildDir + '/libs-debug/').toString() 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", "file_provider", getPackageName() + ".debug.fileprovider"
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
if (!firebaseEnabled()) { if (!firebaseEnabled) {
resValue "string", "gcm_defaultSenderId", "none" resValue "string", "gcm_defaultSenderId", "none"
} }
if (crashlyticsEnabled()) { resValue "bool", "crashlytics_enabled", crashlyticsEnabled.toString()
resValue "bool", "crashlytics_enabled", "true" if (crashlyticsEnabled) {
firebaseCrashlytics { firebaseCrashlytics {
nativeSymbolUploadEnabled true nativeSymbolUploadEnabled true
unstrippedNativeLibsDir file(LinphoneSdkBuildDir + '/libs-debug/').toString() 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 "androidx.security:security-crypto-ktx:1.1.0-alpha03"
implementation 'com.google.android.material:material:1.4.0' 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:1.1.0'
implementation 'androidx.emoji:emoji-bundled: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 'com.github.chrisbanes:PhotoView:2.3.0'
implementation platform('com.google.firebase:firebase-bom:26.4.0') implementation platform('com.google.firebase:firebase-bom:26.4.0')
if (crashlyticsEnabled()) { if (crashlyticsEnabled) {
implementation 'com.google.firebase:firebase-crashlytics-ndk' implementation 'com.google.firebase:firebase-crashlytics-ndk'
} else { } else {
compileOnly 'com.google.firebase:firebase-crashlytics-ndk' compileOnly 'com.google.firebase:firebase-crashlytics-ndk'
} }
if (firebaseEnabled()) { if (firebaseEnabled) {
implementation 'com.google.firebase:firebase-messaging' implementation 'com.google.firebase:firebase-messaging'
} }
@ -291,7 +278,7 @@ ktlint {
project.tasks['preBuild'].dependsOn 'ktlintFormat' project.tasks['preBuild'].dependsOn 'ktlintFormat'
if (crashlyticsEnabled()) { if (crashlyticsEnabled) {
afterEvaluate { afterEvaluate {
assembleDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug) assembleDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug)
packageDebugBundle.finalizedBy(uploadCrashlyticsSymbolFileDebug) packageDebugBundle.finalizedBy(uploadCrashlyticsSymbolFileDebug)

View file

@ -5,7 +5,6 @@ buildscript {
repositories { repositories {
google() google()
jcenter() // For ktlint
maven { maven {
url "https://plugins.gradle.org/m2/" url "https://plugins.gradle.org/m2/"
} }
@ -14,18 +13,18 @@ buildscript {
} // for com.github.chrisbanes:PhotoView } // for com.github.chrisbanes:PhotoView
} }
dependencies { 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 'com.google.gms:google-services:4.3.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 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' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
} }
} }
allprojects { allprojects {
repositories { repositories {
mavenCentral()
google() google()
jcenter() // For ktlint
maven { maven {
url "https://www.jitpack.io" url "https://www.jitpack.io"
} // for com.github.chrisbanes:PhotoView } // for com.github.chrisbanes:PhotoView

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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