Mercurial > public > develkit
changeset 232:47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
author | smith@nwoca.org |
---|---|
date | Tue, 18 Oct 2016 18:29:04 +0100 |
parents | ce34e62224cf |
children | 400f9d8bbf5b |
files | init20.gradle metrics.gradle |
diffstat | 2 files changed, 47 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/init20.gradle Thu Sep 08 17:10:43 2016 +0100 +++ b/init20.gradle Tue Oct 18 18:29:04 2016 +0100 @@ -233,7 +233,10 @@ globalLockFile = gradle.branch.isRelease() ? 'release.lock' : 'global.lock' includeTransitives = true } - + configurations.all { + resolutionStrategy.cacheChangingModulesFor gradle.cacheTimeout, 'seconds' + resolutionStrategy.cacheDynamicVersionsFor gradle.cacheTimeout, 'seconds' + } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> if (details.requested.group == 'org.ssdt_ohio' && !details.requested.version ) { @@ -480,10 +483,6 @@ } } - configurations.all { - resolutionStrategy.cacheChangingModulesFor gradle.cacheTimeout, 'seconds' - resolutionStrategy.cacheDynamicVersionsFor gradle.cacheTimeout, 'seconds' - } repositories { if (!gradle.bambooBuild) {
--- a/metrics.gradle Thu Sep 08 17:10:43 2016 +0100 +++ b/metrics.gradle Tue Oct 18 18:29:04 2016 +0100 @@ -1,5 +1,12 @@ -apply plugin: "sonar-runner" -ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") +final GradleVersion gradleCurrent = GradleVersion.current() +final GradleVersion gradleV31 = GradleVersion.version('3.1') + +final boolean legacySonar = gradleCurrent < gradleV31 + +if (legacySonar) { + apply plugin: "sonar-runner" + ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") +} buildscript { repositories { @@ -19,34 +26,45 @@ packageFilter += 'groovyx.*' } -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}" - } +if (!legacySonar) { + + task('sonar') << { + println "sonar analysis currently disabled" + } + } -subprojects { - afterEvaluate { project -> +if (legacySonar) { - def groovyProject = project.plugins.hasPlugin('groovy') - sonarRunner { - sonarProperties { - property "sonar.language", groovyProject ? 'grvy' : 'java' - property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" - property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" + 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}" + } + } + + subprojects { + afterEvaluate { project -> + + def groovyProject = project.plugins.hasPlugin('groovy') + sonarRunner { + sonarProperties { + property "sonar.language", groovyProject ? 'grvy' : 'java' + 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' } - } + allprojects { + afterEvaluate { project -> + project.getTasksByName('sonarRunner',false).each { it.enabled = gradle.branchStream == 'develop' } + } + } } \ No newline at end of file