From 519d46bc0aebffe501e678b89c612c0a720ff608 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 15 Mar 2023 13:59:47 +0100 Subject: [PATCH] Fixed build, updated dependencies & auto format build.gradle --- app/build.gradle | 96 ++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aa9abf99f..86b818748 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,6 @@ plugins { id 'com.android.application' id 'kotlin-android' - id 'kotlin-android-extensions' id 'kotlin-kapt' id 'org.jlleitschuh.gradle.ktlint' id 'org.jetbrains.kotlin.android' @@ -14,9 +13,9 @@ static def getPackageName() { return "org.linphone" } -def firebaseAvailable = new File(projectDir.absolutePath +'/google-services.json').exists() +def firebaseAvailable = new File(projectDir.absolutePath + '/google-services.json').exists() -def crashlyticsAvailable = new File(projectDir.absolutePath +'/google-services.json').exists() && new File(LinphoneSdkBuildDir + '/libs/').exists() && new File(LinphoneSdkBuildDir + '/libs-debug/').exists() +def crashlyticsAvailable = new File(projectDir.absolutePath + '/google-services.json').exists() && new File(LinphoneSdkBuildDir + '/libs/').exists() && new File(LinphoneSdkBuildDir + '/libs-debug/').exists() if (firebaseAvailable) { apply plugin: 'com.google.gms.google-services' @@ -106,16 +105,16 @@ android { // See https://developer.android.com/studio/releases/gradle-plugin#3-6-0-behavior for why extractNativeLibs is set to true in debug flavor if (variant.buildType.name == "release" || variant.buildType.name == "releaseWithCrashlytics") { variant.getMergedFlavor().manifestPlaceholders = [linphone_address_mime_type: "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address", - linphone_file_provider: getPackageName() + ".fileprovider", - appLabel: "@string/app_name", - firebaseServiceEnabled: enableFirebaseService, - extractNativeLibs: "false"] + linphone_file_provider : getPackageName() + ".fileprovider", + appLabel : "@string/app_name", + firebaseServiceEnabled : enableFirebaseService, + extractNativeLibs : "false"] } else { variant.getMergedFlavor().manifestPlaceholders = [linphone_address_mime_type: "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address", - linphone_file_provider: getPackageName() + ".debug.fileprovider", - appLabel: "@string/app_name_debug", - firebaseServiceEnabled: enableFirebaseService, - extractNativeLibs: "true"] + linphone_file_provider : getPackageName() + ".debug.fileprovider", + appLabel : "@string/app_name_debug", + firebaseServiceEnabled : enableFirebaseService, + extractNativeLibs : "true"] } } @@ -213,7 +212,6 @@ dependencies { implementation "androidx.security:security-crypto-ktx:1.1.0-alpha05" implementation "androidx.window:window:1.0.0" implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.test:rules:1.4.0' def nav_version = "2.5.3" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" @@ -258,11 +256,12 @@ dependencies { //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4' // UITests dependencies - debugImplementation 'androidx.test:runner:1.5.1' + implementation 'androidx.test:rules:1.5.0' + debugImplementation 'androidx.test:runner:1.5.2' debugImplementation 'androidx.test:core:1.5.0' - debugImplementation 'androidx.test.ext:junit-ktx:1.1.4' + debugImplementation 'androidx.test.ext:junit-ktx:1.1.5' - debugImplementation 'androidx.test.espresso:espresso-core:3.4.0' + debugImplementation 'androidx.test.espresso:espresso-core:3.5.1' debugImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' } @@ -271,9 +270,10 @@ task generateContactsXml(type: Copy) { into "src/main/res/xml/" outputs.upToDateWhen { file('src/main/res/xml/contacts.xml').exists() } filter { - line -> line - .replaceAll('%%AUTO_GENERATED%%', 'This file has been automatically generated, do not edit or commit !') - .replaceAll('%%PACKAGE_NAME%%', getPackageName()) + line -> + line + .replaceAll('%%AUTO_GENERATED%%', 'This file has been automatically generated, do not edit or commit !') + .replaceAll('%%PACKAGE_NAME%%', getPackageName()) } } @@ -295,8 +295,8 @@ if (crashlyticsAvailable) { // screenshots ui tests -def reportsDirectory = new File(buildDir,"reports${File.separator}androidTests${File.separator}connected").absolutePath -def screenshotDirectory = new File(reportsDirectory,"screenshots").absolutePath +def reportsDirectory = new File(buildDir, "reports${File.separator}androidTests${File.separator}connected").absolutePath +def screenshotDirectory = new File(reportsDirectory, "screenshots").absolutePath def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { @@ -320,10 +320,10 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { failedTestJunitReportContent = failedTestJunitReportContent.substring(0, failureCounterStart) + "$failure" + failedTestJunitReportContent.substring(failureCounterEnd) failedTestJunitReportContent = failedTestJunitReportContent.substring(0, percentInfoStart) + "$percent" + failedTestJunitReportContent.substring(percentInfoEnd) - return [failedTestJunitReportContent,failure,percent] + return [failedTestJunitReportContent, failure, percent] } - ext.addFailedTestsHeader = {failedTestJunitReportContent, mode -> + ext.addFailedTestsHeader = { failedTestJunitReportContent, mode -> def tab0 = "${mode}\n\n\n
" def tab0Index = failedTestJunitReportContent.indexOf(tab0) @@ -336,14 +336,14 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { return failedTestJunitReportContent } - ext.updateRecapValues = {failedTestJunitReportContent, name, failures, percent, variant -> + ext.updateRecapValues = { failedTestJunitReportContent, name, failures, percent, variant -> failedTestJunitReportContent = failedTestJunitReportContent.replace("\"success\"$variant>\n\n", startIndex) +4 - startIndex = failedTestJunitReportContent.indexOf("", startIndex) +4 + startIndex = failedTestJunitReportContent.indexOf("", startIndex) + 4 + startIndex = failedTestJunitReportContent.indexOf("", startIndex) + 4 def endIndex = failedTestJunitReportContent.indexOf("", startIndex) failedTestJunitReportContent = failedTestJunitReportContent.substring(0, startIndex) + "${failures}" + failedTestJunitReportContent.substring(endIndex) - startIndex = failedTestJunitReportContent.indexOf("", startIndex) failedTestJunitReportContent = failedTestJunitReportContent.substring(0, startIndex) + "\"failures\">${percent}%" + failedTestJunitReportContent.substring(endIndex) return failedTestJunitReportContent @@ -367,7 +367,7 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { failureScreenshotsDirectory.eachFile { failedTestClassDirectory -> def failedTestClassName = failedTestClassDirectory.name - def failedTestPackageName = failedTestClassName.substring(0,failedTestClassName.lastIndexOf(".")) + def failedTestPackageName = failedTestClassName.substring(0, failedTestClassName.lastIndexOf(".")) def packageJunitReportFile = new File(reportsDirectory, "${failedTestPackageName}.html") if (!packageJunitReportFile.exists()) { @@ -392,16 +392,16 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { def failedTestCaseDescription = failedTestCase.name def pt1 = failedTestCaseDescription.indexOf(".") def line = failedTestCaseDescription.substring(0, pt1) - def pt2 = failedTestCaseDescription.indexOf(".", pt1+1) - def name = failedTestCaseDescription.substring(pt1+1, pt2) - def pt3 = failedTestCaseDescription.indexOf(".", pt2+1) + def pt2 = failedTestCaseDescription.indexOf(".", pt1 + 1) + def name = failedTestCaseDescription.substring(pt1 + 1, pt2) + def pt3 = failedTestCaseDescription.indexOf(".", pt2 + 1) if (pt3 != -1) { - name += " (${failedTestCaseDescription.substring(pt2+1,pt3)})" + name += " (${failedTestCaseDescription.substring(pt2 + 1, pt3)})" } - failedTestJunitReportContent = addFailedTestsHeader(failedTestJunitReportContent,"Tests") - packageJunitReportContent = addFailedTestsHeader(packageJunitReportContent,"Classes") - indexJunitReportContent = addFailedTestsHeader(indexJunitReportContent,"Classes") + failedTestJunitReportContent = addFailedTestsHeader(failedTestJunitReportContent, "Tests") + packageJunitReportContent = addFailedTestsHeader(packageJunitReportContent, "Classes") + indexJunitReportContent = addFailedTestsHeader(indexJunitReportContent, "Classes") def failedTest = "

${failedTestName}

" def failedTestIndex = failedTestJunitReportContent.indexOf(failedTest) @@ -420,7 +420,7 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { } //package.html - newtestDiv = "\n\n
${failedTestClassName.substring(failedTestClassName.lastIndexOf(".")+1)}\n\n" + newtestDiv = "\n\n${failedTestClassName.substring(failedTestClassName.lastIndexOf(".") + 1)}\n\n" newtestDiv += "\n${failedTestName}\n\n\n" endDiv = "\n\n
\n
\n${failedTestClassName.substring(failedTestClassName.lastIndexOf(".")+1)}\n\n" + newtestDiv = "\n\n${failedTestClassName.substring(failedTestClassName.lastIndexOf(".") + 1)}\n\n" newtestDiv += "\n${failedTestName}\n\n\n" endDiv = "\n\n
\n
${failedTestName}\npassed", "${failedTestName}\nfailed") - def classSummaryValues = updateSummaryValues(failedTestJunitReportContent,failures) - def packageSummaryValues = updateSummaryValues(packageJunitReportContent,failures) - def indexSummaryValues = updateSummaryValues(indexJunitReportContent,failures) + def classSummaryValues = updateSummaryValues(failedTestJunitReportContent, failures) + def packageSummaryValues = updateSummaryValues(packageJunitReportContent, failures) + def indexSummaryValues = updateSummaryValues(indexJunitReportContent, failures) failedTestJunitReportContent = classSummaryValues[0] packageJunitReportContent = packageSummaryValues[0] indexJunitReportContent = indexSummaryValues[0] - packageJunitReportContent = updateRecapValues(packageJunitReportContent,failedTestClassName,classSummaryValues[1],classSummaryValues[2],"") - indexJunitReportContent = updateRecapValues(indexJunitReportContent,failedTestClassName,classSummaryValues[1],classSummaryValues[2],"/") - indexJunitReportContent = updateRecapValues(indexJunitReportContent,failedTestPackageName,packageSummaryValues[1],packageSummaryValues[2],"") + packageJunitReportContent = updateRecapValues(packageJunitReportContent, failedTestClassName, classSummaryValues[1], classSummaryValues[2], "") + indexJunitReportContent = updateRecapValues(indexJunitReportContent, failedTestClassName, classSummaryValues[1], classSummaryValues[2], "/") + indexJunitReportContent = updateRecapValues(indexJunitReportContent, failedTestPackageName, packageSummaryValues[1], packageSummaryValues[2], "") failedTestClassJunitReportFile.write(failedTestJunitReportContent) packageJunitReportFile.write(packageJunitReportContent) indexJunitReportFile.write(indexJunitReportContent) - - } } } @@ -501,7 +499,7 @@ def fetchScreenshotsTask = task('fetchScreenshots', type: Exec, group: 'reportin def launchScreenshotsComparisonTask = task('launchScreenshotsComparison', type: Exec, group: 'reporting') { workingDir "$rootDir/screport/" def windowed = "true" - if (project.hasProperty("screportWindowed") ) { + if (project.hasProperty("screportWindowed")) { windowed = screportWindowed } commandLine "python3", "launch.py", "-rp", "$projectDir/src/androidTest/java/org/linphone/screenshots", "-sp", "$projectDir/build/reports/androidTests/connected/screenshots", "-wd", "$windowed" @@ -520,10 +518,10 @@ def isScreenshotComparisonNeededTask = task('isScreenshotComparisonNeeded', type standardOutput = new ByteArrayOutputStream() doLast { - launchScreenshotsComparisonTask.onlyIf {"$standardOutput" == ""} - fetchScreenshotsTask.onlyIf {"$standardOutput" == ""} - clearScreenshotsTask.onlyIf {"$standardOutput" == ""} - embedScreenshotsTask.onlyIf {"$standardOutput" == ""} + launchScreenshotsComparisonTask.onlyIf { "$standardOutput" == "" } + fetchScreenshotsTask.onlyIf { "$standardOutput" == "" } + clearScreenshotsTask.onlyIf { "$standardOutput" == "" } + embedScreenshotsTask.onlyIf { "$standardOutput" == "" } } finalizedBy {