-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
252 lines (220 loc) · 6.7 KB
/
build.gradle
File metadata and controls
252 lines (220 loc) · 6.7 KB
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
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.standardout:gradle-versioneye-plugin:latest.release'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:latest.release'
}
configurations {
classpath {
resolutionStrategy {
componentSelection {
all { ComponentSelection selection ->
def candidate = selection.candidate
if (candidate.version ==~ /(?i)^.*(?:(?:alpha|beta|gamma|rc|snapshot).*|\bm\d+)$/) {
selection.reject("${candidate.group}:${candidate.name}:${candidate.version} is not a production release.")
}
}
}
}
}
}
}
plugins {
id 'application'
id 'checkstyle'
id 'findbugs'
id 'jacoco'
id 'java'
id 'maven-publish'
}
apply plugin: 'org.standardout.versioneye'
apply plugin: 'com.github.kt3k.coveralls'
repositories {
mavenCentral()
jcenter()
}
sourceSets {
integ {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file("$projectDir/src/integ/java")
}
resources.srcDir file("$projectDir/src/integ/resources")
}
}
def resolutionStrategy = {
resolutionStrategy {
componentSelection {
all { ComponentSelection selection ->
def candidate = selection.candidate
if (candidate.group == 'com.google.protobuf') {
if (candidate.version ==~ /(?i)^.*(?:(?:alpha|snapshot).*|\bm\d+)$/) {
selection.reject("${candidate.group}:${candidate.name}:${candidate.version} is not a stable-enough release.")
}
}
else if (candidate.version ==~ /(?i)^.*(?:(?:alpha|beta|gamma|rc|snapshot).*|\bm\d+)$/) {
selection.reject("${candidate.group}:${candidate.name}:${candidate.version} is not a production release.")
}
}
}
}
}
configurations {
compile resolutionStrategy
runtime resolutionStrategy
testCompile resolutionStrategy
testRuntime resolutionStrategy
jacocoAgent resolutionStrategy
jacocoAnt resolutionStrategy
checkstyle resolutionStrategy
// Integration tests
integ resolutionStrategy
integCompile.extendsFrom testCompile
integRuntime.extendsFrom testRuntime
}
group = 'com.github.dylon'
archivesBaseName = name
version = '3.0.0' // http://semver.org/
description = 'Command-Line Interface to liblevenshtein (Java)'
sourceCompatibility = 1.8
targetCompatibility = 1.8
mainClassName = 'com.github.liblevenshtein.CommandLineInterface'
ext {
srcJava = "$projectDir/src/main/java"
srcDelomboked = "$buildDir/src-delomboked/main/java"
}
dependencies {
compile "com.github.universal-automata:liblevenshtein:$version"
compile 'com.google.code.findbugs:annotations:3.+'
compile 'com.google.guava:guava:19.+'
compile 'commons-cli:commons-cli:latest.release'
compile 'org.apache.commons:commons-lang3:3.+'
compile 'org.projectlombok:lombok:1.+'
compile 'org.slf4j:slf4j-api:1.+'
runtime 'ch.qos.logback:logback-classic:latest.release'
runtime 'org.codehaus.groovy:groovy-all:latest.release'
runtime 'org.slf4j:jcl-over-slf4j:latest.release'
runtime 'org.slf4j:jul-to-slf4j:latest.release'
runtime 'org.slf4j:log4j-over-slf4j:latest.release'
runtime 'org.slf4j:osgi-over-slf4j:latest.release'
testCompile 'org.assertj:assertj-core:latest.release'
testCompile 'org.mockito:mockito-all:1.+'
testCompile 'org.projectlombok:lombok:latest.release'
testCompile 'org.testng:testng:latest.release'
testRuntime 'ch.qos.logback:logback-classic:latest.release'
testRuntime 'org.codehaus.groovy:groovy-all:latest.release'
testRuntime 'org.slf4j:jcl-over-slf4j:latest.release'
testRuntime 'org.slf4j:jul-to-slf4j:latest.release'
testRuntime 'org.slf4j:log4j-over-slf4j:latest.release'
testRuntime 'org.slf4j:osgi-over-slf4j:latest.release'
// JaCoCo (Plugin)
jacocoAgent 'org.jacoco:org.jacoco.agent:latest.release'
jacocoAnt 'org.jacoco:org.jacoco.ant:latest.release'
// Checkstyle (Plugin)
checkstyle 'com.puppycrawl.tools:checkstyle:latest.release'
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
findbugs {
excludeFilter = file("$rootProject.projectDir/config/findbugs/exclude-filter.xml")
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
test {
useTestNG() {
// Run as many tests in-parallel as there are CPU cores
parallel 'methods'
threadCount Runtime.getRuntime().availableProcessors()
}
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams true
showExceptions true
showStackTraces true
}
}
task integ(type: Test) {
useTestNG() {
// Run as many tests in-parallel as there are CPU cores
parallel 'methods'
threadCount Runtime.getRuntime().availableProcessors()
}
testClassesDir = sourceSets.integ.output.classesDir
classpath = sourceSets.integ.runtimeClasspath
outputs.upToDateWhen { false } // always run integration tests
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams true
showExceptions true
showStackTraces true
}
}
task delombok {
dependsOn configurations.compile.getTaskDependencyFromProjectDependency(true, "compileJava")
// Make sure the delombok directory exists ...
file(srcDelomboked).mkdirs()
inputs.files file(srcJava)
outputs.dir file(srcDelomboked)
doLast {
ant.taskdef(
name: 'delombok',
classname: 'lombok.delombok.ant.Tasks$Delombok',
classpath: configurations.compile.asPath)
ant.delombok(
from: srcJava,
to: srcDelomboked,
classpath: configurations.compile.asPath)
}
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
tasks.withType(Checkstyle) {
def jsSrc = file("${projectDir}/src/checkstyle/js")
def jsDest = file("${buildDir}/reports/checkstyle/js")
def cssSrc = file("${projectDir}/src/checkstyle/css")
def cssDest = file("${buildDir}/reports/checkstyle/css")
doFirst {
if (!jsDest.exists() && !jsDest.mkdirs()) {
throw new IOException("Cannot create JavaScript directory [${jsDest}]")
}
if (!cssDest.exists() && !cssDest.mkdirs()) {
throw new IOException("Cannot create CSS directory [${cssDest}]")
}
copy {
from jsSrc
into jsDest
}
copy {
from cssSrc
into cssDest
}
}
reports {
xml.enabled true
html {
enabled true
stylesheet resources.text.fromFile('src/checkstyle/xslt/checkstyle.xsl')
}
}
}
check.dependsOn integ
integ.mustRunAfter test
integ.dependsOn installDist