From 244aa094efda7c8a09d295b8fbe3736bb9684bf7 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 11 Aug 2022 09:50:10 +0100 Subject: [PATCH] adding fragment testing dependency as a possible solution for missing jacoco agent on CI --- .github/workflows/tests.yml | 2 ++ build.gradle | 1 + coverage.gradle | 10 +++++----- vector-app/build.gradle | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2a89ed3040..81262f1e9f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,6 +49,7 @@ jobs: disable-animations: true emulator-build: 7425822 script: | + ./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES ./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES ./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES ./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES @@ -65,6 +66,7 @@ jobs: disable-animations: true emulator-build: 7425822 script: | + ./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES ./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES ./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES ./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES diff --git a/build.gradle b/build.gradle index 903d25e45a..64434ac697 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,7 @@ buildscript { classpath 'org.owasp:dependency-check-gradle:7.1.2' classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.7.10" classpath "org.jetbrains.kotlinx:kotlinx-knit:0.4.0" + classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/coverage.gradle b/coverage.gradle index d0a15f62d0..716f9b7cc7 100644 --- a/coverage.gradle +++ b/coverage.gradle @@ -28,8 +28,8 @@ def initializeReport(report, projects, classExcludes) { report.executionData { fileTree(rootProject.rootDir.absolutePath).include( - "**/build/**/*.exec", - "**/build/outputs/code_coverage/**/coverage.ec", + "**/build/**/*.exec", + "**/build/outputs/code_coverage/**/coverage.ec", ) } report.reports { @@ -74,18 +74,18 @@ def collectProjects(predicate) { task generateCoverageReport(type: JacocoReport) { outputs.upToDateWhen { false } rootProject.apply plugin: 'jacoco' - def projects = collectProjects { ['vector', 'matrix-sdk-android'].contains(it.name) } + def projects = collectProjects { ['vector-app', 'vector', 'matrix-sdk-android'].contains(it.name) } initializeReport(it, projects, excludes) } task unitTestsWithCoverage(type: GradleBuild) { // the 7.1.3 android gradle plugin has a bug where enableTestCoverage generates invalid coverage - startParameter.projectProperties.coverage = [enableTestCoverage: false] + startParameter.projectProperties.coverage = [enableTestCoverage: false] tasks = [':vector:testGplayDebugUnitTest', ':matrix-sdk-android:testDebugUnitTest'] } task instrumentationTestsWithCoverage(type: GradleBuild) { - startParameter.projectProperties.coverage = [enableTestCoverage: true] + startParameter.projectProperties.coverage = [enableTestCoverage: true] startParameter.projectProperties['android.testInstrumentationRunnerArguments.notPackage'] = 'im.vector.app.ui' tasks = [':vector-app:connectedGplayDebugAndroidTest', ':vector:connectedGplayDebugAndroidTest', 'matrix-sdk-android:connectedDebugAndroidTest'] } diff --git a/vector-app/build.gradle b/vector-app/build.gradle index 7cce15a85d..f752e0bb30 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -375,4 +375,5 @@ dependencies { androidTestUtil libs.androidx.orchestrator androidTestImplementation libs.androidx.fragmentTesting androidTestImplementation "org.jetbrains.kotlin:kotlin-reflect:1.7.10" + debugImplementation libs.androidx.fragmentTesting }