diff 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 diff
--- a/metrics.gradle	Wed Jun 05 15:45:28 2013 +0100
+++ b/metrics.gradle	Wed Jun 05 22:45:58 2013 +0100
@@ -1,16 +1,18 @@
 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' }
     }
-    dependencies {
-        classpath "me.davesmith:gradle-cobertura-plugin:1.0.2.SNAPSHOT"
-        classpath "net.sourceforge.cobertura:cobertura:1.9.4.1"
-    }
 }
 
 sonarRunner {
@@ -25,18 +27,34 @@
     }
 }
 
+//gradle.rootProject.afterEvaluate { project ->
+//
+//    project.jacocoTestReport {
+//
+//
+//    }
+//
+//}
+
+
+
 subprojects {
     afterEvaluate { project ->
 
         def groovyProject = project.plugins.hasPlugin('groovy')
         def javaProject = project.plugins.hasPlugin('java')
 
-        if (groovyProject || javaProject) {
+        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 = false
+                    enabled = true
                 }
             }
             project.jacocoTestReport {