Created
January 19, 2016 12:01
-
-
Save vgaidarji/c49801f810541cb3d7dc to your computer and use it in GitHub Desktop.
sonar + jacoco
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext { | |
coverageSourceDirs = 'src/testDebug/java' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns Sonar property value from sonar.properties file | |
*/ | |
def getSonarProperty (String propertyName) { | |
Properties properties = new Properties() | |
properties.load(file("${project.rootDir}/config/sonar.properties").newDataInputStream()) | |
return properties.getProperty(propertyName) | |
} | |
sonarRunner { | |
sonarProperties { | |
property "sonar.host.url", getSonarProperty('sonar.host.url') | |
property "sonar.jdbc.url", getSonarProperty('sonar.jdbc.url') | |
property "sonar.jdbc.driverClassName", getSonarProperty('sonar.jdbc.driverClassName') | |
property "sonar.jdbc.username", getSonarProperty('sonar.jdbc.username') | |
property "sonar.jdbc.password", getSonarProperty('sonar.jdbc.password') | |
property "sonar.projectName", "PROJECT_NAME" | |
property "sonar.dynamicAnalysis", "reuseReports" | |
property "sonar.java.binaries", "$buildDir/intermediates/classes/flavorDebug/debug" | |
property "sonar.java.coveragePlugin", "jacoco" | |
property "jacoco.version" , "0.7.1.201405082137" | |
property "sonar.jacoco.reportPath", "$buildDir/jacoco/testFlavorDebugDebug.exec" | |
property "sonar.sources", android.sourceSets.main.java.srcDirs | |
property "sonar.tests", coverageSourceDirs | |
property "sonar.sourceEncoding", "UTF-8" | |
} | |
} | |
tasks.sonarRunner.dependsOn(jacocoTestReport) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment