-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
94 lines (80 loc) · 2.54 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
/// ***************************
/// Main Running Configurations
/// ***************************
allprojects {
apply plugin: "java"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
}
dependencies {
testImplementation group: "junit", name: "junit", version: "4.13"
testImplementation group: "org.hamcrest", name: "hamcrest-core", version: "1.3"
testImplementation group: "org.hamcrest", name: "hamcrest-all", version: "1.3"
}
javadoc {
options.tags = [
"spec.modifies:a:Modifies:",
"spec.effects:a:Effects:",
"spec.requires:a:Requires:",
"spec.specfield:a:Specfield:",
"spec.derivedfield:a:Derived Field:"
]
}
compileJava {
options.encoding = "UTF-8"
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
}
compileTestJava {
options.encoding = "UTF-8"
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
}
/// ********************
/// Testing + Assertions
/// ********************
allprojects {
// We use assertions in checkReps, so enable them everywhere
tasks.withType(JavaExec) {
enableAssertions = true
}
tasks.withType(Test) {
enableAssertions = true
}
// Print out lots of info about tests to aid in debugging
test {
testLogging {
events "failed", "skipped"
setShowStandardStreams true
setShowExceptions true
exceptionFormat "full"
}
}
}
/// ****************
/// Additional Tasks
/// ****************
allprojects {
task validate {
group = "homework"
description = "Validate the working copy. Ensures that the project builds, a javadoc is generated, and student tests run."
dependsOn clean
dependsOn compileJava
dependsOn compileTestJava
dependsOn javadoc
dependsOn test
}
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()))
}
}
}
}