# HG changeset patch # User smith@nwoca.org # Date 1467053400 -3600 # Node ID 0ca4f3c952b74d83a915b7b90180069946ed92e1 # Parent 40316e0cdef20b868fe7f22ede24727704996509 DEP-11: add depency-lock plugin and a resolver to supply dynamic version based on branch. Cleanup metrics includes diff -r 40316e0cdef2 -r 0ca4f3c952b7 init20.gradle --- a/init20.gradle Thu Apr 28 19:27:29 2016 +0100 +++ b/init20.gradle Mon Jun 27 19:50:00 2016 +0100 @@ -1,6 +1,17 @@ import groovy.sql.Sql import groovy.transform.ToString +buildscript { + repositories { + maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } + maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } + } + dependencies { + classpath 'postgresql:postgresql:9.1-901.jdbc4' + classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:4.3.0' + } +} + final GradleVersion gradleCurrent = GradleVersion.current() final GradleVersion gradleV20 = GradleVersion.version('2.0') println "Gradle Version: $gradleCurrent" @@ -62,11 +73,8 @@ gradle.ext.branchName = gradle.branch.name gradle.ext.branchStream = gradle.branch.stream gradle.ext.branchHash = gradle.branch.hash -println "${gradle.hgRepositoryUrl} ${gradle.branch}" +println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.imageId} ${gradle.branch.deployName}" println "$gradle.runtimeInfo" -println gradle.branch -println gradle.branch.imageId -println gradle.branch.deployName loadEnvironments() @@ -121,21 +129,10 @@ apply from: "${gradle.ssdtGradlekitLocation}/artifactory20.gradle" } - -buildscript { - repositories { - maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } - } - dependencies { - classpath 'postgresql:postgresql:9.1-901.jdbc4' - } -} - apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" rootProject.afterEvaluate { r -> - if (gradle.bambooBuild && r.hasProperty('requireJavaVersion')) { gradle.runtimeInfo.requireJava( r.getProperty('requireJavaVersion') ) } @@ -228,6 +225,19 @@ allprojects { + apply plugin: nebula.plugin.dependencylock.DependencyLockPlugin + + configurations.all { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if (details.requested.group == 'org.ssdt_ohio' && !details.requested.version ) { + details.useVersion( "latest.${gradle.branch.defaultDependencyStatus}" ) + } + if (details.requested.version == 'default') { + details.useVersion("latest.${gradle.branch.defaultDependencyStatus}" ) + } + } + } + task cleanLocal(description: "removes all artifacts from developer's local repository") << { def local = project.repositories.find { it.name == 'local' } @@ -336,7 +346,6 @@ Project root = gradle.getRootProject() root.allprojects { - def thisProject = delegate thisProject.status = 'integration' if (gradle.branchStream) { @@ -573,7 +582,6 @@ } - @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true) class BranchInfo { def name @@ -593,6 +601,10 @@ } + String getDefaultDependencyStatus() { + return stream in ['release','hotfix'] ? 'release' : 'integration' + } + def getShortName() { def result = name.contains('/') ? name.split('/')[1] : name } diff -r 40316e0cdef2 -r 0ca4f3c952b7 metrics.gradle --- 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