-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
308 lines (253 loc) · 8.61 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/*******************************************************************************
* Copyright 2016 - 2018 Sparta Systems, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'jacoco'
id 'org.springframework.boot' version '1.5.9.RELEASE'
id "org.nosphere.apache.rat" version "0.3.0"
id "nebula.ospackage" version "3.6.1"
id "com.moowork.node" version "1.1.1"
id "com.github.jk1.dependency-license-report" version "0.4.1"
id "net.researchgate.release" version "2.5.0"
id "com.jfrog.bintray" version "1.7.3"
id "com.palantir.docker" version "0.17.2"
}
group = 'com.spartasystems.holdmail'
description = 'holdmail'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
def dockerName = System.getProperty("dockerName", "spartasystems-docker-containers.bintray.io/sparta/holdmail")
dependencies {
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.boot:spring-boot-starter-data-rest'
compile 'org.springframework.boot:spring-boot-starter-jdbc'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-devtools'
testCompile('org.springframework.boot:spring-boot-starter-test') {
exclude(module: 'commons-logging')
}
compile 'com.h2database:h2:1.4.196'
compile 'org.subethamail:subethasmtp:3.1.7'
compile 'org.apache.commons:commons-lang3:3.7'
compile 'commons-io:commons-io:2.6'
compile 'commons-codec:commons-codec:1.11'
compile 'org.apache.james:apache-mime4j:0.8.1'
compile 'org.flywaydb:flyway-core:5.0.3'
testCompile 'org.assertj:assertj-core:3.8.0'
testCompile 'org.powermock:powermock-module-junit4:1.7.3'
testCompile 'org.powermock:powermock-api-mockito:1.7.3'
testCompile 'nl.jqno.equalsverifier:equalsverifier:2.4'
testCompile 'io.rest-assured:rest-assured:3.0.6'
testCompile 'io.rest-assured:spring-mock-mvc:3.0.6'
testCompile 'io.rest-assured:json-schema-validator:3.0.6'
testCompile 'com.github.springtestdbunit:spring-test-dbunit:1.3.0'
testCompile('org.dbunit:dbunit:2.5.4') {
exclude(module: 'junit')
}
// Our license makes distribution of mysql-connector-java undesirable, uncomment here for local mysql testing
// runtime 'mysql:mysql-connector-java:6.0.5'
}
bootRun {
addResources = true
}
springBoot {
executable = true
excludeDevtools = true
layout = 'ZIP' // puts PropertiesLauncher in manifest, needed to support loader.dir
buildInfo()
}
rat {
excludes = [
'client/node_modules/**',
'client/dist/**',
'client/.babelrc',
'client/.editorconfig',
'client/.eslintignore',
'client/.eslintrc.js',
'client/.postcssrc.js',
'client/README.md',
'client/config/',
'client/static/.gitkeep',
'client/test/unit/.eslintrc',
'client/test/unit/coverage/',
'client/test/e2e/custom-assertions/elementCount.js',
'client/test/e2e/nightwatch.conf.js',
'client/test/e2e/runner.js',
'client/test/e2e/specs/test.js',
'.idea/**',
'**/*.iml',
'README.md',
'CONTRIBUTING.md',
'CHANGELOG.md',
'RELEASE.md',
'Dockerfile',
'.github/*',
'docker/',
'src/main/resources/db/migration/*.sql',
'src/main/resources/banner.txt',
'src/main/resources/static/**',
'src/test/resources/mails/**',
'scripts/rpm/**',
'**/.gradle/**',
'gradle/**',
'*gradle*',
'**/build/**',
'**/*.json',
'.travis.yml'
]
}
licenseReport {
outputDir = "$projectDir/build/thirdparty-licenses/thirdparty-licenses"
}
jar.dependsOn generateLicenseReport
jar {
manifest {
attributes("Implementation-Version": project.version)
attributes("Implementation-Title": "HoldMail")
attributes("Implementation-Vendor": "Sparta Systems Inc.")
}
from { ['LICENSE', 'NOTICE', "$projectDir/build/thirdparty-licenses"] }
}
docker {
name dockerName
files jar.archivePath, './docker/assets/etc/holdmail.properties', './docker/assets/opt/holdmail/bin/holdmail.conf'
buildArgs(['JAR_FILE': "${jar.archiveName}", 'PROP_FILE': 'holdmail.properties', 'CONF_FILE':'holdmail.conf'])
}
def RPM_INSTALL_DIR = '/opt/holdmail'
def RPM_USER = 'holdmail'
def RPM_GROUP = 'holdmail'
// guide:
// https://github.com/nebula-plugins/gradle-ospackage-plugin/wiki/Usage-Example
ospackage {
packageName = "${project.name}"
version = "${project.version}".replace("-SNAPSHOT", "")
vendor = "Sparta Systems Inc."
release = 1
arch = NOARCH
os = LINUX
type = BINARY
preInstall file('scripts/rpm/preInstall.sh')
postInstall file('scripts/rpm/postInstall.sh')
preUninstall file('scripts/rpm/preUninstall.sh')
postUninstall file('scripts/rpm/postUninstall.sh')
into RPM_INSTALL_DIR
user RPM_USER
permissionGroup RPM_GROUP
from(jar.outputs.files) {
rename { String f -> f.replace("-${project.version}", "") }
into 'bin'
fileMode = 0500
}
// Spring boot will look for conf files in the same dir as the app JAR file
// see 'CONF_FOLDER' in http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
from("scripts/bin") {
fileType CONFIG | NOREPLACE
into "bin"
}
}
buildRpm {
user RPM_USER
permissionGroup RPM_GROUP
// we can do this because the springBoot plugin above makes the jar executable
link('/etc/init.d/holdmail', RPM_INSTALL_DIR + '/bin/holdmail.jar')
}
task runNpmInstall(type: NpmTask) {
workingDir = file("${project.projectDir}/client")
args = ['install']
}
task compileUI(type: NpmTask) {
dependsOn 'runNpmInstall'
workingDir = file("${project.projectDir}/client")
args = ['run', 'build']
}
task testUI(type: NpmTask) {
dependsOn 'runNpmInstall'
workingDir = file("${project.projectDir}/client")
args = ['run', 'test']
}
task buildUI(type: Copy) {
dependsOn 'compileUI'
from "${project.projectDir}/client/dist"
into "${project.projectDir}/src/main/resources/static"
}
test {
testLogging {
// default test failure logging doesn't show assertion failure detail (unless gradle -i is used)
exceptionFormat = 'full'
}
}
test.dependsOn testUI
compileJava.dependsOn('buildUI')
tasks.build.dependsOn('buildRpm')
task srcJAR(type: Jar) {
from sourceSets.main.allSource
classifier "sources"
}
task docJAR(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
artifacts {
archives srcJAR
archives docJAR
}
// gradle release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=1.0.0 -Prelease.newVersion=1.1.0-SNAPSHOT
release {
preCommitText = '[RELEASE]'
preTagCommitMessage = ' - Update to release version: '
tagCommitMessage = ' - Tagging release version : '
newVersionCommitMessage = ' Update to new dev version: '
tagTemplate = '${version}'
}
afterReleaseBuild.dependsOn bintrayUpload
publishing {
publications {
HoldmailPublication(MavenPublication) {
from components.java
artifact srcJAR
artifact docJAR
artifactId 'holdmail'
groupId project.group
version project.version
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['HoldmailPublication']
filesSpec {
from 'build/distributions'
into 'rpms'
}
pkg {
repo = 'HoldMail'
name = 'holdmail'
userOrg = 'spartasystems'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/spartasystems/holdmail'
version {
gpg {
sign = true
}
}
}
}