forked from CS2103JAN2018-W15-B4/main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
208 lines (171 loc) · 5.73 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
/*
* Gradle Configuration File
*
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at http://gradle.org/docs/2.2.1/userguide/tutorial_java_projects.html
*/
plugins {
id 'java'
id 'jacoco'
id 'checkstyle'
id "com.github.kt3k.coveralls" version "2.4.0"
id "com.github.johnrengelman.shadow" version '1.2.3'
id 'org.asciidoctor.convert' version '1.5.6'
id 'application'
}
// Specifies the entry point of the application
mainClassName = 'seedu.club.MainApp'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
checkstyle {
toolVersion = '8.1'
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
dependencies {
String testFxVersion = '4.0.7-alpha'
compile group: 'org.fxmisc.easybind', name: 'easybind', version: '1.0.3'
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.11'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.testfx', name: 'testfx-core', version: testFxVersion
testCompile group: 'org.testfx', name: 'testfx-junit', version: testFxVersion
testCompile group: 'org.testfx', name: 'testfx-legacy', version: testFxVersion, {
exclude group: 'junit', module: 'junit'
}
testCompile group: 'org.testfx', name: 'openjfx-monocle', version: '1.8.0_20'
}
shadowJar {
archiveName = "clubconnect.jar"
destinationDir = file("${buildDir}/jar/")
}
task wrapper(type: Wrapper) {
gradleVersion = '4.6'
}
task coverage(type: JacocoReport) {
sourceDirectories = files(allprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(allprojects.sourceSets.main.output)
executionData = files(allprojects.jacocoTestReport.executionData)
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/*.jar'])
})
}
reports {
html.enabled = true
xml.enabled = true
}
}
coveralls {
sourceDirs = allprojects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/coverage/coverage.xml"
}
tasks.coveralls {
dependsOn coverage
onlyIf { System.env.'CI' }
}
task(guiTests)
task(nonGuiTests)
// Run `test` task if `guiTests` or `nonGuiTests` is specified
guiTests.dependsOn test
nonGuiTests.dependsOn test
task(allTests)
// `allTests` implies both `guiTests` and `nonGuiTests`
allTests.dependsOn guiTests
allTests.dependsOn nonGuiTests
test {
systemProperty 'testfx.setup.timeout', '60000'
/*
* Prints the currently running test's name in the CI's build log,
* so that we can check if tests are being silently skipped or
* stalling the build.
*/
if (System.env.'CI') {
beforeTest { descriptor ->
logger.lifecycle('Running test: ' + descriptor)
}
}
jacoco {
destinationFile = new File("${buildDir}/jacoco/test.exec")
}
doFirst {
boolean runGuiTests = gradle.taskGraph.hasTask(guiTests)
boolean runNonGuiTests = gradle.taskGraph.hasTask(nonGuiTests)
if (!runGuiTests && !runNonGuiTests) {
runGuiTests = true;
runNonGuiTests = true;
}
if (runNonGuiTests) {
test.include 'seedu/club/**'
}
if (runGuiTests) {
test.include 'systemtests/**'
test.include 'seedu/club/ui/**'
}
if (!runGuiTests) {
test.exclude 'seedu/club/ui/**'
}
}
}
task headless << {
println "Setting headless mode properties."
test {
systemProperty 'java.awt.robot', 'true'
systemProperty 'testfx.robot', 'glass'
systemProperty 'testfx.headless', 'true'
systemProperty 'prism.order', 'sw'
systemProperty 'prism.text', 't2k'
}
}
// Makes sure that headless properties are set before running tests
test.mustRunAfter headless
asciidoctor {
backends 'html5'
sourceDir 'docs'
outputDir "${buildDir}/docs"
attributes linkcss: true,
stylesheet: 'gh-pages.css',
'source-highlighter': 'coderay',
icons: 'font',
experimental: true,
sectlinks: true,
idprefix: '', // for compatibility with GitHub preview
idseparator: '-'
}
/*
* Copies stylesheets into the directory containing generated HTML files as
* Asciidoctor does not copy linked CSS files to the output directory when rendering.
* This is needed for linked stylesheets and embedded stylesheets which import other files.
*/
task copyStylesheets(type: Copy) {
from "${asciidoctor.sourceDir}/stylesheets"
into "${asciidoctor.outputDir}/html5/stylesheets"
}
asciidoctor.dependsOn copyStylesheets
task deployOfflineDocs(type: Copy) {
into('src/main/resources/docs')
from ("${asciidoctor.outputDir}/html5") {
include 'stylesheets/*'
include 'images/*'
include 'UserGuide.html'
}
}
task copyDummySearchPage(type: Copy) {
from 'docs/DummySearchPage.html'
into "${buildDir}/docs/html5"
}
deployOfflineDocs.dependsOn asciidoctor
processResources.dependsOn deployOfflineDocs
defaultTasks 'clean', 'headless', 'allTests', 'coverage', 'asciidoctor'