-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsonar-config.txt
50 lines (40 loc) · 1.9 KB
/
sonar-config.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
plugins {
id 'com.android.application'
id "org.sonarqube" version "5.1.0.4882"
id "jacoco"
}
apply plugin: "jacoco"
jacoco {
toolVersion = '0.8.12'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*'] // needed to support roboelectric with jacoco
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
reports {
xml.required = true
html.required = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*', 'hilt**', 'dagger']
def mainSrc = "$project.projectDir/src/main/java"
def javaTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter)
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([javaTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: ['jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec']))
}
sonar {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "isuc"
property "sonar.login", "120537998e2c122476f30cade8d4a25865210fa6"
property "sonar.projectKey", "Nombre-Proyecto" // cambiar a tu propio nombre
property "sonar.projectName", "Nombre-Proyecto" // cambiar a tu propio nombre
// I need this property to avoid the error where sonarqube does not close some files and
// prevents a clean afterwards
property "sonar.scm.disabled", true
// this property is deprecated, now I use the xml file defined below it
// property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/testDebugUnitTest.exec"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
}
}