-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
248 lines (213 loc) · 7.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
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
buildscript {
repositories {
mavenCentral()
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.+')
}
}
dependencies {
classpath "org.owasp:dependency-check-gradle:3.1.2"
}
}
plugins {
id 'org.asciidoctor.jvm.convert' version '4.0.2'
id 'org.asciidoctor.jvm.pdf' version '4.0.2'
id "org.kordamp.gradle.livereload" version "0.4.0"
id 'com.gorylenko.gradle-git-properties' version '2.3.2'
id 'org.springframework.boot' version '2.5.15'
id "org.sonarqube" version "2.8"
id 'groovy'
}
apply plugin: 'groovy'
apply plugin: 'application'
apply plugin: 'codenarc'
apply plugin: 'idea'
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'io.spring.dependency-management'
sonarqube {
properties {
property "sonar.projectKey", "gclayburg_memuser"
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
repositories {
maven {
url "${artifactory_contexturl}/${artifactory_resolve_repo}"
allowInsecureProtocol = true
}
mavenCentral()
}
configurations {
compile.exclude module: "spring-boot-starter-tomcat"
asciidoctorExtensions.extendsFrom runtimeClasspath
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 4, 'minutes' // I want to make sure to try to download the latest snapshot
}
ext {
snippetsDir = file('build/generated-snippets')
}
ext['springRestDocsVersion'] = '2.0.7.RELEASE'
dependencies {
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
asciidoctorExtensions 'io.spring.asciidoctor:spring-asciidoctor-extensions-spring-boot:0.6.3'
asciidoctorExtensions 'io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch:0.6.3'
asciidoctorExtensions(files(tasks.compileJava.outputs.files))
implementation group: 'com.unboundid.product.scim2', name: 'scim2-sdk-client', version:'2.4.0'
implementation group: 'com.unboundid.product.scim2', name: 'scim2-sdk-server', version:'2.4.0'
implementation group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.0.1'
implementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version:'2.41'
implementation group: 'org.glassfish.jersey.core', name: 'jersey-common', version:'2.41'
implementation group: 'com.garyclayburg', name:'upbanner-starter', version: '3.0.0'
implementation group: 'com.github.oshi', name: 'oshi-core', version: '5.6.0'
implementation group: 'net.java.dev.jna', name:'jna', version:'5.7.0'
implementation group: 'net.java.dev.jna', name:'jna-platform', version: '5.7.0'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'org.codehaus.groovy:groovy-all:3.0.19'
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude(module: 'spring-boot-starter-tomcat',group: 'org.springframework.boot')
}
implementation "org.springframework.boot:spring-boot-starter-undertow"
implementation('org.springframework.boot:spring-boot-starter-actuator') {
}
implementation('org.springframework.boot:spring-boot-starter-security')
implementation 'org.springframework.data:spring-data-commons'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation platform("org.spockframework:spock-bom:2.0-groovy-3.0")
testImplementation group: 'org.spockframework', name: 'spock-spring', version: '2.0-groovy-3.0'
testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.0-groovy-3.0'
testImplementation 'org.spockframework:spock-junit4'
testImplementation 'junit:junit:4.13.1'
testImplementation 'com.jayway.jsonpath:json-path-assert:0.8.1'
testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc:${springRestDocsVersion}"
annotationProcessor group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
// compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
}
test {
outputs.dir snippetsDir
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
apply from: 'gradle/docker.gradle'
processResources {
inputs.property 'version', version //because ${version} is used as filter in application.properties
filesMatching("**/*.properties") {
expand(project.properties)
}
}
gitProperties {
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "America/Denver"
}
asciidoctor {
dependsOn test
configurations 'asciidoctorExtensions'
sourceDir file('src/main/asciidoc')
outputDir file('build/asciidoc')
inputs.dir snippetsDir
attributes 'source-highlighter': 'prettify',
'imagesdir': 'images',
'toc': 'left',
'icons': 'font',
'setanchors': 'true',
'idprefix': '',
'idseparator': '-',
'docinfo1': 'true',
'snippets': snippetsDir
}
/*
asciidoctorPdf no longer works if index.adoc uses spring rest docs configprops like this:
[source,properties,configprops]
*/
//asciidoctorPdf {
// dependsOn test
// configurations 'asciidoctorExtensions'
// sourceDir file('src/main/asciidoc')
// outputDir file('build/asciidoc')
// inputs.dir snippetsDir
//}
liveReload {
description = 'run in a terminal window, view docs in browser http://localhost:35729/index.html'
println "liveReload on path: $asciidoctor.outputDir.canonicalPath"
docRoot asciidoctor.outputDir.canonicalPath
dependsOn asciidoctor
}
task cleanTempDir(type: Delete) {
delete fileTree(dir: 'src/main/resources/public')
}
clean {
dependsOn cleanTempDir
}
build {
dependsOn asciidoctor
}
/*
springBoot {
buildInfo {
additionalProperties = bootmap
}
}
*/
bootJar {
dependsOn 'asciidoctor'
from ("${asciidoctor.outputDir}/") {
// http://localhost:8080/docs/index.html
into 'static/docs'
}
from ("src/main/html") {
// http://localhost:8080/index.html
into 'static/'
}
}
/*
java -jar build/libs/memuser-0.5.0.jar
This is similar to bootRun, except that we are executing the jar file instead of the exploded build dir.
This allows us to include static files like /docs/index.html
*/
task bootJarRun(type: JavaExec) {
description 'Run the project from generated spring boot jar'
group 'application'
dependsOn bootJar
main = "-jar"
args bootJar.outputs.getFiles().getSingleFile()
}
codenarcMain {
ignoreFailures true
configFile file('gradle/codenarc/codenarc.groovy')
}
codenarcTest {
ignoreFailures true
configFile file('gradle/codenarc/codenarcTest.groovy')
}
task publish(type: GradleBuild) {
description "publish generated documentation to github pages"
dependsOn asciidoctor
buildFile = file('publish.gradle')
tasks = ['gitPublishPush']
}
/*
gradle continuous build in one terminal:
$ cd dev/memuser
$ ./gradlew --no-daemon -Pbuilddate=unchangeddate asciidoctor -t
enable livereload in another terminal:
$ cd dev/memuser
$ ./gradlew liveReload
in the browser open url http://localhost:35729/index.html
-enable livereload browser plugin
- now save the *.adoc file and the browser will update automatically as soon as compilation is finished. no need to
hit refresh in the browser
The created html can also be located in the build without using liveReload:
file:///home/gclaybur/dev/memuser/build/asciidoc/index.html
when running from spring boot jar or docker, content available at:
http://localhost:8080/docs/index.html
to view version published on github:
https://gclayburg.github.io/memuser/index.html
*/