From 01230c76ef0a4951889b1f0a4988b27cfc08c0ca Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Mon, 15 Jul 2013 11:00:01 -0500 Subject: [PATCH] SEC-2217: Sonar Runner --- build.gradle | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 5129726dd2..2defdc27a9 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,7 @@ buildscript { } } +apply plugin: 'sonar-runner' apply plugin: 'base' description = 'Spring Security' @@ -20,11 +21,24 @@ allprojects { group = 'org.springframework.security' repositories { - maven { url "http://repo.springsource.org/libs-snapshot" } maven { url "http://repo.springsource.org/plugins-release" } } } +sonarRunner { + sonarProperties { + property "sonar.java.coveragePlugin", "jacoco" + property "sonar.projectName", "Spring Security" + property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec" + property "sonar.links.homepage", 'https://www.springsource.org/spring-security' + property "sonar.links.ci", 'https://build.springsource.org/browse/SEC-B32X' + property "sonar.links.issue", 'https://jira.springsource.org/browse/SEC' + property "sonar.links.scm", 'https://github.com/SpringSource/spring-security' + property "sonar.links.scm_dev", 'https://github.com/SpringSource/spring-security.git' + property "sonar.java.coveragePlugin", "jacoco" + } +} + // Set up different subproject lists for individual configuration ext.javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'faq' && project.name != 'manual' } ext.sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') } @@ -34,6 +48,9 @@ ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-sec configure(subprojects - coreModuleProjects) { tasks.findByPath("artifactoryPublish")?.enabled = false + sonarRunner { + skipProject = true + } } configure(javaProjects) { @@ -42,8 +59,6 @@ configure(javaProjects) { } configure(coreModuleProjects) { - // Gives better names in structure101 jar diagram - sourceSets.main.output.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-security".length() + 1)) apply plugin: 'bundlor' apply from: "$rootDir/gradle/maven-deployment.gradle" apply plugin: 'emma' @@ -52,8 +67,18 @@ configure(coreModuleProjects) { def templateText = file("template.mf").text bundlor.manifestTemplate = new SimpleTemplateEngine().createTemplate(templateText).make(bundlorProperties).toString() } - - bundlor.dependsOn 'compileJava' + configurations { + jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo + } + dependencies { + jacoco "org.jacoco:org.jacoco.agent:0.6.2.201302030002:runtime" + } + test { + jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*" + } + integrationTest { + jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*" + } } configure (aspectjProjects) {