forked from jpatton-USGS/edgecwb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
161 lines (137 loc) · 3.14 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
/**
* Gradle Build Script.
*
* Use Gradle 4.9+.
*/
plugins {
id "java"
id "jacoco" // code coverage
id "pmd" // static code analysis
id "com.gradle.build-scan" version "1.16" // post build results online
id "org.ajoberstar.grgit" version "2.3.0" // git repo information
id "org.ajoberstar.git-publish" version "1.0.1" // publish gh-pages branch
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
}
configurations {
codacy
}
dependencies {
codacy "com.codacy:codacy-coverage-reporter:4.0+"
// javax.json
compile "javax.json:javax.json-api:1.1"
compile "org.glassfish:javax.json:1.1"
// database drivers
compile "mysql:mysql-connector-java:5.1.47"
compile "org.xerial:sqlite-jdbc:3.23.1"
// compile files("lib/JARFILE.JAR")
testCompile "junit:junit-dep:4.11"
}
sourceSets {
main {
// java.excludes = ["**/XmlVerifier*"]
}
}
// show compile warnings
tasks.withType(JavaCompile) {
options.setDeprecation(true);
options.setWarnings(true);
}
// coverage reports
jacoco {
toolVersion "0.8.2"
}
jacocoTestReport {
reports {
html.enabled true
xml.enabled true
}
}
check.dependsOn jacocoTestReport
test {
filter {
includeTestsMatching "*Test"
}
}
// clean up after tests
task testCleanup {
doLast {
delete("bin")
}
}
clean.dependsOn testCleanup
test.dependsOn testCleanup
// Tasks for building releases
// create javadocs
javadoc {
excludes = ['com/isti/**']
options.addBooleanOption('html5', true)
}
// create jar file
jar {
baseName = "EdgeCWB"
manifest {
attributes "Git-Commit": grgit.head().id
// attributes "Main-Class": "gov.usgs.edge.MainClass"
}
from {
// classes and dependencies
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
}
}
// create zip bundle
task createZip(type: Zip, dependsOn: jar) {
archiveName "EdgeCWB.zip"
// init scripts and README
// from "etc/examples/default"
// example listeners
// from ("etc/examples/client/bin") { include "ExampleListener.*" }
// EdgeCWB.jar
from jar
}
// publish documentation and reports to gh-pages
// use after every release
gitPublish {
repoUri = "[email protected]:usgs/edgecwb.git"
branch = "gh-pages"
contents {
from "docs"
from createZip
from jar
from (javadoc) {
into "javadoc"
}
from (test) {
into "test"
exclude "*.bin"
exclude "*.idx"
exclude "*.xml"
}
from (jacocoTestReport) {
into "coverage"
exclude "*.xml"
}
}
}
// Tasks for TravisCI
// run with "gradle build --scan" to post build output online
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
// .travis.yml uses this to upload coverage
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
description = "Upload coverage to codacy (used by TravisCI)"
main = "com.codacy.CodacyCoverageReporter"
classpath = configurations.codacy
args = [
"report",
"-l",
"Java",
"-r",
"${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
]
}