Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10 from rtfpessoa/start-tracking-coverage
Browse files Browse the repository at this point in the history
Start tracking coverage using Codacy
  • Loading branch information
rtfpessoa authored Feb 19, 2017
2 parents 93fc19f + 10383bc commit 9fe9cb6
Showing 1 changed file with 85 additions and 31 deletions.
116 changes: 85 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/

buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.rodm:gradle-teamcity-plugin:0.9.1"
}
repositories {
maven { url 'https://plugins.gradle.org/m2' }
mavenCentral()
jcenter()
}
dependencies {
classpath "com.github.rodm:gradle-teamcity-plugin:0.9.1"
}
}


ext.teamcityVersion = hasProperty('teamcity.version') ? property('teamcity.version') : '10.0.2'

ext.teamcityDir = hasProperty('teamcity.dir') ? property('teamcity.dir') : "$rootDir/teamcity/app"
Expand All @@ -36,37 +35,92 @@ ext.awsSDKVersion = hasProperty('aws.sdk.version') ? property('aws.sdk.version')

ext.javaVersion = hasProperty('plugin.java.version') ? property('plugin.java.version') : '1.7'


apply plugin: 'idea'
idea {
project {
vcs = 'Git'
}
project {
vcs = 'Git'
}
}

subprojects {
group = 'jetbrains.buildServer.elasticbeanstalk'
group = 'jetbrains.buildServer.elasticbeanstalk'
}

configure(allprojects - project(':build')) {
apply plugin: 'jacoco'

repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://repo1.maven.org/maven2/" }
maven { url = 'http://repository.jetbrains.com/all' }
}

}

configure(subprojects - project(':build')) {
apply plugin: 'java'
// Only report code coverage for certain projects
def coveredProjects = (subprojects - project(':build'))

configure(coveredProjects) {
apply plugin: 'java'

sourceCompatibility = javaVersion
targetCompatibility = javaVersion

sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

test {
useTestNG()
testLogging.showStandardStreams = true
}
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")

test {
useTestNG()
testLogging.showStandardStreams = true
}
coveredProjects.each {
sourceSets it.sourceSets.main
}

reports {
xml.enabled true
xml.destination "${buildDir}/reports/jacoco/report.xml"
html.enabled false
csv.enabled false
}
}

codeCoverageReport.dependsOn {
coveredProjects*.test
}

configurations { codacy }

repositories {
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/typesafe/maven-releases" }
maven { url 'https://plugins.gradle.org/m2' }
mavenCentral()
jcenter()
}

dependencies {
codacy 'com.github.codacy:codacy-coverage-reporter:1.0.13'
}

repositories {
mavenCentral()
maven {
url = 'http://repository.jetbrains.com/all'
}
}
task codacy(type: JavaExec, dependsOn: codeCoverageReport) {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Codacy'
onlyIf { System.env.'CI' }
main = "com.codacy.CodacyCoverageReporter"
classpath = configurations.codacy
args = [
"-l",
"Java",
"-r",
"${buildDir}/reports/jacoco/report.xml"
]
}

0 comments on commit 9fe9cb6

Please sign in to comment.