-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbuild.gradle
350 lines (314 loc) · 12.7 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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
import de.iteratec.osm.frontendBuild.Grails2FrontendI18nTask
/*
* OpenSpeedMonitor (OSM)
* Copyright 2014 iteratec GmbH
*
* 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.
*/
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'org.grails.plugins:database-migration:3.0.3'
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.15.1"
classpath 'com.bertramlabs.plugins:less-asset-pipeline:2.15.1'
classpath "org.hibernate:hibernate-core:5.3.4.Final"
classpath "org.grails.plugins:hibernate5:$hibernateVersion"
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
}
}
version "5.3.3"
group "OpenSpeedMonitor"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "war"
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
apply plugin: "asset-pipeline"
apply plugin: 'com.moowork.node'
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
karmaExec = file('node_modules/karma/bin/karma')
karmaConfig = 'src/test/js/karma.conf.js'
seleniumVersion = "2.53.1"
swaggerVersion = '1.5.19'
swaggerUIVersion = '3.17.0'
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://dl.bintray.com/ishults/plugins" }
maven { url "https://dl.bintray.com/longwa/plugins" }
maven { url "https://dl.bintray.com/ajay-kumar/plugins" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
// Default Grails-Stuff
runtime 'org.grails.plugins:grails-console:2.1.1'
compile "org.grails:grails-core"
compile 'org.grails:grails-logging'
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate5:$hibernateVersion"
compile 'org.grails.plugins:log-hibernate-stats:1.0.20'
compile "org.hibernate:hibernate-ehcache"
compile "io.swagger:swagger-core:${swaggerVersion}"
compile "io.swagger:swagger-models:${swaggerVersion}"
compile "io.swagger:swagger-servlet:${swaggerVersion}"
compile "org.webjars:swagger-ui:${swaggerUIVersion}"
runtime "com.h2database:h2"
console "org.grails:grails-console"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.52.0"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.33"
profile "org.grails.profiles:web:3.2.0"
testCompile "org.grails:grails-gorm-testing-support:1.1.4"
testCompile "org.grails:grails-web-testing-support:1.1.4"
testCompile "org.grails.plugins:hibernate5:$hibernateVersion"
testCompile "org.seleniumhq.selenium:selenium-support:${seleniumVersion}"
testCompile "org.seleniumhq.selenium:selenium-remote-driver:${seleniumVersion}"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:${seleniumVersion}"
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:${seleniumVersion}"
//Custom OSM-Stuff
runtime 'mysql:mysql-connector-java:8.0.13'
compile 'com.bertramlabs.plugins:less-asset-pipeline:2.15.1'
runtime 'org.grails.plugins:database-migration:3.0.3'
compile 'net.sf.supercsv:super-csv:2.4.0'
compile 'org.grails.plugins:joda-time:2.0.0'
compile 'org.grails.plugins:spring-security-core:3.2.3'
compile 'org.grails.plugins:spring-security-ui:3.1.2'
compile 'org.grails.plugins:greenmail:2.0.0.M1'
compile 'org.grails.plugins:mail:2.0.0'
compile 'org.grails.plugins:quartz:2.0.13'
compile 'org.grails.plugins:taggable:2.1.0-SNAPSHOT'
compile 'org.grails.plugins:cookie:2.0.5'
compile 'xml-apis:xml-apis:1.4.01'
compile 'io.dropwizard.metrics:metrics-core:4.0.2'
compile 'io.dropwizard.metrics:metrics-graphite:4.0.2'
compile 'io.dropwizard.metrics:metrics-jvm:4.0.2'
compile 'p6spy:p6spy:3.8.0'
compile 'org.grails.plugins:build-test-data:3.3.1'
compile 'io.github.http-builder-ng:http-builder-ng-core:1.0.3'
compile 'org.grails.plugins:http-builder-helper:1.1.0'
runtime 'net.sf.supercsv:super-csv:2.4.0'
assets 'com.bertramlabs.plugins:less-asset-pipeline:2.15.1'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile('com.athaydes:spock-reports:1.6.1') {
transitive = false // this avoids affecting your version of Groovy/Spock
}
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
assets {
minifyJs = true
minifyCss = true
configOptions = [:]
excludes = ['node_modules/**/*.less']
}
node {
//node version to use
version = '10.13.0'
//npm version to use
npmVersion = '6.4.1'
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
download = true
// Set the work directory for unpacking node
workDir = file("${project.buildDir}/nodejs")
// Set npm work directory, so it's affected by gradle clean as well and not built in the .gradle folder
npmWorkDir = file("${project.buildDir}/npm")
// Set the work directory where node_modules should be located
// nodeModulesDir = file("${project.projectDir}/node_modules")
nodeModulesDir = file("${project.projectDir}")
}
npmInstall {
outputs.files file('node_modules')
}
task installFrontendDependencies(type: NpmTask) {
group "frontend build"
description = "Installs frontend package dependencies"
workingDir = file("${project.projectDir}/frontend")
args = ['install']
}
task compileFrontend(type: NpmTask, dependsOn: installFrontendDependencies) {
group "frontend build"
description = "Compiles frontend"
workingDir = file("${project.projectDir}/frontend")
args = ['run', 'build:prod']
}
task syncFrontendJavascripts(type: Sync, dependsOn: compileFrontend) {
group "frontend build"
description = "Syncs frontend javascript files"
from 'frontend/dist/frontend'
include '*.js'
into 'grails-app/assets/javascripts/frontend'
rename('(main|polyfills|runtime)\\..*\\.js', '$1.js')
}
task syncFrontendStylesheets(type: Sync, dependsOn: compileFrontend) {
group "frontend build"
description = "Syncs frontend stylesheet files"
from 'frontend/dist/frontend'
include '*.css'
into 'grails-app/assets/stylesheets/frontend'
rename('(styles)\\..*\\.css', '$1.css')
}
task syncFrontendAssets(type: Sync, dependsOn: compileFrontend) {
group "frontend build"
description = "Syncs frontend asset files"
from 'frontend/dist/frontend/assets'
include '*'
into 'grails-app/assets/other/frontend'
}
task generateFrontendI18nFiles(type: Grails2FrontendI18nTask) {
group "frontend build"
description "Generate i18n files for angular frontend from grails msg bundles."
frontendKeyPrefix = "frontend."
}
task rebuildNodeSass(type: NpmTask) {
workingDir = file("${project.projectDir}/frontend")
args = ['rebuild', 'node-sass']
}
task angularTests(type: NpmTask, dependsOn: [installFrontendDependencies, npmInstall, rebuildNodeSass]) {
workingDir = file("${project.projectDir}/frontend")
args = ['test']
}
task jasmineRun(type: NodeTask, dependsOn: ['nodeSyncJavascript', 'nodeSyncStylesheets']) {
script = karmaExec
args = ['start', karmaConfig, '--single-run']
}
task jasmineWatch(type: NodeTask, dependsOn: 'npmInstall') {
script = karmaExec
args = ['start', karmaConfig]
}
test.dependsOn jasmineRun
test.dependsOn angularTests
task nodeSyncJavascript(type: Sync) {
description "Copy 3rd party js libs to grails asset folder."
from 'node_modules'
into "grails-app/assets/javascripts/node_modules"
include 'jquery/dist/jquery.min.js'
include 'jquery-ui-dist/jquery-ui.min.js'
include 'bootstrap/dist/js/bootstrap.min.js'
include 'clipboard/dist/clipboard.min.js'
include 'jquery-contextmenu/dist/jquery.contextMenu.min.js'
include 'chosen-js/chosen.jquery.js'
include 'd3/d3.min.js'
include 'later/later.min.js'
include 'moment/min/moment.min.js'
include 'prettycron/prettycron.js'
include 'spin.js/spin.min.js'
include 'tag-it/js/tag-it.min.js'
include 'codemirror/lib/codemirror.js'
include 'codemirror/addon/hint/show-hint.js'
include 'sticky-table-headers/js/jquery.stickytableheaders.min.js'
include 'file-saver/FileSaver.min.js'
include 'bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js'
include 'save-svg-as-png/saveSvgAsPng.js'
include "air-datepicker/dist/js/datepicker.min.js"
include "air-datepicker/dist/js/i18n/datepicker.en.js"
include "air-datepicker/dist/js/i18n/datepicker.de.js"
include "bootstrap-validator/js/validator.js"
dependsOn npmInstall
}
task nodeSyncStylesheets(type: Sync) {
description "Copy 3rd party js libs to grails asset folder."
from 'node_modules'
into "grails-app/assets/stylesheets/node_modules"
include 'bootstrap/dist/css/bootstrap*.min.css'
include 'bootstrap/less/*.less'
include 'bootstrap/less/mixins/*.less'
include '@fortawesome/fontawesome-free/less/*'
include '@fortawesome/fontawesome-free/webfonts/*'
include 'jquery-contextmenu/dist/jquery.contextMenu.min.css'
include 'bootstrap-chosen/bootstrap-chosen.less'
include 'bootstrap-chosen/bootstrap-chosen-variables.less'
include 'bootstrap-chosen/chosen-sprite.png'
include 'bootstrap-chosen/chosen-sprite@2x.png'
include 'codemirror/lib/codemirror.css'
include 'codemirror/addon/hint/show-hint.css'
include 'tag-it/css/jquery.tagit.css'
include 'jquery-ui-dist/jquery-ui.css'
include 'jquery-ui-dist/images/'
include 'bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css'
include 'bootstrap-colorpicker/dist/img/bootstrap-colorpicker/*'
include 'air-datepicker/dist/css/datepicker.min.css'
dependsOn npmInstall
}
processResources.dependsOn nodeSyncJavascript, nodeSyncStylesheets, installFrontendDependencies, generateFrontendI18nFiles
assetCompile.dependsOn nodeSyncJavascript, nodeSyncStylesheets, syncFrontendAssets, syncFrontendJavascripts, syncFrontendStylesheets, generateFrontendI18nFiles
clean.delete << file('grails-app/assets/javascripts/node_modules')
clean.delete << file('grails-app/assets/javascripts/frontend')
clean.delete << file('grails-app/assets/stylesheets/node_modules')
clean.delete << file('grails-app/assets/stylesheets/frontend')
clean.delete << file('grails-app/assets/other/frontend')
clean.delete << file('node_modules')
clean.delete << file('grails-app/assets/javascripts/bower_components')
clean.delete << file('grails-app/assets/stylesheets/bower_components')
// Cleans old npm directory inside .gradle as these are not needed anymore because the build directory is used
clean.delete << file('.gradle/npm')
clean.delete << file('frontend/dist')
sourceSets {
main {
resources {
srcDir 'grails-app/migrations'
}
}
}
'dbmGormDiff' {
jvmArgs = ["-XX:MaxPermSize=512m", "-Xms1G", "-Xmx2G"]
}
'dbmUpdate' {
jvmArgs = ["-XX:MaxPermSize=512m", "-Xms1G", "-Xmx2G"]
}
'dbmClearChecksums' {
jvmArgs = ["-XX:MaxPermSize=512m", "-Xms1G", "-Xmx2G"]
}
'dbmChangelogSync' {
jvmArgs = ["-XX:MaxPermSize=512m", "-Xms1G", "-Xmx2G"]
}
integrationTest {
beforeTest { descriptor -> logger.lifecycle("Running test: " + descriptor) }
if (System.getProperty('webdriver.chrome.driver')) {
systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
}
if (System.getProperty('grails.env')) {
systemProperty 'grails.env', 'test'
}
if (System.getProperty('geb.env')) {
systemProperty 'geb.env', 'chrome'
}
}
bootRun {
addResources = true
}