-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
136 lines (112 loc) · 3.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
buildscript {
repositories {
jcenter()
}
}
plugins {
id 'java'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.8.1'
id 'application'
id 'checkstyle'
}
version 1.1
mainClassName = 'edu.stanford.dlss.was.WasapiDownloader'
repositories {
jcenter() // for mockito
mavenCentral() // for jacoco and kt3k.coveralls plugins
}
dependencies {
//For basic command line parsing and option definitions.
compile 'commons-cli:commons-cli:1.4'
//For validating settings values, e.g., URLs
compile 'commons-validator:commons-validator:1.6'
//Json processing
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.6'
// Apache HttpComponents (networking)
compile 'org.apache.httpcomponents:httpclient:4.5.3'
compile 'org.apache.httpcomponents:httpcore:4.4.6'
// JAXB
compile 'javax.xml.bind:jaxb-api:2.3.0'
compile 'com.sun.xml.bind:jaxb-core:2.3.0'
compile 'com.sun.xml.bind:jaxb-impl:2.3.0'
//Unit testing framework.
testCompile 'junit:junit:4.12'
//For creating mock objects in unit tests
// See https://github.com/powermock/powermock/wiki/Mockito#supported-versions
testCompile 'org.mockito:mockito-core:2.23.0+'
// need PowerMock for mocking constructors (local objects within methods)
testCompile "org.powermock:powermock-module-junit4:2.0.0-RC.4"
testCompile "org.powermock:powermock-api-mockito2:2.0.0-RC.4"
}
sourceSets {
main {
java {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
}
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
// indicate test results in the console output
test {
testLogging {
// set options for log level LIFECYCLE
events "passed", "skipped", "failed", "standardOut"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
check.dependsOn jacocoTestReport
//Attributes to add to Jar
Map<String, String> jarAttributes = [
"Gradle-Version": gradle.gradleVersion,
"Host": InetAddress.getLocalHost().getHostName(),
"Built-By": System.getProperty("user.name"),
"Build-Jdk": System.getProperty("java.version"),
"GradleProjectName": project.name,
"Main-Class": mainClassName
]
jar {
manifest {
attributes(jarAttributes)
}
}
compileJava {
options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
}
compileTestJava {
options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
}
startScripts {
doLast {
unixScript.text = unixScript.text
.replace('DEFAULT_JVM_OPTS=\"\"', 'DEFAULT_JVM_OPTS=\"-Xmx10g\"')
}
}