Mercurial > public > develkit
view metrics.gradle @ 131:ca34c067b178
CM-133: make coverage analysis controllable by property
author | smith@nwoca.org |
---|---|
date | Wed, 05 Jun 2013 22:45:58 +0100 |
parents | 253374129034 |
children | 8a7c3673dee9 |
line wrap: on
line source
apply plugin: "sonar-runner" ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") if (!gradle.environment.containsKey('coverage')) { gradle.environment.put('coverage', false) } else { gradle.environment.put('coverage', gradle.environment.coverage.toBoolean()) } buildscript { repositories { maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' } maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' } } } sonarRunner { sonarProperties { property "sonar.host.url", "http://sonar.ssdt-ohio.org/" property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] property "sonar.jdbc.password", ant.properties['sonar.jdbc.password'] property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" } } //gradle.rootProject.afterEvaluate { project -> // // project.jacocoTestReport { // // // } // //} subprojects { afterEvaluate { project -> def groovyProject = project.plugins.hasPlugin('groovy') def javaProject = project.plugins.hasPlugin('java') if (gradle.environment.coverage && groovyProject) { logger.info "coverage analysis enabled" project.apply plugin: 'jacoco' project.jacoco { toolVersion = "0.6.3.201306030806" } project.test { jacoco { enabled = true } } project.jacocoTestReport { if (groovyProject) { sourceDirectories = files(sourceSets.main.allGroovy.srcDirs) classDirectories = files(project.sourceSets.main.output.classesDir) } reports { xml.enabled true csv.enabled false html.enabled true } } task coverageReport { dependsOn jacocoTestReport } } sonarRunner { sonarProperties { property "sonar.language", groovyProject ? 'grvy' : 'java' property "sonar.java.coveragePlugin", "jacoco" property "sonar.jacoco.reportPath", project.test.jacoco.destPath property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" } } } }