Mercurial > public > develkit
view metrics.gradle @ 251:969e33b82a99
USASR-2891: Change version of sonar gradle plugin to 2.6 when using Gradle version >= 4.2.1
author | Christopher Springer <springer@nwoca.org> |
---|---|
date | Sat, 11 Nov 2017 02:38:26 +0000 |
parents | c8c8766492c5 |
children | 46064f36ae31 |
line wrap: on
line source
final GradleVersion gradleCurrent = GradleVersion.current() final GradleVersion gradleV31 = GradleVersion.version('3.1') final boolean legacySonar = gradleCurrent < gradleV31 final boolean newSonar = !legacySonar buildscript { final GradleVersion gradleV421 = GradleVersion.version('4.2.1') repositories { maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } } dependencies { classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT' classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${GradleVersion.current() >= gradleV421 ? '2.6' : '2.2'}" } } apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin jaranalyzer { dot = true packageFilter += 'org.slf4j*' packageFilter += 'groovyx.*' } if (newSonar) { apply plugin: org.sonarqube.gradle.SonarQubePlugin sonarqube { properties { property "sonar.host.url", "http://sonar.ssdt.io:9000" property "sonar.login", System.getenv('bamboo_SONAR_TOKEN') property "sonar.exclusions","**/ProjectVersion*" } } allprojects { afterEvaluate { project -> project.getTasksByName('sonarqube',false).each { it.enabled = gradle.branchStream in ['develop','release','hotfix' ] } } } } if (legacySonar) { task('sonar') << { println "legacy sonar disabled" } }