diff --git a/PennMobile/build.gradle b/PennMobile/build.gradle index 185fe62f..77e70622 100644 --- a/PennMobile/build.gradle +++ b/PennMobile/build.gradle @@ -134,7 +134,7 @@ jacoco { } // https://stackoverflow.com/questions/68065743/cannot-run-gradle-test-tasks-because-of-java-lang-noclassdeffounderror-jdk-inte -tasks.withType(Test) { +tasks.withType(Test).configureEach { jacoco.includeNoLocationClasses = true jacoco.excludes = ['jdk.internal.*'] } @@ -144,7 +144,7 @@ def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*'] // Location of generated output classes -def debugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", +def debugTree = fileTree(dir: "$project.layout.buildDirectory/tmp/kotlin-classes/debug", excludes: fileFilter) // Source code directory @@ -152,7 +152,7 @@ def mainSrc = "$project.projectDir/src/main/java" // Task declaration -task jacocoTestReport(type: JacocoReport) { +tasks.register('jacocoTestReport', JacocoReport) { // Runs only after the dependencies are executed dependsOn = ['testDebugUnitTest', 'createDebugCoverageReport'] // Export formats @@ -165,7 +165,7 @@ task jacocoTestReport(type: JacocoReport) { classDirectories.setFrom(files([debugTree])) // Inform Gradle where the files generated by test cases - are located - executionData.from = fileTree(dir: project.buildDir, includes: [ + executionData.from = fileTree(dir: project.layout.buildDirectory, includes: [ 'jacoco/testDebugUnitTest.exec' // 'outputs/code_coverage/debugAndroidTest/connected/*.ec' ])