我正在使用Jacoco插件生成测试覆盖率报告,并将其发布到SonarQube
我有2种产品口味,ProdOne
,ProdTwo
task jacocoTestReport(type: JacocoReport, dependsOn: ['testProdOneDebugUnitTest', 'createProdOneDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
def prodOneSrc = "$project.projectDir/src/prodone/java"
def prodTwoSrc = "$project.projectDir/src/prodtwo/java"
sourceDirectories = files([mainSrc], [prodOneSrc], [prodTwoSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testProdOneUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
}
在SonarQube块中,我有:
property "sonar.jacoco.reportPaths", "build/jacoco/testProdOneDebugUnitTest.exec"
我面临的问题是SonarQube上的报告只是一种味道,即“ ProdOne”。
我想同时包含两种风味的代码