forked from greghaskins/spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
132 lines (112 loc) · 3.1 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
plugins {
id "com.cinnober.gradle.semver-git" version "2.2.2"
id "com.github.kt3k.coveralls" version "2.4.0x"
id "com.jfrog.bintray" version "1.3.1"
id "com.diffplug.gradle.spotless" version "1.3.3"
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'checkstyle'
repositories { mavenCentral() }
dependencies {
compile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
}
compileJava { sourceCompatibility = 1.8 }
compileTestJava { sourceCompatibility = 1.8 }
test { finalizedBy jacocoTestReport }
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
task wrapper(type: Wrapper) { gradleVersion = '2.14.1' }
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts { archives sourcesJar, javadocJar }
spotless {
java {
eclipseFormatFile 'config/eclipse-java-google-style.xml'
importOrderFile 'config/spectrum.importorder'
custom 'separate return from previous statements', {
it.replaceAll(/([^\s\{])\n( *)return /, '$1\n\n$2return ')
}
}
format 'text', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
}
classes { dependsOn 'spotlessApply' }
checkstyle {
toolVersion = '6.18'
configFile = rootProject.file('config/google_checks.xml')
}
def verifyCheckstyleWarningsTask (name, warningsFileName) {
task(name) {
doFirst {
def warningsFile = file("build/reports/checkstyle/$warningsFileName")
if (warningsFile.exists() && warningsFile.text.contains('<error ')) {
throw new GradleException("There are Checkstyle warnings!\nSee $warningsFile for more info.")
}
}
}
}
checkstyleMain {
finalizedBy verifyCheckstyleWarningsTask('strictCheckstyleMain', 'main.xml')
}
checkstyleTest {
finalizedBy verifyCheckstyleWarningsTask('strictCheckstyleTest', 'test.xml')
}
publishing {
publications {
bintrayPublication(MavenPublication) {
from components.java
groupId 'com.greghaskins'
artifactId 'spectrum'
version project.version
artifact sourcesJar
artifact javadocJar
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publish = true
publications = ['bintrayPublication']
pkg {
repo = 'maven'
name = 'Spectrum'
licenses = ['MIT']
desc = 'A colorful BDD-style test runner for Java'
websiteUrl = 'https://github.com/greghaskins/spectrum'
issueTrackerUrl = 'https://github.com/greghaskins/spectrum/issues'
vcsUrl = 'https://github.com/greghaskins/spectrum.git'
labels = [
'java',
'junit',
'bdd',
'spec',
'testing',
'unit testing',
'java8',
'lambda'
]
version {
name = project.version
released = new Date()
}
}
}