forked from springfox/springfox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds gradle support - checkstyle, jacoco code coverage, maven publishig.
Adds checkstyle code quality checks Adds jacoco test coverage plugin Adds publishing (artifactory) Fails build on jacoco coverage failures Ignoring more idea files
- Loading branch information
Showing
28 changed files
with
532 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/misc.xml | ||
.idea/libraries/ | ||
*.iml | ||
swagger-springmvc.iml | ||
target | ||
.settings | ||
.classpath | ||
.project | ||
.DS_Store | ||
build/ | ||
.gradle/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
apply from: "$rootDir/gradle/dependencies.gradle" | ||
|
||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath "com.github.adrianbk:gradle-jvmsrc-plugin:0.6.1" | ||
} | ||
} | ||
|
||
subprojects { | ||
apply plugin: 'groovy' | ||
sourceCompatibility = 1.6 | ||
targetCompatibility = 1.6 | ||
|
||
group = 'com.mangofactory' | ||
version = '0.7.77' | ||
|
||
apply plugin: 'com.github.adrianbk.jvmsrc' | ||
jvmsrc { | ||
packageName "${group}.swagger" | ||
} | ||
|
||
|
||
apply plugin: 'checkstyle' | ||
checkstyle{ | ||
configFile = file("$rootDir/config/checkstyle.xml") | ||
} | ||
|
||
apply plugin: 'maven-publish' | ||
apply from: "$rootDir/gradle/publishing.gradle" | ||
|
||
apply from: "$rootDir/gradle/coverage.gradle" | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
} | ||
} | ||
|
||
task wrapper(type: Wrapper) { | ||
gradleVersion = '2.0' | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
apply plugin: 'jacoco' | ||
|
||
ext { | ||
minCoverage = 80 | ||
} | ||
|
||
jacocoTestReport { | ||
reports { | ||
xml.enabled true | ||
} | ||
|
||
doLast { | ||
def report = file("${jacoco.reportsDir}/test/jacocoTestReport.xml") | ||
logger.lifecycle("Checking coverage results: ${report}") | ||
|
||
def parser = new XmlParser() | ||
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); | ||
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false) | ||
def results = parser.parse(report) | ||
|
||
def percentage = { | ||
def covered = it.'@covered' as Double | ||
def missed = it.'@missed' as Double | ||
((covered / (covered + missed)) * 100).round(2) | ||
} | ||
|
||
def counters = results.counter | ||
def metrics = [:] | ||
metrics << ['instruction': percentage(counters.find { it.'@type'.equals('INSTRUCTION') })] | ||
metrics << ['branch': percentage(counters.find { it.'@type'.equals('BRANCH') })] | ||
metrics << ['line': percentage(counters.find { it.'@type'.equals('LINE') })] | ||
metrics << ['complexity': percentage(counters.find { it.'@type'.equals('COMPLEXITY') })] | ||
metrics << ['method': percentage(counters.find { it.'@type'.equals('METHOD') })] | ||
metrics << ['class': percentage(counters.find { it.'@type'.equals('CLASS') })] | ||
|
||
|
||
def failures = [] | ||
metrics.each { | ||
if (it.value < minCoverage) { | ||
failures.add("- ${it.key} coverage rate is: ${it.value}%, minimum is ${minCoverage}%") | ||
} | ||
} | ||
|
||
|
||
if (failures) { | ||
logger.quiet("------------------ Code Coverage Failed -----------------------") | ||
failures.each { | ||
logger.quiet(it) | ||
} | ||
logger.quiet("---------------------------------------------------------------") | ||
throw new GradleException("Code coverage failed") | ||
} | ||
} | ||
} | ||
check.dependsOn jacocoTestReport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
ext { | ||
swaggerCore = "1.3.5" | ||
spring = "3.2.7.RELEASE" | ||
scalaLib = "2.10.0" | ||
groovy = "2.3.6" | ||
spock = "0.7-groovy-2.0" | ||
jackson = "2.2.3" | ||
guava = "15.0" | ||
springHateoas = "0.10.0.RELEASE" | ||
slf4j = "1.7.5" | ||
mockito = "1.9.5" | ||
servlet = "2.5" | ||
guava = "15.0" | ||
classmate = "1.0.0" | ||
} | ||
|
||
|
||
ext.libs = [ | ||
|
||
test : [ | ||
"org.springframework:spring-test:${spring}", | ||
"cglib:cglib-nodep:2.2", | ||
"org.objenesis:objenesis:1.2", | ||
"org.mockito:mockito-all:${mockito}", | ||
"com.jayway.jsonpath:json-path:0.8.1", | ||
"org.slf4j:slf4j-simple:1.7.5", | ||
"org.yaml:snakeyaml:1.9", | ||
"org.spockframework:spock-spring:${spock}", | ||
"org.spockframework:spock-core:${spock}" | ||
], | ||
|
||
swaggerCore : [ | ||
"com.wordnik:swagger-core_2.10:${swaggerCore}" | ||
], | ||
|
||
spring : [ | ||
"org.springframework:spring-web:$spring", | ||
"org.springframework:spring-webmvc:$spring" | ||
], | ||
|
||
clientProvided: [ | ||
"org.scala-lang:scala-library:${scalaLib}", | ||
"javax.servlet:servlet-api:${servlet}" | ||
], | ||
|
||
core : [ | ||
"org.codehaus.groovy:groovy-all:${groovy}", | ||
"com.google.guava:guava:${guava}", | ||
"com.fasterxml:classmate:1.0.0", | ||
"org.slf4j:slf4j-api:${slf4j}" | ||
] | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ext { | ||
artifactRepoBase = 'http://localhost:8081/artifactory' | ||
|
||
releaseRepos = { | ||
maven { | ||
name 'jcenter' | ||
// url "${artifactRepoBase}/oss-${project.version.endsWith('-SNAPSHOT') ? 'snapshot' : 'release'}-local" | ||
url "${artifactRepoBase}/libs-${project.version.endsWith('-SNAPSHOT') ? 'snapshot' : 'release'}-local" | ||
|
||
credentials { | ||
username = 'admin' | ||
// password = project.hasProperty('bintray_key') ? project.getProperty('bintray_key') : '' | ||
password = 'password' | ||
} | ||
} | ||
|
||
//TODO - deploy release versions on bintray | ||
// if (!project.version.endsWith('-SNAPSHOT')) { | ||
// maven { | ||
// name 'bintray' | ||
// url "https://api.bintray.com/maven/adrianbkelly/maven/${artifactLabel}" | ||
// credentials { | ||
// username = 'adrianbkelly' | ||
// password = project.hasProperty('bintray_key') ? project.getProperty('bintray_key') : '' | ||
// } | ||
// } | ||
// } | ||
} | ||
} | ||
|
||
task packageSources(type: Jar) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Wed Aug 06 20:10:22 EST 2014 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip |
Oops, something went wrong.