forked from 4finance/micro-infra-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
216 lines (177 loc) · 6.88 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
buildscript {
ext {
springBootVersion = "1.2.2.RELEASE"
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath 'com.ofg:uptodate-gradle-plugin:+'
classpath "com.ofg:micro-common-release:0.1.18"
classpath "io.spring.gradle:dependency-management-plugin:0.2.1.RELEASE"
if (project.hasProperty("coverage")) { classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:+' }
if (project.hasProperty("compatibility")) { classpath "be.insaneprogramming.gradle:animalsniffer-gradle-plugin:+" }
}
dependencies {
ant.unjar src: configurations.classpath.find { it.name.startsWith("micro-common-release") }, dest: 'build/release'
}
}
apply from: "${rootProject.buildDir}/release/gradle/version.gradle"
scmVersion {
tag { prefix = '' }
}
allprojects {
group = 'com.ofg'
project.version = scmVersion.version
}
Set emptySubprojects = [project(':swagger'), project(':micro-deps'), project(':stub-runner')]
Set srcSubprojects = subprojects - emptySubprojects
configure(srcSubprojects) {
apply plugin: 'groovy'
apply from: "${rootProject.buildDir}/release/gradle/publish.gradle"
bintray {
pkg {
repo = project.name.startsWith("micro-deps") ? 'micro-deps' : 'micro'
}
}
}
apply from: "${rootProject.buildDir}/release/gradle/release.gradle"
//NOTE: All release and publishing modifications (including further scmVersion closure) should be put AFTER the apply of publish.gradle and/or release.gradle
// (to be not overridden by the default values applied in those files)
allprojects {
repositories {
mavenLocal()
jcenter()
}
configurations {
all {
resolutionStrategy {
exclude group: 'log4j', module: 'log4j'
force 'org.apache.httpcomponents:httpclient:4.3.+'
force 'org.jboss.logging:jboss-logging:3.1.4.GA'
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.slf4j') { details.useVersion '1.7.10' }
if (details.requested.group == 'com.fasterxml.jackson.core') { details.useVersion "2.5.0" }
// 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}")
}
if (details.requested.group == 'org.springframework.boot') { details.useVersion springBootVersion }
if (details.requested.group == 'org.springframework') { details.useVersion "4.1.5.RELEASE" }
if (details.requested.group == 'org.aspectj') { details.useVersion "1.8.4" }
}
}
}
}
}
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 }
}
configure(emptySubprojects + rootProject) {
apply plugin: 'base'
}
configure(srcSubprojects) {
apply plugin: 'com.ofg.uptodate'
apply plugin: "io.spring.dependency-management"
sourceCompatibility = 1.7
dependencyManagement {
dependencies {
"org.codehaus.groovy:groovy-all" "2.4.1"
"com.google.guava:guava" "18.0"
"commons-io:commons-io" "2.4"
dependencySet(group:"org.apache.curator", version: "2.7.0") {
entry "curator-x-discovery"
entry "curator-test"
}
//test
"ch.qos.logback:logback-classic" "1.1.2"
"com.jayway.restassured:rest-assured" "2.4.0"
"com.github.tomakehurst:wiremock" "1.52"
"cglib:cglib-nodep" "3.1"
"org.objenesis:objenesis" "1.2"
dependencySet(group:'org.spockframework', version: '1.0-groovy-2.4') {
entry "spock-core"
entry "spock-spring"
}
dependencySet(group:'com.jayway.awaitility', version: '1.6.3') {
entry "awaitility"
entry "awaitility-groovy"
}
}
}
test {
jvmArgs project.gradle.startParameter.systemPropertiesArgs.entrySet().collect{"-D${it.key}=${it.value}"}
//Workaround for the issue with Java 8u11 and 7u65 - http://www.infoq.com/news/2014/08/Java8-U11-Broke-Tools
jvmArgs '-noverify'
testLogging {
exceptionFormat = 'full'
}
}
if (project.hasProperty("compatibility")) {
apply plugin: 'be.insaneprogramming.gradle.animalsniffer'
animalsniffer {
signature = "org.codehaus.mojo.signature:java17:+@signature"
}
afterEvaluate {
animalSniffer.mustRunAfter 'compileGroovy'
}
}
jar {
dependsOn addHashFile
from "commitHash.txt"
}
//Dependencies in all subprojects - http://solidsoft.wordpress.com/2014/11/13/gradle-tricks-display-dependencies-for-all-subprojects-in-multi-project-build/
task allDeps(type: DependencyReportTask) {}
task allInsight(type: DependencyInsightReportTask) {}
}
if (project.hasProperty("coverage")) {
configure(srcSubprojects + rootProject) {
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.7.1.201405082137'
}
}
configure(srcSubprojects) {
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
}
}
test {
jacoco {
excludes = ['*Configuration']
}
}
}
apply plugin: 'com.github.kt3k.coveralls'
coveralls {
sourceDirs = files(srcSubprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
}
task jacocoRootReport(type: JacocoReport) {
// Gather execution data from all subprojects
// (change this if you e.g. want to calculate unit test/integration test coverage separately)
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
// Add all relevant sourcesets from the subprojects
srcSubprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.enabled true
xml.destination "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
// always run the tests before generating the report
jacocoRootReport.dependsOn {
srcSubprojects*.test
srcSubprojects*.jacocoTestReport
}
}
wrapper {
gradleVersion '2.2.1'
}