gpt4 book ai didi

android - FileNotFound Jacoco/Gradle

转载 作者:行者123 更新时间:2023-12-03 06:15:40 24 4
gpt4 key购买 nike

我有以下设置:

apply plugin: 'jacoco'

jacoco {
toolVersion = "0.7.1.201405082137"
}

def coverageSourceDirs = [
'../app/src/main/java'
]

和以下任务:
task jacocoTestReport(type:JacocoReport, dependsOn: "assembleStagingDebugAndroidTest") {
group = "Reporting"

onlyIf = {
true
}
description = "Generate Jacoco coverage reports for staging debug"
classDirectories = fileTree(
dir: '../app/build/intermediates/classes/staging/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$MembersInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)

additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files('../app/build/jacoco/testDebug.exc')

reports {
xml.enabled = true
html.enabled = true
}
}

但是执行时:
gradle jacocoTestReport --stacktrace --debug --info

我不断得到:
app/build/jacoco/testDebug.exc (No such file or directory)

但:
clean createStagingDebugCoverageReport --stacktrace

效果很好。我正在尝试使用自定义任务来从覆盖率报告中忽略一些不需要的类。对于不生成exec文件,我该怎么做/如何找到它们在程序包中的位置?我浏览了构建目录文件夹,但没有找到它们。

提前致谢!

最佳答案

因此,这是一个.ec文件,填充在/ build / outputs / code-coverage / connected / flavors / staging /中,我不得不调整测试以查看'../app/build/intermediates/coverage-instrumented-classs/ classes / staging / debug”以生成报告,但是我终于可以使用它了……现在我必须继续排除我不想要的类。

task jacocoStagingDebugTestReport(type:JacocoReport, dependsOn: ["spoonStagingDebugAndroidTest"]) {
group = "Reporting"

onlyIf = {
true
}
description = "Generate Jacoco coverage reports for staging debug"
classDirectories = fileTree(
dir: '../app/build/intermediates/coverage-instrumented-classes/classes/staging/debug',
excludes: ['/ollie/*$ModelAdapter.*']
)

additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files('build/outputs/code-coverage/connected/flavors/staging/coverage.ec')

reports {
xml.enabled = true
html.enabled = true
}
}

关于android - FileNotFound Jacoco/Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31002340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com