Mercurial > public > develkit
diff metrics.gradle @ 214:0ca4f3c952b7
DEP-11: add depency-lock plugin and a resolver to supply dynamic version based on branch. Cleanup metrics includes
author | smith@nwoca.org |
---|---|
date | Mon, 27 Jun 2016 19:50:00 +0100 |
parents | 45d2396e9fc8 |
children | 47535c8358ce |
line wrap: on
line diff
--- a/metrics.gradle Thu Apr 28 19:27:29 2016 +0100 +++ b/metrics.gradle Mon Jun 27 19:50:00 2016 +0100 @@ -1,13 +1,6 @@ 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()) -} - -println "metrics: coverage enabled: ${gradle.environment.coverage}" buildscript { repositories { maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } @@ -18,7 +11,6 @@ } } - apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin jaranalyzer { @@ -27,7 +19,6 @@ packageFilter += 'groovyx.*' } - sonarRunner { sonarProperties { property "sonar.host.url", "http://sonar.ssdt-ohio.org/" @@ -40,121 +31,22 @@ } } -if (gradle.environment.coverage) { - - configurations { - jacocoAntRoot - } - dependencies { - jacocoAntRoot 'org.jacoco:org.jacoco.ant:0.6.2.201302030002' - } - - task fullCoverageReport << { - ant { - taskdef(name: 'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: configurations.jacocoAntRoot.asPath) - - mkdir dir: "${buildDir.path}/reports/coverage" - - jacocoreport { - executiondata { - fileset(dir: "${buildDir.path}/coverage-results") { - include name: '*.jacoco.exec' - } - } - - structure(name: project.name) { - - classfiles { - subprojects.each { project -> - fileset dir: project.sourceSets.main.output.classesDir - } - } - sourcefiles(encoding: 'CP1252') { - subprojects.each { project -> - project.sourceSets.main.allGroovy.srcDirs.findAll { file(it).exists() } each { - fileset dir: "$it" - } - } - } - } - - xml destfile: "${buildDir.path}/reports/coverage/jacoco.xml" - html destdir: "${buildDir.path}/reports/coverage" - } - } - } - - fullCoverageReport.dependsOn { - subprojects.collect { project -> - project.copyCoverageData.path - } - } - -} - 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 - } - - task copyCoverageData(dependsOn: test, type: Copy) { - from project.test.jacoco.destPath - into "${rootProject.buildDir.path}/coverage-results" - include 'test.exec' - rename 'test.exec', "${project.name}.jacoco.exec" - } - - } - sonarRunner { sonarProperties { property "sonar.language", groovyProject ? 'grvy' : 'java' - if (gradle.environment.coverage) { - 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}" } } - } } - - allprojects { afterEvaluate { project -> project.getTasksByName('sonarRunner',false).each { it.enabled = gradle.branchStream == 'develop' } - } + } } \ No newline at end of file