mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 17:08:59 -04:00
Create coverage report for instrumented tests where the source lives in other modules
This commit is contained in:
parent
af3ef4cf63
commit
1033a9a45f
@ -52,7 +52,7 @@ before_script:
|
|||||||
- adb shell input keyevent 82 &
|
- adb shell input keyevent 82 &
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./gradlew createDebugCoverageReport ktlintCheck lint jacocoTestReport app:assembleRelease
|
- ./gradlew jacocoInstrumentationTestReport ktlintCheck lint jacocoTestReport app:assembleRelease
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
@ -7,6 +7,8 @@ plugins {
|
|||||||
}
|
}
|
||||||
apply plugin: KiwixConfigurationPlugin
|
apply plugin: KiwixConfigurationPlugin
|
||||||
|
|
||||||
|
apply from: rootProject.file("jacoco.gradle")
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
versionMajor = 3
|
versionMajor = 3
|
||||||
versionMinor = 0
|
versionMinor = 0
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.kiwix.kiwixmobile.data.local.dao;/*
|
package org.kiwix.kiwixmobile.data.local.dao;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.test.InstrumentationRegistry;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.kiwix.kiwixmobile.data.local.dao;/*
|
package org.kiwix.kiwixmobile.data.local.dao;
|
||||||
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import com.yahoo.squidb.data.AbstractModel;
|
import com.yahoo.squidb.data.AbstractModel;
|
||||||
|
@ -19,7 +19,6 @@ apply plugin: 'io.objectbox'
|
|||||||
apply plugin: 'com.jakewharton.butterknife'
|
apply plugin: 'com.jakewharton.butterknife'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
publishNonDefault true
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
|
@ -31,6 +31,7 @@ import kotlinx.android.synthetic.main.item_book.item_book_label_picture
|
|||||||
import kotlinx.android.synthetic.main.item_book.item_book_label_video
|
import kotlinx.android.synthetic.main.item_book.item_book_label_video
|
||||||
import kotlinx.android.synthetic.main.item_book.item_book_size
|
import kotlinx.android.synthetic.main.item_book.item_book_size
|
||||||
import kotlinx.android.synthetic.main.item_book.item_book_title
|
import kotlinx.android.synthetic.main.item_book.item_book_title
|
||||||
|
import org.kiwix.kiwixmobile.core.base.adapter.BaseViewHolder
|
||||||
import org.kiwix.kiwixmobile.core.downloader.model.Base64String
|
import org.kiwix.kiwixmobile.core.downloader.model.Base64String
|
||||||
import org.kiwix.kiwixmobile.core.extensions.setBitmap
|
import org.kiwix.kiwixmobile.core.extensions.setBitmap
|
||||||
import org.kiwix.kiwixmobile.core.main.KiwixWebView
|
import org.kiwix.kiwixmobile.core.main.KiwixWebView
|
||||||
@ -42,7 +43,6 @@ import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode.MULT
|
|||||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode.NORMAL
|
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode.NORMAL
|
||||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
||||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.LanguageItem
|
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.LanguageItem
|
||||||
import org.kiwix.kiwixmobile.core.base.adapter.BaseViewHolder
|
|
||||||
|
|
||||||
sealed class BookOnDiskViewHolder<in T : BooksOnDiskListItem>(containerView: View) :
|
sealed class BookOnDiskViewHolder<in T : BooksOnDiskListItem>(containerView: View) :
|
||||||
BaseViewHolder<T>(containerView) {
|
BaseViewHolder<T>(containerView) {
|
||||||
@ -76,8 +76,8 @@ sealed class BookOnDiskViewHolder<in T : BooksOnDiskListItem>(containerView: Vie
|
|||||||
|
|
||||||
if (sharedPreferenceUtil.nightMode()) {
|
if (sharedPreferenceUtil.nightMode()) {
|
||||||
item_book_icon.drawable
|
item_book_icon.drawable
|
||||||
.mutate()
|
?.mutate()
|
||||||
.colorFilter = ColorMatrixColorFilter(KiwixWebView.NIGHT_MODE_COLORS)
|
?.colorFilter = ColorMatrixColorFilter(KiwixWebView.NIGHT_MODE_COLORS)
|
||||||
}
|
}
|
||||||
|
|
||||||
val path = item.file.path
|
val path = item.file.path
|
||||||
|
61
jacoco.gradle
Normal file
61
jacoco.gradle
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Kiwix Android
|
||||||
|
* Copyright (c) 2019 Kiwix <android.kiwix.org>
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
apply plugin: 'jacoco'
|
||||||
|
|
||||||
|
jacoco {
|
||||||
|
toolVersion = "0.8.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(Test) {
|
||||||
|
jacoco.includeNoLocationClasses = true
|
||||||
|
}
|
||||||
|
|
||||||
|
task jacocoInstrumentationTestReport(type: JacocoReport, dependsOn: ['createDebugCoverageReport']) {
|
||||||
|
group "Reporting"
|
||||||
|
description "Generate Jacoco coverage reports."
|
||||||
|
reports {
|
||||||
|
xml.enabled = true
|
||||||
|
html.enabled = true
|
||||||
|
html.destination file("${rootProject.buildDir}/coverage-report")
|
||||||
|
}
|
||||||
|
def javaClasses = []
|
||||||
|
def kotlinClasses = []
|
||||||
|
def javaSrc = []
|
||||||
|
def kotlinSrc = []
|
||||||
|
def execution = []
|
||||||
|
|
||||||
|
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
|
||||||
|
|
||||||
|
rootProject.subprojects.each { proj ->
|
||||||
|
javaClasses << fileTree(dir: "$proj.buildDir/intermediates/javac/debug", excludes: fileFilter)
|
||||||
|
kotlinClasses << fileTree(dir: "$proj.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
|
||||||
|
javaSrc << "$proj.projectDir/src/main/java"
|
||||||
|
kotlinSrc << "$proj.projectDir/src/main/kotlin"
|
||||||
|
execution << fileTree(dir: proj.buildDir,
|
||||||
|
includes: ['jacoco/testDebugUnitTest.exec',
|
||||||
|
'outputs/code_coverage/debugAndroidTest/connected/**/*.ec'])
|
||||||
|
}
|
||||||
|
sourceDirectories = files([javaSrc, kotlinSrc])
|
||||||
|
classDirectories = files([javaClasses, kotlinClasses])
|
||||||
|
print execution
|
||||||
|
executionData = files(execution)
|
||||||
|
doLast() {
|
||||||
|
print "file://${reports.html.destination}/index.html"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user