-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
288 lines (227 loc) · 6.59 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/*
* gradle build script for schema2doc project.
*
* uses gradle 2.6 for compile (or provided gradlew script).
*
* @see http://man-at-home.github.io/schema2doc/
* @author man-at-home
* @since 2015
* @version 2015
*/
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
// classpath "org.asciidoctor:asciidoctor-gradle-plugin:1.5.2" // asciidoctor doc
classpath "org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.9"
classpath "org.flywaydb:flyway-gradle-plugin:3.2.1" // db migration
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1" // upload
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.2'
id 'com.github.jruby-gradle.base' version '0.3.0'
}
group = 'org.manathome'
version = '0.1.7'
// development
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "org.flywaydb.flyway"
// qa
apply plugin: "checkstyle"
apply plugin: "findbugs"
apply plugin: "jacoco"
apply plugin: "jdepend"
apply plugin: "pmd"
apply plugin: "sonar-runner"
// documentation
apply plugin: "project-report"
apply plugin: "build-dashboard"
apply plugin: "announce"
apply plugin: "org.asciidoctor.gradle.asciidoctor"
// deployment
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "com.jfrog.bintray"
repositories {
mavenLocal()
mavenCentral()
maven{url "http://gradle.artifactoryonline.com/gradle/libs/"}
jcenter()
}
sourceCompatibility = "1.8"
compileJava {
targetCompatibility = 1.8
}
dependencies {
compile "org.slf4j:slf4j-api:1.7.12" // logging api
compile "ch.qos.logback:logback-classic:1.1.3" // logging library
compile "commons-cli:commons-cli:1.3" // command line parser
compile "com.zaxxer:HikariCP:2.4.1" // connection pool
testCompile "junit:junit:4.12" // unit tests
testCompile "com.h2database:h2:1.4.187" // dev database (usable in memory)
compile fileTree(dir: 'lib', include: ['*.jar'])
gems 'rubygems:asciidoctor-diagram:1.2.1'
}
jdepend {
toolVersion = "2.9.1"
}
jdependMain {
reports {
xml.enabled = false
text.enabled = true
}
}
jdependTest {
reports {
xml.enabled = false
text.enabled = true
}
}
findbugs {
toolVersion = "3.0.1"
ignoreFailures = true
effort = "max"
reportLevel = "high"
}
checkstyle {
ignoreFailures = true
toolVersion = "6.7" // with java8 support
}
pmd {
ignoreFailures = true
}
flyway {
url = "jdbc:h2:./schema2doc.test.h2.db" // makes no sense with the dev in memory db.
user = 'sa'
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
jacocoTestReport {
reports {
xml.enabled = true // required for sonar&coveralls
html.enabled = true
csv.enabled = false
// html.destination = "${buildDir}/reports/jacoco"
}
}
// configured for local sonarQube 4.5 installation (defaults)
sonarRunner {
// toolVersion = '2.4'
sonarProperties {
property "sonar.projectName", "totask2 project time logging"
property "sonar.projectKey", "totask2"
property "sonar.jacoco.reportPath", "${buildDir}/jacoco/test.exec"
property "sonar.junit.reportsPath", "${buildDir}/test-results/"
property "sonar.surefire.reportsPath", "${buildDir}/test-results/"
}
}
asciidoctor {
sourceDir = new File("${projectDir}/src/docs")
outputDir = new File("${buildDir}/docs/asciidoc")
logDocuments = true
// backends 'html5'
backends 'html5', 'pdf'
dependsOn jrubyPrepareGems
requires = ['asciidoctor-diagram']
gemPath = jrubyPrepareGems.outputDir
}
javadoc {
failOnError = false
options.windowTitle = "totask2 api documentation ${version}"
options.links( "http://download.oracle.com/javase/8/docs/api/" )
options.addBooleanOption("Xdoclint:none").setValue(true)
}
// temporary shortcut, deploy directly for plugin use
// target solution: multi project build with dependencies..
uploadArchives {
repositories {
mavenDeployer {
repository(url: uri('../schema2doc-plugin/repo'))
}
}
}
task sourceJar(type: Jar, dependsOn: classes) {
description "generate a jar with all source files"
classifier = "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
description "generate a jar with all source files"
classifier = "javadoc"
from javadoc.destinationDir
dependsOn javadoc
}
// add javadoc/source jars as artifacts
artifacts {
archives sourceJar, javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
artifact javadocJar
}
}
repositories {
maven {
// project local dummy repo
url "$buildDir/repo"
}
}
}
// bintrayUpload task
// ------------------
bintrayUpload.dependsOn(assemble)
bintray {
user = "man-at-home"
key = System.getenv("BINTRAY_KEY")
publications = ['mavenJava']
dryRun = false // change to false for actual upload to bintray
publish = false // keep publishing step manual for the time beeing
pkg {
repo = "maven"
name = "schema2doc"
desc = "an asciidoc db schema documentation generator"
websiteUrl = "https://github.com/man-at-home/schema2doc"
issueTrackerUrl = "https://waffle.io/man-at-home/schema2doc"
vcsUrl = "https://github.com/man-at-home/schema2doc.git"
licenses = ['Apache-2.0']
publicDownloadNumbers = false
version {
name = '0.1.7' // adapt
desc = 'under development'
}
}
}
// CUSTOM TASKS
// ============
task allDocs {
description "generation of full documentation (asciidoc and javadoc)"
dependsOn javadoc, asciidoctor, projectReport
}
task allTests {
description "all tests fresh"
dependsOn clean, flywayClean, flywayMigrate, test, jacocoTestReport
}
task coverage {
description "code coverage"
dependsOn test, jacocoTestReport
}
task wrapper(type: Wrapper) {
description "gradle wrapper generation (call if gradle version changes)"
gradleVersion = '2.6'
}
task publish2public {
description "upload jars to jcenter (maven repo)"
dependsOn bintrayUpload
}