-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·197 lines (162 loc) · 4.65 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
// Students should not edit this file.
plugins {
// id 'pmd'
// id "com.github.spotbugs" version "1.7.1"
// id "com.diffplug.gradle.spotless" version "3.21.1"
}
apply plugin: 'java'
sourceCompatibility = 1.11
targetCompatibility = 1.11
repositories {
mavenCentral()
jcenter()
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
testRuntime group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
implementation 'com.opencsv:opencsv:4.3.2'
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.sparkjava:spark-core:2.8.0"
implementation "org.slf4j:slf4j-simple:1.7.21"
}
javadoc {
options.tags = ["spec.modifies", "spec.effects", "spec.requires", "spec.specfield", "spec.derivedfield"]
options.addBooleanOption "-no-module-directories", true
}
///
/// Testing
///
test {
exclude 'setup/**'
exclude 'poly/**'
// exclude 'graph/**'
// exclude 'marvel/**'
// exclude 'pathfinder/**'
}
tasks.withType(Test) {
enableAssertions = true
}
task copyGraphTestScripts(type: Copy) {
from "src/test/java/graph/specTest"
include "*.test", "*.expected"
into "${buildDir}/classes/java/test/graph/specTest"
}
task copyMarvelTestScripts(type: Copy) {
from "src/test/java/marvel/specTest"
include "*.test", "*.expected"
into "${buildDir}/classes/java/test/marvel/specTest"
}
task copyPathfinderTestScripts(type: Copy) {
from "src/test/java/pathfinder/specTest"
include "*.test", "*.expected"
into "${buildDir}/classes/java/test/pathfinder/specTest"
}
test.dependsOn copyGraphTestScripts
test.dependsOn copyMarvelTestScripts
test.dependsOn copyPathfinderTestScripts
///
/// Extra code quality checks
///
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
}
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
///
/// Validation: Checking additional assignment requirements
///
task validate {
description = 'Validate the working copy. Ensures that the project builds, that required files exist and a Javadoc is generated.'
}
validate.dependsOn clean
validate.dependsOn build
validate.dependsOn javadoc
///
/// Run: running Java classes
///
task runHolaWorld(type: JavaExec) {
main = "setup/HolaWorld"
standardInput = System.in
classpath = sourceSets.main.runtimeClasspath
}
task runRandomHello(type: JavaExec) {
main = "setup/RandomHello"
standardInput = System.in
classpath = sourceSets.main.runtimeClasspath
}
task runCalculator(type: JavaExec) {
main = "poly/CalculatorFrame"
standardInput = System.in
classpath = sourceSets.main.runtimeClasspath
}
task runMarvel(type: JavaExec) {
main = "marvel/MarvelPaths"
standardInput = System.in
classpath = sourceSets.main.runtimeClasspath
}
task runPathfinder(type: JavaExec) {
main = "pathfinder/textInterface/Pathfinder"
standardInput = System.in
classpath = sourceSets.main.runtimeClasspath
}
task runSpark(type: JavaExec) {
main = "campuspaths/SparkServer"
classpath = sourceSets.main.runtimeClasspath
}
///
/// Other targets
///
task cleanByRenaming {
description = 'Use this when the "clean" target fails due to "unable to delete file" "device or resource busy".'
doLast {
File destinationDir = new File("${buildDir}", 'deleteme-' + new Random().nextInt(1000000))
mkdir destinationDir
println "destinationDir = " + destinationDir
buildDir.eachFile { f ->
println "Processing " + f
f.renameTo(new File(destinationDir, f.getName()))
}
}
}
task specTests(type: Test) {
description = 'Runs the specification tests.'
group = 'verification'
filter {
setExcludePatterns "*.implTest.*"
setIncludePatterns "*.specTest.*"
}
}
task implTests(type: Test) {
description = 'Runs the implementation tests.'
group = 'verification'
filter {
setExcludePatterns "*.specTest.*"
setIncludePatterns "*.implTest.*"
}
}
specTests.dependsOn compileTestJava
specTests.dependsOn copyGraphTestScripts
specTests.dependsOn copyMarvelTestScripts
specTests.dependsOn copyPathfinderTestScripts
implTests.dependsOn compileTestJava
///
/// HW7 Configurations
///
task compileGraphOnly(type: JavaCompile) {
source = compileJava.source
destinationDir = compileJava.destinationDir
classpath = compileJava.classpath
}
compileGraphOnly {
exclude 'setup/**'
exclude 'poly/**'
exclude 'marvel/**'
exclude 'pathfinder/**'
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
}