-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathbuild.gradle
251 lines (218 loc) · 6.09 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
buildscript {
dependencies {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.4.0'
}
}
// Used to promote a staging release build
// https://github.com/Codearte/gradle-nexus-staging-plugin
// gradle closeAndReleaseRepository
plugins
{
id "io.codearte.nexus-staging" version "0.8.0"
}
apply from: 'dependencies.gradle'
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: "com.diffplug.gradle.spotless"
apply plugin: 'idea'
sourceCompatibility=1.8
targetCompatibility=1.8
repositories
{
mavenCentral()
// For geotools
maven { url "http://download.osgeo.org/webdav/geotools/" }
}
idea {
project {
languageLevel = '1.8'
}
}
spotless {
java {
importOrder(['static java', 'static javax', 'static org', 'static com', 'static scala', 'java', 'javax', 'org', 'com', 'scala'])
removeUnusedImports()
eclipse().configFile 'config/format/code_format.xml'
}
}
// corresponds to POM description
description = "Atlas Library"
// This is to skip the tasks for which there is a skip<TaskName>=true environment variable
def skippedTaskNames = System.getenv().findAll { key, value ->
key.startsWith("skip") && value.equalsIgnoreCase("true")
}.keySet().collect { it.substring(4) }
gradle.startParameter.excludedTaskNames += skippedTaskNames
checkstyle
{
toolVersion = versions.checkstyle
}
sourceSets
{
integrationTest
{
java
{
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
}
test
{
testLogging
{
events "passed", "skipped", "failed"
}
}
configurations
{
shaded
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
dependencies
{
compile packages.slf4j.api
compile packages.junit
testCompile packages.slf4j.log4j12
testCompile packages.log4j
testCompile packages.junit
integrationTestCompile packages.junit
compile packages.opencsv
compile packages.gson
compile packages.math
compile packages.http
compile packages.jts
compile packages.geotools
compile packages.osmosis.core
compile packages.osmosis.pbf
compile packages.osmosis.xml
compile packages.osmosis.hstore
compile packages.commons.io
compile packages.commons.cli
compile packages.commons.csv
compile packages.commons.lang
compile packages.reflections
compile packages.guava
compile packages.jsonassert
compile packages.jackson.core
compile packages.jackson.databind
shaded project.configurations.getByName('compile')
shaded packages.slf4j.log4j12
shaded packages.log4j
}
task shaded(type: Jar){
baseName = project.name
from
{
configurations.shaded.collect
{
it.isDirectory() ? it : zipTree(it).matching{
exclude
{
it.path.contains('META-INF') && (it.path.endsWith('.SF') || it.path.endsWith('.DSA') || it.path.endsWith('.RSA'))
}
}
}
}
with jar
zip64 = true
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
testLogging
{
events "passed", "skipped", "failed"
}
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
/**
* Artifact related items
*/
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts
{
archives javadocJar, sourcesJar
}
/**
* Deployment related items
*/
import org.gradle.plugins.signing.Sign
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
allprojects { ext."signing.keyId" = System.getenv('GPG_KEY_ID') }
allprojects { ext."signing.secretKeyRingFile" = System.getenv('GPG_KEY_LOCATION') }
allprojects { ext."signing.password" = System.getenv('GPG_PASSPHRASE') }
}
// Do not sign archives by default (a local build without gpg keyring should succeed)
if (taskGraph.allTasks.any { it.name == 'build' || it.name == 'assemble' }) {
tasks.findAll { it.name == 'signArchives' || it.name == 'signDocsJar' || it.name == 'signTestJar' }.each { task ->
task.enabled = false
}
}
}
signing
{
sign configurations.archives
}
build.dependsOn.remove(signArchives)
uploadArchives
{
repositories
{
mavenDeployer
{
beforeDeployment
{
MavenDeployment deployment -> signing.signPom(deployment)
}
repository(url: maven2_url) {
authentication(userName: System.getenv('SONATYPE_USERNAME'), password: System.getenv('SONATYPE_PASSWORD'))
}
snapshotRepository(url: snapshot_url) {
authentication(userName: System.getenv('SONATYPE_USERNAME'), password: System.getenv('SONATYPE_PASSWORD'))
}
pom.project
{
name project_name
packaging 'jar'
// optionally artifactId can be defined here
description project_description
url project_url
scm {
connection project_scm
developerConnection project_scm
url project_url
}
licenses {
license {
name project_license_slug
url project_license_url
}
}
developers {
developer {
id project_developer
name project_developer
}
}
}
}
}
}