consolidate jacoco coverage
This commit is contained in:
parent
8cc8f1681a
commit
8aa523ab0e
|
@ -20,7 +20,10 @@ jobs:
|
||||||
|
|
||||||
# The next step will run the unit tests
|
# The next step will run the unit tests
|
||||||
- android/run-tests:
|
- android/run-tests:
|
||||||
test-command: ./gradlew -Pcoverage -PfirebaseDisable testFullDebugUnitTest jacocoTestFullDebugUnitTestReport
|
test-command: ./gradlew testFullDebugUnitTest
|
||||||
|
|
||||||
|
- android/run-tests:
|
||||||
|
test-command: ./gradlew allDebugCoverage
|
||||||
|
|
||||||
# Then start the emulator and run the Instrumentation tests!
|
# Then start the emulator and run the Instrumentation tests!
|
||||||
# - android/start-emulator-and-run-tests:
|
# - android/start-emulator-and-run-tests:
|
||||||
|
@ -33,35 +36,7 @@ jobs:
|
||||||
# command: |
|
# command: |
|
||||||
# ./gradlew assembleRelease
|
# ./gradlew assembleRelease
|
||||||
- codecov/upload:
|
- codecov/upload:
|
||||||
file: './app/build/jacoco/jacoco.xml'
|
file: './build/reports/jacoco/allDebugCoverage/allDebugCoverage.xml'
|
||||||
- codecov/upload:
|
|
||||||
file: './automation/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './combo/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './core/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './dana/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './danar/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './danars/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './database/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './insight/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './medtronic/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './omnipod-common/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './omnipod-dash/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './omnipod-eros/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './rileylink/build/jacoco/jacoco.xml'
|
|
||||||
- codecov/upload:
|
|
||||||
file: './wear/build/jacoco/jacoco.xml'
|
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
# Below is the definition of your workflow.
|
# Below is the definition of your workflow.
|
||||||
|
|
|
@ -57,6 +57,7 @@ buildscript {
|
||||||
plugins {
|
plugins {
|
||||||
id "io.gitlab.arturbosch.detekt" version "1.19.0"
|
id "io.gitlab.arturbosch.detekt" version "1.19.0"
|
||||||
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
|
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
|
||||||
|
id 'org.barfuin.gradle.jacocolog' version '2.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
@ -86,6 +87,8 @@ allprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply from: 'gradle/jacoco_project.gradle'
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@ android {
|
||||||
debug {
|
debug {
|
||||||
testCoverageEnabled(project.hasProperty('coverage'))
|
testCoverageEnabled(project.hasProperty('coverage'))
|
||||||
}
|
}
|
||||||
firebaseDisable {
|
// firebaseDisable {
|
||||||
System.setProperty("disableFirebase", "true")
|
// System.setProperty("disableFirebase", "true")
|
||||||
ext.enableCrashlytics = false
|
// ext.enableCrashlytics = false
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|
85
gradle/jacoco_project.gradle
Normal file
85
gradle/jacoco_project.gradle
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
apply plugin: 'jacoco'
|
||||||
|
|
||||||
|
jacoco {
|
||||||
|
toolVersion '0.8.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(Test) {
|
||||||
|
jacoco.includeNoLocationClasses = true
|
||||||
|
jacoco.excludes = ['jdk.internal.*']
|
||||||
|
}
|
||||||
|
|
||||||
|
project.afterEvaluate {
|
||||||
|
def variants = ["debug", "fullDebug"]
|
||||||
|
|
||||||
|
tasks.create(name: "allDebugCoverage", type: JacocoReport) {
|
||||||
|
|
||||||
|
group = "Reporting"
|
||||||
|
description = "Generate overall Jacoco coverage report for the debug build."
|
||||||
|
|
||||||
|
reports {
|
||||||
|
html.required.set(true)
|
||||||
|
xml.required.set(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
def excludes = [
|
||||||
|
'**/R.class',
|
||||||
|
'**/R$*.class',
|
||||||
|
'**/BuildConfig.*',
|
||||||
|
'**/Manifest*.*',
|
||||||
|
'**/*Test*.*',
|
||||||
|
'android/**/*.*',
|
||||||
|
'androidx/**/*.*',
|
||||||
|
'**/*$ViewInjector*.*',
|
||||||
|
'**/*Dagger*.*',
|
||||||
|
'**/*MembersInjector*.*',
|
||||||
|
'**/*_Factory.*',
|
||||||
|
'**/*_Provide*Factory*.*',
|
||||||
|
'**/*_ViewBinding*.*',
|
||||||
|
'**/AutoValue_*.*',
|
||||||
|
'**/R2.class',
|
||||||
|
'**/R2$*.class',
|
||||||
|
'**/*Directions$*',
|
||||||
|
'**/*Directions.*',
|
||||||
|
'**/*Binding.*'
|
||||||
|
]
|
||||||
|
|
||||||
|
def jClasses = subprojects.collect { proj ->
|
||||||
|
variants.collect { variant ->
|
||||||
|
"${proj.buildDir}/intermediates/javac/$variant/classes"
|
||||||
|
}
|
||||||
|
}.flatten()
|
||||||
|
def kClasses = subprojects.collect { proj ->
|
||||||
|
variants.collect { variant ->
|
||||||
|
"${proj.buildDir}/tmp/kotlin-classes/$variant"
|
||||||
|
}
|
||||||
|
}.flatten()
|
||||||
|
|
||||||
|
def javaClasses = jClasses.collect { path ->
|
||||||
|
fileTree(dir: path, excludes: excludes)
|
||||||
|
}
|
||||||
|
def kotlinClasses = kClasses.collect { path ->
|
||||||
|
fileTree(dir: path, excludes: excludes)
|
||||||
|
}
|
||||||
|
|
||||||
|
classDirectories.from = files([javaClasses, kotlinClasses])
|
||||||
|
def sources = subprojects.collect { proj ->
|
||||||
|
variants.collect { variant ->
|
||||||
|
["${proj.projectDir}/src/main/java", "${proj.projectDir}/src/main/kotlin",
|
||||||
|
"${proj.projectDir}/src/$variant/java", "${proj.projectDir}/src/$variant/kotlin"]
|
||||||
|
}.flatten()
|
||||||
|
}.flatten()
|
||||||
|
sourceDirectories.from = files(sources)
|
||||||
|
|
||||||
|
def executions = subprojects.collect { proj ->
|
||||||
|
variants.collect { variant ->
|
||||||
|
def path = "${proj.buildDir}/jacoco/test${variant.capitalize()}UnitTest.exec"
|
||||||
|
printf('Collecting execution data from: %s\n', path)
|
||||||
|
if ((new File(path)).exists()) path else null
|
||||||
|
}
|
||||||
|
}.flatten()
|
||||||
|
executions.removeAll([null])
|
||||||
|
|
||||||
|
executionData.from = files(executions)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue