-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·200 lines (174 loc) · 6.67 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://repo.spring.io/libs-snapshot" }
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.4.RELEASE'
classpath 'com.ofg:uptodate-gradle-plugin:0.0.5'
classpath 'com.ofg:micro-deps-gradle-plugin:0.0.2'
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'
apply plugin: 'uptodate'
apply plugin: 'com.ofg.infrastructure.stubrunner'
ext {
versionPrefix = "CD"
buildNrLoc = project.hasProperty('buildNr') ? "${buildNr}" : "000"
currentVersion = "${versionPrefix}-${buildNrLoc}"
artifactGroupId = "pl.microhackaton"
serverPort = 8081
groovyVersion = '2.3.6'
spockVersion = '0.7-groovy-2.0'
springBootVersion = '1.1.4.RELEASE'
springVersion = '4.0.6.RELEASE'
jacksonMapper = '1.9.13'
aspectjVersion = '1.8.1'
microDepsSpringVersion = '0.2.0'
stubRepositoryUrl = 'http://nexus.microhackathon.pl/content/groups/public/'
zookeeperPort = 2181
zookeeperMockPort = 18081
}
uploadArchives {
repositories.mavenDeployer {
repository(url: "http://nexus.microhackathon.pl/content/repositories/releases/") {
authentication(userName: 'deployment', password: 'deployment123')
}
pom.version = currentVersion
pom.artifactId = project.name
pom.groupId = artifactGroupId
}
}
task deployToAws(dependsOn: uploadArchives) << {
String json = """{"artifactId": "${project.name}", "groupId": "$artifactGroupId","version": "$currentVersion",
"jvmParams": "-Dspring.profiles.active=prod -Dserver.port=$serverPort -Dservice.resolver.url=zookeeper.microhackathon.pl:2181"}"""
println "Sending the following json [$json]"
new groovyx.net.http.HTTPBuilder('http://54.73.40.79:18081/deploy').post([body: json, headers: ['Content-Type': 'application/json']])
}
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"
}
project.gradle.projectsEvaluated {
def activeProfile = project.gradle.startParameter.systemPropertiesArgs['spring.profiles.active']
if (activeProfile != null) {
applicationDefaultJvmArgs << "-Dspring.profiles.active=${project.gradle.startParameter.systemPropertiesArgs['spring.profiles.active']}"
}
}
run {
systemProperties = System.properties
}
//Workaround for the issue with Java 8u11 and 7u65 - http://www.infoq.com/news/2014/08/Java8-U11-Broke-Tools
test {
jvmArgs '-noverify'
}
applicationDefaultJvmArgs = [ "-noverify" ]
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'http://repository.codehaus.org' }
maven { url 'http://repo.spring.io/milestone' }
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-social-twitter:$springBootVersion"
compile "org.springframework:spring-context-support:$springVersion"
compile 'org.apache.httpcomponents:httpclient:4.3.4'
compile 'net.sf.ehcache:ehcache:2.8.3'
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
compile "org.codehaus.groovy:groovy-all:$groovyVersion:indy"
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1.3'
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonMapper"
compile "org.codehaus.jackson:jackson-core-asl:$jacksonMapper"
compile 'com.google.guava:guava:17.0'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'org.apache.tomcat.embed:tomcat-embed-el:8.0.9'
compile 'com.jayway.jsonpath:json-path-assert:0.9.1'
compile 'org.yaml:snakeyaml:1.13'
compile 'javax.validation:validation-api:1.1.0.Final'
compile 'org.hibernate:hibernate-validator:5.1.2.Final'
compile "org.aspectj:aspectjrt:$aspectjVersion"
compile 'org.apache.ivy:ivy:2.3.0'
compile "com.mangofactory:swagger-springmvc:0.8.4"
// microservices
compile("com.ofg:micro-deps-spring-config:$microDepsSpringVersion") {
exclude group: 'org.slf4j'
exclude group: 'log4j'
}
compile 'com.ofg:micro-infra-spring:0.0.3'
compile "cglib:cglib-nodep:3.1"
runtime "org.objenesis:objenesis:2.1" // allows mocking of classes without default constructor (together with CGLIB)
runtime 'org.aspectj:aspectjweaver:1.8.1'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'com.jayway.awaitility:awaitility:1.6.1'
testCompile("org.spockframework:spock-core:$spockVersion") {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testRuntime("org.spockframework:spock-spring:$spockVersion") {
exclude group: 'org.spockframework', module: 'spock-core'
}
testCompile "org.springframework:spring-test:$springVersion"
testCompile 'com.github.tomakehurst:wiremock:1.47'
testCompile "com.ofg:micro-deps-spring-test-config:$microDepsSpringVersion"
}
tasks.withType(GroovyCompile) {
groovyOptions.optimizationOptions.indy = true
}
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
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 {
ignoreFailures = true
jacoco {
excludes = ['*Configuration']
}
}
sonarRunner {
sonarProperties {
//TODO: fill this
property "sonar.host.url", ""
property "sonar.junit.reportsPath", "build/test-results"
}
}
}
stubRunner {
stubContainingRepositoryUrl = stubRepositoryUrl
}