This repository has been archived by the owner on Oct 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
262 lines (227 loc) · 8.43 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
maven { url 'https://oss.sonatype.org/content/groups/public/' }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.2.RELEASE"
classpath 'com.ofg:uptodate-gradle-plugin:1.1.0'
classpath 'se.transmode.gradle:gradle-docker:1.2'
classpath "io.codearte.accurest:accurest-gradle-plugin:$accurestVersion"
if (project.hasProperty("coverage")) {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:1.0.2'
}
}
}
apply plugin: 'groovy'
apply plugin: 'spring-boot'
apply plugin: 'maven-publish'
apply plugin: 'com.ofg.uptodate'
apply plugin: 'docker'
apply plugin: 'accurest'
ext {
versionPrefix = "CD"
buildNrLoc = project.hasProperty('buildNr') ? "${buildNr}" : "000"
currentVersion = "${versionPrefix}-${buildNrLoc}"
projectGroupId = 'com.ofg'
contractsDir = file("${project.rootDir}/repository/mappings/com/ofg/twitter-places-analyzer")
wiremockStubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/")
wiremockStubsOutputDir = new File(wiremockStubsOutputDirRoot, 'mappings/')
//microInfraSpring and versions of other dependencies were moved to gradle.properties
}
group = projectGroupId
version = currentVersion
configurations {
all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
// To prevent an accidental usage of groovy-all.jar and groovy.jar in different versions
// all modularized Groovy jars are replaced with groovy-all.jar by default.
if (details.requested.group == 'org.codehaus.groovy' && details.requested.name != "groovy-all") {
details.useTarget("org.codehaus.groovy:groovy-all:${details.requested.version}")
}
}
}
}
}
project.gradle.projectsEvaluated {
applicationDefaultJvmArgs = project.gradle.startParameter.systemPropertiesArgs.entrySet().collect{"-D${it.key}=${it.value}"}
}
test {
jvmArgs project.gradle.startParameter.systemPropertiesArgs.entrySet().collect{"-D${it.key}=${it.value}"}
testLogging {
exceptionFormat = 'full'
}
exclude '**/*UISpec.*'
}
task guiTest(type: Test) {
jvmArgs project.gradle.startParameter.systemPropertiesArgs.entrySet().collect{"-D${it.key}=${it.value}"}
testLogging {
exceptionFormat = 'full'
}
include '**/*UISpec.*'
reports.html {
destination = file("${reporting.baseDir}/guiTests")
}
group = "Verification"
description = "Runs the acceptance GUI tests with Geb."
}
repositories {
mavenLocal()
jcenter()
maven {
url 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework:spring-context-support"
compile "org.codehaus.groovy:groovy-all"
compile 'com.fasterxml.jackson.core:jackson-databind'
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonMapper"
compile "org.codehaus.jackson:jackson-core-asl:$jacksonMapper"
compile 'com.google.guava:guava:18.0'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'org.apache.tomcat.embed:tomcat-embed-el'
compile 'com.jayway.jsonpath:json-path-assert:1.2.0'
compile 'org.yaml:snakeyaml'
compile 'org.hibernate:hibernate-validator'
compile "org.aspectj:aspectjrt"
compile 'org.codehaus.gpars:gpars:1.2.1'
compile 'net.sf.ehcache:ehcache:2.9.1'
compile "com.ofg:micro-infra-spring-boot-starter:$microInfraSpringVersion"
runtime 'cglib:cglib-nodep:3.1'
runtime 'org.objenesis:objenesis:2.1'
runtime 'org.aspectj:aspectjweaver'
runtime 'com.h2database:h2'
testCompile 'com.jayway.awaitility:awaitility:1.6.3'
testCompile('com.github.tomakehurst:wiremock:1.54') {
exclude group: 'org.mortbay.jetty', module: 'servlet-api'
}
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "com.ofg:micro-infra-spring-test:$microInfraSpringVersion"
testCompile "org.gebish:geb-core:$gebVersion"
testCompile "org.gebish:geb-spock:$gebVersion"
testCompile "org.spockframework:spock-spring"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion"
testCompile "com.jayway.restassured:rest-assured:$restAssuredVersion"
testCompile "com.jayway.restassured:spring-mock-mvc:$restAssuredVersion"
testCompile "io.codearte.accurest:accurest-core:$accurestVersion"
}
task docker(type: Docker) {
dependsOn 'build'
dryRun true
addFile("build/libs/${project.name}.jar", "/${project.name}/${project.name}.jar")
exposePort(8095)
entryPoint(['java', '-jar', "/${project.name}/${project.name}.jar"])
}
if (project.hasProperty("coverage")) {
apply plugin: 'codenarc'
apply plugin: 'jacoco'
apply plugin: 'sonar-runner'
apply plugin: 'com.github.kt3k.coveralls'
jacoco {
toolVersion = "0.7.0.201403182114"
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
codenarc {
configFile = file('config/codenarc/rules.groovy')
maxPriority1Violations = 0
maxPriority2Violations = 6
maxPriority3Violations = 10
reportFormat = 'xml'
ignoreFailures = true
}
dependencies {
codenarc 'org.codenarc:CodeNarc:0.21'
}
test {
jacoco {
excludes = ['*Configuration']
}
}
sonarRunner {
sonarProperties {
//TODO: fill this
property "sonar.host.url", ""
property "sonar.junit.reportsPath", "build/test-results"
}
}
}
accurest {
baseClassForTests = 'com.ofg.twitter.places.accurest.BaseMockMvcSpec'
basePackageForTests = 'accurest'
contractsDslDir = contractsDir
generatedTestSourcesDir = file("${project.buildDir}/generated-sources/accurest")
stubsOutputDir = wiremockStubsOutputDir
}
test.dependsOn { generateAccurest } //See: https://github.com/Codearte/accurest/issues/36
task addHashFile << {
String gitCmd = "git log --pretty=format:'%H' -n 1"
def proc = gitCmd.execute()
proc.waitFor()
new File("commitHash.txt").withWriter { it << proc.in.text }
}
jar {
dependsOn addHashFile
from "commitHash.txt"
}
task stubsJar(type: Jar, dependsOn: ["generateWiremockClientStubs", "addHashFile"]) {
baseName = "${project.name}-stubs"
from wiremockStubsOutputDirRoot
from "commitHash.txt"
}
bootRepackage {
withJarTask = "jar"
}
//Make sure that fat jar is built before uploading
project.tasks.findAll { it.name.startsWith('publish') || it.name == 'bintrayUpload' }*.dependsOn { bootRepackage }
artifacts {
archives stubsJar
}
publishing {
repositories {
maven {
url getProperty('mavenRepoUrl')
credentials {
username getProperty('mavenUser')
password getProperty('mavenPassword')
}
}
}
publications {
stubs(MavenPublication) {
artifactId "${project.name}-stubs"
artifact stubsJar
}
mavenJava(MavenPublication) {
from components.java
pom.withXml {
//Remove dependencies - everything is embedded in JAR created by Spring Boot
asNode().dependencies.replaceNode{ null }
}
}
}
}
task uploadArchives(dependsOn: 'publish') {
group "publishing"
description "DEPRECATED - Publishes produced archives - DEPRECATED - use 'publish' task"
doFirst {
logger.warn("DEPRECATION WARNING. Task 'uploadArchives' is deprecated. Use 'publish' task instead.")
}
}
wrapper {
gradleVersion '2.2.1'
}