-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
executable file
·173 lines (138 loc) · 5.15 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
buildscript {
ext { springBootVersion = '1.4.2.RELEASE' }
repositories {
jcenter()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.17')
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
group = 'io.swagger'
project.version = '1.0.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
//configurations { codacy }
springBoot { buildInfo() }
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
dependencies {
compile('io.swagger:swagger-inflector:1.0.10')
compile('com.github.javafaker:javafaker:0.11') { exclude group: 'com.github.bmoliveira' }
compile('com.fasterxml.jackson.core:jackson-annotations')
compile('com.fasterxml.jackson.core:jackson-databind')
compile('com.fasterxml.jackson.datatype:jackson-datatype-jdk8')
compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-jersey')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-jdbc')
compile ('org.springframework.ws:spring-ws-core')
compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile group: 'info.cukes', name: 'cucumber-junit', version:'1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-spring', version:'1.2.5'
testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'
testCompile('com.h2database:h2')
//codacy group: 'com.codacy', name: 'codacy-coverage-reporter', version: '2.0.1'
//codacy group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
//codacy group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
}
// when building on CI Circle, we want to download the deps and then cache them for use next time
// the following code creates tasks that will just download the deps.
configurations.findAll().each { config ->
task "downloadDependencies${config.name}"(type: Exec, group: 'build', description: "download deps for ${config.name}") {
// println "${config}:"
// config.allArtifacts.getFiles().each { file -> println " " + file}
// config.files().each { file -> println " " + file}
// println ' '
config.files
commandLine 'echo', "Downloaded all dependencies for ${config.name}"
}
}
task "downloadDependencies"(type: Exec, group: 'build', description: "download all deps") { commandLine 'echo', "Downloaded all dependencies" }
downloadDependencies.dependsOn {
tasks.findAll { task ->
task.name.startsWith('downloadDependencies') && task.name != "downloadDependencies"
}
}
def testClasses = fileTree("src/test/java") {
include '**/*Tests*.java'
exclude '**/*Wip.java'
}
testClasses.each { File testClass ->
def baseName = testClass.name.replace('.java', '')
task "test${baseName}"(type: Test, group: 'verification', description: "run ${baseName}") {
testClassesDir = sourceSets.test.output.classesDir
classpath = sourceSets.test.runtimeClasspath
include "**/${baseName}.class"
ext.outputDir = "${buildDir}/test-results/test${baseName}"
outputs.dir file(outputDir)
ext.coverageDir = "${buildDir}/jacoco"
outputs.dir file(coverageDir)
systemProperty 'cucumber.options', "--plugin json:${outputDir}/cucumber.json --plugin html:${outputDir}/html --plugin junit:${outputDir}/TEST-cucumber.xml"
systemProperty 'jacoco.destinationFile', "${coverageDir}/${baseName}.exec"
jacoco {
append = false
destinationFile = file("${coverageDir}/${baseName}.exec")
}
ignoreFailures = false
}
}
test {
exclude '**'
testLogging.showStandardStreams = true
ignoreFailures = false
}
test.finalizedBy jacocoTestReport
test.dependsOn {
tasks.findAll { task ->
task.name.startsWith('test') && task.name != "test" }
}
jacoco { toolVersion = "0.7.7.201606060606" }
jacocoTestReport {
executionData = fileTree(dir: "${buildDir}", include: 'jacoco/*.exec')
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
}
test.finalizedBy jacocoTestReport
//task uploadCoverageToCodacy(type: JavaExec, dependsOn : jacocoTestReport, group:"verification") {
// main = "com.codacy.CodacyCoverageReporter"
// def token = project.getProperties().get("CODACY_PROJECT_TOKEN") ?: "NOT SET"
// classpath = configurations.codacy
// args = [
// "-l",
// "Java",
// "-r",
// "${buildDir}/reports/jacoco/test/jacocoTestReport.xml",
// "--projectToken",
// "${token}"
// ]
//}