-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsonarqube.gradle
42 lines (36 loc) · 1.69 KB
/
sonarqube.gradle
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
apply plugin: 'org.sonarqube'
def getPropertiesConfig() {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
return properties
}
def propertiesConfig = getPropertiesConfig()
sonarqube {
properties {
boolean isLocal = propertiesConfig.getProperty("sonarqube_mode") == "local"
property "sonar.host.url", propertiesConfig.getProperty(
isLocal ? "sonarqube_local_url" : "sonarqube_online_url"
)
property "sonar.login", propertiesConfig.getProperty(
isLocal ? "sonarqube_local_login" : "sonarqube_online_login"
)
property "sonar.projectKey", propertiesConfig.getProperty("sonarqube_project_key")
property "sonar.projectName", propertiesConfig.getProperty("sonarqube_project_name")
property "sonar.projectVersion", "${android.defaultConfig.versionName}"
property "sonar.tests", "src/test/java"
property "sonar.test.inclusions", "**/*Test*/**"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.sources", "src/main/java"
property "sonar.exclusions", '**/*Test*/**,' +
'build/**' +
'*.json,' +
'**/*test*/**,' +
'**/.gradle/**,' +
'**/R.class'
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.junit.reportPaths", "**/test-results/**/*.xml"
property "sonar.coverage.jacoco.xmlReportPaths", "**/jacocoTestReport/jacocoTestReport.xml"
property "sonar.coverage.exclusions", "${coverageExclusions.join(', ')}"
}
}
tasks.sonarqube.dependsOn ":multichannel-widget:jacocoTestReport"