-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
196 lines (171 loc) · 5.49 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
/*
* This file is part of the swblocks-jbl library.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'java'
id 'checkstyle'
id 'jacoco'
id 'maven-publish'
}
repositories {
mavenCentral()
}
// Expected property settings from external gradle.properties to publish to anything other than MavenLocal
// Setup her to default to empty if not set, so the build can continue
def mavenUser = project.hasProperty('mavenUser') ? project.property('mavenUser') : ''
def mavenPassword = project.hasProperty('mavenPassword') ? project.property('mavenPassword') : ''
def mavenSnapshotRepo = project.hasProperty('mavenSnapshotRepo') ? project.property('mavenSnapshotRepo') : ''
def mavenReleaseRepo = project.hasProperty('mavenReleaseRepo') ? project.property('mavenReleaseRepo') : ''
def mavenGroup = project.hasProperty('mavenGroup') ? project.property('mavenGroup') : 'org.swblocks'
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(file('version.properties')))
def mavenVersion = versionProps['version']
project.version = mavenVersion
logger.lifecycle('version {}',project.version)
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
defaultTasks 'clean', 'build', 'publishToMavenLocal'
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
configurations {
testArtifacts.extendsFrom testRuntime
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
checkstyle {
toolVersion = '7.3'
configFile = new File(rootDir, 'config/checkstyle/jbl_checks.xml')
}
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events "failed", "standardOut", "standardError"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
}
}
compileJava {
/*
* To suppress warnings about using Unsafe and sun.misc
*/
options.compilerArgs << '-XDignore.symbol.file'
options.compilerArgs << '-Xlint:unchecked'
options.fork = true
options.forkOptions.executable = 'javac'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:7.3'
testCompile(
'org.hamcrest:hamcrest-all:1.3',
'junit:junit:4.12',
'org.powermock:powermock-module-junit4:1.6.4',
'org.powermock:powermock-api-mockito:1.6.4',
'org.awaitility:awaitility:2.0.0')
testCompile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
testRuntime group: 'ch.qos.logback', name: 'logback-classic', version: '1.+'
testRuntime group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.7+'
testRuntime group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7+'
}
jacoco {
toolVersion = '0.7.6.201602180812'
}
jacocoTestReport() {
dependsOn(project: test)
reports {
html.enabled true
xml.enabled true
csv.enabled false
}
}
javadoc {
title = '<h1>JBL</h1>'
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task testJar(type: Jar, dependsOn: testClasses) {
classifier = 'test'
from sourceSets.test.output
}
artifacts {
testArtifacts testJar
}
def projectPom = {
name 'SWBlocks-JBL'
url 'https://github.com/jpmorganchase/swblocks-jbl'
issueManagement {
system 'GitHub'
url 'https://github.com/jpmorganchase/swblocks-jbl/issues'
}
scm {
connection 'scm:git:https://github.com/jpmorganchase/swblocks-jbl.git'
developerConnection 'scm:git:https://github.com/jpmorganchase/swblocks-jbl.git'
url 'https://github.com/jpmorganchase/swblocks-jbl.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'lazar-ivanov'
name 'Lazar Ivanov'
url 'https://github.com/lazar-ivanov'
}
developer {
id 'logicrunner'
name 'James Winnifrith'
url 'https://github.com/LogicRunner'
}
}
}
publishing {
repositories {
maven {
credentials {
username "$mavenUser"
password "$mavenPassword"
}
if (isReleaseVersion) {
url "${mavenReleaseRepo}"
} else {
url "${mavenSnapshotRepo}"
}
}
}
publications {
mavenJava(MavenPublication) {
pom.withXml {
asNode().appendNode('description', 'Software Blocks Java Base Library')
asNode().children().last()+projectPom
}
groupId "${mavenGroup}"
artifactId 'jbl'
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}