This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
233 lines (183 loc) · 6.38 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
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
maven { url 'http://repo.spring.io/plugins-release' }
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE"
classpath 'com.eriwen:gradle-css-plugin:1.11.1'
classpath 'com.eriwen:gradle-js-plugin:1.12.0'
classpath 'com.bluepapa32:gradle-watch-plugin:0.1.4'
}
}
plugins {
id "io.spring.dependency-management" version "0.4.0.RELEASE"
}
version projVersion
group "com.github.jlgrock.autograder"
// IDE plugins
apply plugin: 'groovy'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
// tool for running spring boot environment
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
// standard web packaging and deployment
apply plugin: 'war'
apply plugin: 'js'
apply plugin: 'css'
ext {
gradleWrapperVersion = project.gradleWrapperVersion
}
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.spring.io/libs-snapshot" }
}
configurations {
providedRuntime
}
configurations.all {
exclude group: 'commons-logging'
exclude group: 'org.apache.logging.log4j'
exclude group: 'log4j'
}
dependencies {
compile(
"org.codehaus.groovy:groovy-all:2.3.6", // Groovy
"org.springframework.boot:spring-boot-starter-web", // Webapp
"org.springframework.boot:spring-boot-starter-data-jpa", // for Data
"org.springframework.boot:spring-boot-starter-security", // for creating user authentication
"org.liquibase:liquibase-core:3.4.1", // For stateful database migrations
"org.apache.poi:poi:3.13-beta1", // Apache POI for reading/writing excel documents
'org.hibernate:hibernate-validator:5.2.0.Beta1', // add JSR-303 annotations
'org.slf4j:slf4j-api:1.7.12', // Logging
// UI stuff
"org.webjars:jquery:2.1.1", // for DOM manipulation and use in angularJs for server communication
"org.webjars:angularjs:1.3.8", // for client-server eventing
"org.webjars:bootstrap:3.2.0", // for style
"org.webjars.bower:angular-bootstrap:0.12.1", // binds bootstrap css to angularjs
)
// jars provided at runtime
runtime(
"postgresql:postgresql:9.1-901-1.jdbc4",
"ch.qos.logback:logback-classic:1.1.3",
)
providedRuntime(
//"org.springframework.boot:spring-boot-starter-tomcat",
)
testCompile(
"org.springframework.boot:spring-boot-starter-test", // for testing spring stuff
"org.hamcrest:hamcrest-core:1.3", // for using matchers
"org.spockframework:spock-core:1.0-groovy-2.4" // to use Spock, the best way to test your code
)
testRuntime (
"cglib:cglib-nodep:3.1", // allows mocking of classes (in addition to interfaces)
"org.objenesis:objenesis:2.1", // allows mocking of classes without default constructor (together with CGLIB)
"com.h2database:h2:1.4.182" //test db
)
}
def webDir = "src/main/webapp"
def appDir = "${webDir}/app"
combineJs {
group = null // hides from the 'gradle tasks'
// pull together the source from string & file lists
// eg. def core = ["$webAppDirName/init.js",...]
source = ["${appDir}/app.js"] +
fileTree(dir: "${appDir}/directives", include: "**/*.js" ) +
fileTree(dir: "${appDir}/services", include: "**/*.js" ) +
fileTree(dir: "${appDir}/controllers", include: "**/*.js" )
include "*.js"
exclude "*.min.js"
// show the resolved files when gradle is run with -d
source.each{ logger.debug ("$it") }
dest = file("${buildDir}/js/${projName}.${version}.js")
}
combineCss {
group = null // hides from the 'gradle tasks'
source = ["${webDir}/css"]
dest = "${buildDir}/all.css"
source.each { logger.info "Combining $it"}
}
task combine(dependsOn: [combineJs, combineCss]) {
group = "Build"
description = "Combine all appropraite JavaScript files and all appropriate CSS files"
}
compileJava {
//enable compilation in a separate daemon process
options.fork = true
//enable incremental compilation
options.incremental = true
}
compileGroovy {
//enable compilation in a separate daemon process
options.fork = true
//enable incremental compilation
options.incremental = true
}
minifyJs {
group = null // hides from the 'gradle tasks'
it.dependsOn tasks.combineJs
source = combineJs
dest = file("${buildDir}/js/${projName}.${version}.min.js")
sourceMap = file("${buildDir}/js/${projName}.${version}.sourcemap.json")
closure {
warningLevel = 'QUIET'
//compilerOptions.defineReplacements = ['MY_DBUG_FLAG':false]
}
}
minifyCss {
group = null // hides from the 'gradle tasks'
it.dependsOn combineCss
source = combineCss
dest = "${buildDir}/css/${projName}.${version}.min.css"
yuicompressor { // Optional
lineBreakPos = -1
}
}
task minify(dependsOn: [minifyJs, minifyCss]) {
group = "Build"
description = "Minify both the JavaScript and CSS files"
}
gzipJs {
group = null // hides from the 'gradle tasks'
it.dependsOn tasks.minifyJs
source = minifyJs.dest
dest = file("${buildDir}/js/${projName}.${version}.min.js.gz")
}
gzipCss {
group = null // hides from the 'gradle tasks'
it.dependsOn tasks.minifyCss
source = minifyCss
dest = "${buildDir}/css/${projName}.${version}.min.css.gz"
}
task gzip(dependsOn: [gzipJs, gzipCss]) {
group = "Build"
description = "Gzip both the JavaScript and CSS files"
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
war {
it.dependsOn tasks.gzip
from( "${buildDir}/js", {
into "minified"
})
from( "${buildDir}/css", {
into "minified"
})
}
// Lets you remote debug the Spring Boot application. Useful if you are having issues running it in your IDE
// to use, just uncomment this out
//bootRun {
// jvmArgs = ['-Xdebug', '-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y']
//}