mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
* Fix AboutActivity Instrumentation Tests * Fix WelcomeActivity Instrumentation Tests * Fix SearchActivity Instrumentation Tests * Fix SignupTest Instrumentation Tests * Fix LoginActivityTest Instrumentation Tests * Fix SettingsActivity Instrumentation Tests * Fix LoginActivity Instrumentation Tests * Update loginUser * Add logoutUser * Fix logoutUser * Update github action to use env variables * Fix github action to use env variables * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Fix github action * Remove scroll * Add wait time * Fix keyboard issue * Disable animation * Enable animation * Enable animation * Disable animation * Fix compile error * Remove AVD Cache * Set timezone and dns * Add AVD cache * Add API level * Update API level to 24 * Add sleep timer * Add scroll * Remove logout * Ignore some tests * update logout * update logout * Fix scroll layout problem * Fix scroll layout problem * Ignore orientation test * Update tests * Update tests * Update API level to 29 * Change device and API level to 27 * Use AndroidJUnit4 * Change API to 28 * Try with macos * Use nested scrollview * Update Profile Activity Test * Update Profile Activity Test * Turn off rotation * Change device * Remove failing test * Change API to 24 * Add rotation lock for failing test * Change API to 24 * Add sleep * Remove text * Remove child * Force rotation on back press * Force open more sheet * Change device to pixel 5 * Change device to 13.5inch * Update tests * Ignore failing test * Use linux * Update tests * Use repo secrets instead * Add mainactivity tests * Remove content description * Different workflows for PR and branch, PR workflow will need maintainer approval to prevent secrets getting leaked * Run instrumentation tests only for push and not for PRs * Fix FileNotFound Exception * Update MainActivity and Profile tests * Fix coverage path issue * Add wait time for map to load * Open contribution * Update settings tests * Update main activity tests * Fix failing test * Fix failing test * Increase login time * Separate settings test * Update review tests * Ignore uploadCancelledAfterLocationPickedTest * Update MainActivity Tests * Update UploadCancelledTest * Update UploadCancelledTest * Update device * Fix Init release error * Fix failing test * Fix failing test * Try with long click * Update UploadCancelledTest.kt * Fix Leaderboard Test * Update testContributions * Set GPS coordinates * Add zoomControllers to excludes * Add ExploreActivityTest * Remove failing condition * Merge tests * Remove failing test * Remove failing test * Fix failing test * Fix failing test * Update AboutActivityTest.kt * Update jacoco.gradle
153 lines
6.1 KiB
Groovy
153 lines
6.1 KiB
Groovy
apply plugin: 'jacoco'
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.7"
|
|
}
|
|
|
|
tasks.withType(Test) {
|
|
jacoco.includeNoLocationClasses = true
|
|
jacoco.excludes = ['jdk.internal.*']
|
|
// see related issue https://github.com/gradle/gradle/issues/5184#issuecomment-457865951
|
|
}
|
|
|
|
project.afterEvaluate {
|
|
|
|
(android.hasProperty('applicationVariants')
|
|
? android.'applicationVariants'
|
|
: android.'libraryVariants')
|
|
.all { variant ->
|
|
def variantName = variant.name
|
|
def unitTestTask = "test${variantName.capitalize()}UnitTest"
|
|
def androidTestCoverageTask = "create${variantName.capitalize()}CoverageReport"
|
|
|
|
def excludes = [
|
|
// data binding
|
|
'android/databinding/**/*.class',
|
|
'**/android/databinding/*Binding.class',
|
|
'**/android/databinding/*',
|
|
'**/androidx/databinding/*',
|
|
'**/BR.*',
|
|
// android
|
|
'**/R.class',
|
|
'**/R$*.class',
|
|
'**/BuildConfig.*',
|
|
'**/Manifest*.*',
|
|
'**/*Test*.*',
|
|
'android/**/*.*',
|
|
// butterKnife
|
|
'**/*$ViewInjector*.*',
|
|
'**/*$ViewBinder*.*',
|
|
'**/*ViewBinding*.*',
|
|
// dagger
|
|
'**/*_MembersInjector.class',
|
|
'**/Dagger*Component.class',
|
|
'**/Dagger*Component$Builder.class',
|
|
'**/*Module_*Factory.class',
|
|
'**/di/*',
|
|
'**/*_Factory*.*',
|
|
'**/*Module*.*',
|
|
'**/*Dagger*.*',
|
|
'**/*Hilt*.*',
|
|
// kotlin
|
|
'**/*MapperImpl*.*',
|
|
'**/*$ViewInjector*.*',
|
|
'**/*$ViewBinder*.*',
|
|
'**/BuildConfig.*',
|
|
'**/*Component*.*',
|
|
'**/*BR*.*',
|
|
'**/Manifest*.*',
|
|
'**/*$Lambda$*.*',
|
|
'**/*Companion*.*',
|
|
'**/*Module*.*',
|
|
'**/*Dagger*.*',
|
|
'**/*Hilt*.*',
|
|
'**/*MembersInjector*.*',
|
|
'**/*_MembersInjector.class',
|
|
'**/*_Factory*.*',
|
|
'**/*_Provide*Factory*.*',
|
|
'**/*Extensions*.*',
|
|
// sealed and data classes
|
|
'**/*$Result.*',
|
|
'**/*$Result$*.*',
|
|
// model
|
|
'**/**/model/*',
|
|
'**/**/models/*',
|
|
'**/model/*',
|
|
// concurrency
|
|
'**/concurrency/*',
|
|
// kvstore
|
|
'**/kvstore/*',
|
|
// db
|
|
'**/db/*',
|
|
// data
|
|
'**/data/*',
|
|
// zoom controllers are part of external library
|
|
'**/**/zoomControllers/*',
|
|
]
|
|
|
|
tasks.create(name: "${unitTestTask}UnifiedCoverage", type: JacocoReport, dependsOn: [
|
|
"$unitTestTask",
|
|
"$androidTestCoverageTask",
|
|
]) {
|
|
group = "Reporting"
|
|
description = "Generate Jacoco unified coverage reports for the ${variantName.capitalize()} build"
|
|
|
|
reports {
|
|
html.enabled = true
|
|
xml.enabled = true
|
|
}
|
|
|
|
def javaClasses = fileTree(dir: variant.javaCompileProvider.get().destinationDir,
|
|
excludes: excludes)
|
|
def kotlinClasses = fileTree(dir: "${buildDir}/tmp/kotlin-classes/${variantName}",
|
|
excludes: excludes)
|
|
|
|
classDirectories.setFrom(files([
|
|
javaClasses,
|
|
kotlinClasses
|
|
]))
|
|
|
|
def variantSourceSets = variant.sourceSets.java.srcDirs.collect { it.path }.flatten()
|
|
sourceDirectories.setFrom(project.files(variantSourceSets))
|
|
|
|
def androidTestsData = fileTree(dir:
|
|
"${buildDir}/outputs/code_coverage/${variantName}AndroidTest/connected/",
|
|
includes: ["**/*.ec"])
|
|
|
|
executionData(files([
|
|
"$project.buildDir/jacoco/${unitTestTask}.exec",
|
|
androidTestsData
|
|
]))
|
|
}
|
|
|
|
tasks.create(name: "${unitTestTask}Coverage", type: JacocoReport, dependsOn: [
|
|
"$unitTestTask"
|
|
]) {
|
|
group = "Reporting"
|
|
description = "Generate Jacoco coverage reports for the ${variantName.capitalize()} build"
|
|
|
|
reports {
|
|
html.enabled = true
|
|
xml.enabled = true
|
|
}
|
|
|
|
def javaClasses = fileTree(dir: variant.javaCompileProvider.get().destinationDir,
|
|
excludes: excludes)
|
|
def kotlinClasses = fileTree(dir: "${buildDir}/tmp/kotlin-classes/${variantName}",
|
|
excludes: excludes)
|
|
|
|
classDirectories.setFrom(files([
|
|
javaClasses,
|
|
kotlinClasses
|
|
]))
|
|
|
|
def variantSourceSets = variant.sourceSets.java.srcDirs.collect { it.path }.flatten()
|
|
sourceDirectories.setFrom(project.files(variantSourceSets))
|
|
|
|
executionData(files([
|
|
"$project.buildDir/jacoco/${unitTestTask}.exec"
|
|
]))
|
|
}
|
|
|
|
}
|
|
}
|