-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
225 lines (192 loc) · 6.36 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
buildscript {
ext {
asciiDocOutputDir = file("${buildDir}/asciidoc/generated")
swaggerOutputDir = file("${buildDir}/swagger")
snippetsOutputDir = file("${buildDir}/asciidoc/snippets")
springfoxVersion = '2.7.0'
swaggerAnnotationsVersion = '1.5.16'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("io.github.swagger2markup:swagger2markup-spring-restdocs-ext:1.2.0")
classpath("io.github.swagger2markup:swagger2markup-gradle-plugin:1.2.0")
classpath("org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.10.1")
}
}
// new plugins syntax
plugins {
// code
id "java"
// spring
id "io.spring.dependency-management" version "1.0.4.RELEASE"
id 'org.springframework.boot' version '1.5.18.RELEASE'
// code quality
id "jacoco"
id "org.owasp.dependencycheck" version "3.2.0"
// IDEs
id "eclipse"
id "idea"
// publishing
id "com.cinnober.gradle.semver-git" version "2.3.1"
id "maven-publish"
// documentation
id "org.asciidoctor.convert" version "1.5.3"
}
// documentation
apply plugin: 'io.github.swagger2markup'
sourceCompatibility = 1.8
targetCompatibility = 1.8
project.group = 'eu.h2020.symbiote'
// dependencies section
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
// Spring related configs
ext {
springCloudVersion = 'Edgware.SR5'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
/*
Forces dependencies' cache invalidation for each build for dependencies marked with
{ changing = true }
e.g.
compile('com.github.symbiote-h2020:SymbIoTeSecurity:develop-SNAPSHOT'){ changing = true }
*/
configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
exclude group: 'org.slf4j', module : "slf4j-log4j12"
}
dependencies {
/* SymbIoTeSecurity manual:
One can use the library from jitpack by default with the notation:
compile('com.github.symbiote-h2020:SymbIoTeSecurity:develop-SNAPSHOT') {changing = true }
or having cloned locally the SymbIoTeLibraries repo use it directly with project dependency by:
compile project(':SymbIoTeSecurity')
Important --- In order to use the latter you need to:
1) switch comments on the artifact and project dependencies
2) always have only one uncommented
3) project dependency requires changes in settings.gradle file in this project
4) never commit build.gradle which has project dependencies active as it will break CI builds
*/
compile('com.github.symbiote-h2020:SymbIoTeLibraries:[5.37, 5.999]'){ changing = true }
// Spring
compile('org.springframework.cloud:spring-cloud-starter')
compile('org.springframework.boot:spring-boot-starter-amqp')
compile('org.springframework.cloud:spring-cloud-starter-config')
compile('org.springframework.cloud:spring-cloud-starter-eureka')
compile('org.springframework.cloud:spring-cloud-starter-zipkin')
compile('org.springframework.retry:spring-retry')
compile('org.springframework.boot:spring-boot-starter-cache')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('org.springframework.boot:spring-boot-starter-web')
// JDK 9 runtime fixes
if(JavaVersion.current() == JavaVersion.VERSION_1_9){
runtime('javax.xml.bind:jaxb-api:+')
}
// Swagger annotations for documentation
compile("io.swagger:swagger-annotations:${swaggerAnnotationsVersion}")
// tests only
testCompile('junit:junit:[4.12, 4.999]')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('com.github.fakemongo:fongo:2.1.0')
testCompile("io.springfox:springfox-swagger2:${springfoxVersion}")
testCompile("io.springfox:springfox-bean-validators:${springfoxVersion}")
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
}
// publication
bootRepackage {
classifier = 'run'
}
// code quality below
task generateJavaDocs(type: Javadoc) {
source = sourceSets.main.allJava
destinationDir = reporting.file("javadocs")
}
task javadocJar(type: Jar, dependsOn: generateJavaDocs) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
version = project.version
from components.java
artifact sourceJar {
classifier "sources"
}
//artifact javadocJar
artifact(file("$libsDir/$project.name-$project.version-${bootRepackage.classifier}.jar")) {
classifier "run"
}
}
}
}
publishToMavenLocal.dependsOn(bootRepackage)
// code quality below
// jacoco configuration section
jacoco {
toolVersion = "0.7.9"
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
// owasp config
dependencyCheck {
outputDirectory = "build/reports/security"
}
// including code quality extensions into the build
check.dependsOn(jacocoTestReport)//,'dependencyCheckAnalyze')
test {
// we don't need that for testing,
exclude '**/Swagger*'
testLogging {
exceptionFormat = 'full'
}
}
// documentation below
task swaggerGeneratorTest(type: Test, dependsOn: testClasses) {
include '**/Swagger*'
systemProperty 'io.springfox.staticdocs.outputDir', swaggerOutputDir
systemProperty 'io.springfox.staticdocs.snippetsOutputDir', snippetsOutputDir
}
convertSwagger2markup {
dependsOn swaggerGeneratorTest
swaggerInput "${swaggerOutputDir}/swagger.json"
outputDir asciiDocOutputDir
config = [
'swagger2markup.pathsGroupedBy' : 'TAGS',
'swagger2markup.extensions.springRestDocs.snippetBaseUri': snippetsOutputDir.getAbsolutePath()]
}
asciidoctor {
dependsOn convertSwagger2markup
sources {
include 'index.adoc'
}
backends = ['html5', 'pdf']
attributes = [
doctype: 'book',
toc: 'left',
toclevels: '3',
numbered: '',
sectlinks: '',
sectanchors: '',
hardbreaks: '',
generated: asciiDocOutputDir
]
}