forked from snowplow/snowplow-java-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
237 lines (199 loc) · 7.17 KB
/
build.gradle
File metadata and controls
237 lines (199 loc) · 7.17 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
/*
* Copyright (c) 2017 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
buildscript {
repositories {
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
}
}
plugins {
id "com.jfrog.bintray" version "1.8.4"
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
wrapper.gradleVersion = '5.0.0'
archivesBaseName = 'snowplow-java-tracker'
version = '0.8.4'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
def javaVersion = JavaVersion.VERSION_1_8
repositories {
// Use 'maven central' for resolving our dependencies
mavenCentral()
// Use 'jcenter' for resolving testing dependencies
jcenter()
}
configure([compileJava, compileTestJava]) {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
options.encoding = 'UTF-8'
}
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
dependencies {
// Apache Commons
compile 'commons-codec:commons-codec:1.10'
compile 'commons-net:commons-net:3.3'
// Apache HTTP
optional 'org.apache.httpcomponents:httpclient:4.3.3'
optional 'org.apache.httpcomponents:httpasyncclient:4.0.1'
// Square OK HTTP
optional 'com.squareup.okhttp:okhttp:2.2.0'
// SLF4J logging API
compile 'org.slf4j:slf4j-api:1.7.7'
testRuntime 'org.slf4j:slf4j-simple:1.7.7'
// Jackson JSON processor
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1.1'
// Preconditions
compile 'com.google.guava:guava:18.0'
// Testing libraries
testCompile 'junit:junit:4.11'
testCompile 'com.github.tomakehurst:wiremock:1.53'
testCompile 'org.skyscreamer:jsonassert:1.2.3'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'com.squareup.okhttp:mockwebserver:2.1.0'
}
task sourceJar(type: Jar, dependsOn: 'generateSources') {
from sourceSets.main.allJava
}
task generateSources {
project.ext.set("outputDir", "$projectDir/src/main/java/com/snowplowanalytics/snowplow/tracker")
doFirst {
println outputDir
def srcFile = new File((String) outputDir, "Version.java")
srcFile.parentFile.mkdirs()
srcFile.write(
"""/*
* Copyright (c) 2014-2018 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
package com.snowplowanalytics.snowplow.tracker;
// DO NOT EDIT. AUTO-GENERATED.
public class Version {
static final String TRACKER = "java-$project.version";
static final String VERSION = "$project.version";
}
""")
}
}
compileJava.dependsOn generateSources
compileJava.source generateSources.outputs.files, sourceSets.main.java
task printVersion {
doLast {
print "$project.version"
}
}
// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
install {
repositories.mavenInstaller {
pom.artifactId = 'snowplow-java-tracker'
pom.version = "$project.version"
pom.project {
name = 'snowplow-java-tracker'
description = 'Snowplow event tracker for Java. Add analytics to your Java desktop and server apps, servlets and games.'
url = 'https://github.com/snowplow/snowplow-java-tracker/'
inceptionYear = '2014'
packaging = 'jar'
groupId = 'com.snowplowanalytics'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
connection = 'https://github.com/snowplow/snowplow-java-tracker.git'
url = 'https://github.com/snowplow/snowplow-java-tracker'
}
developers {
developer {
name = 'Snowplow Analytics Ltd'
email = 'support@snowplowanalytics.com'
organization = 'Snowplow Analytics Ltd'
organizationUrl = 'http://snowplowanalytics.com'
}
}
organization {
name = 'com.snowplowanalytics'
url = 'http://snowplowanalytics.com'
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_SNOWPLOW_MAVEN_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_SNOWPLOW_MAVEN_API_KEY')
configurations = ['archives']
publish = true
pkg {
repo = 'snowplow-maven'
name = 'snowplow-java-tracker'
group = 'com.snowplowanalytics'
userOrg = 'snowplow'
websiteUrl = 'https://github.com/snowplow/snowplow-java-tracker'
vcsUrl = 'https://github.com/snowplow/snowplow-java-tracker'
issueTrackerUrl = 'https://github.com/snowplow/snowplow-java-tracker/issues'
licenses = ['Apache-2.0']
version.name = "$project.version"
version {
mavenCentralSync {
sync = true
user = project.hasProperty('SONA_USER') ? project.property('SONA_USER') : System.getenv('SONA_USER')
password = project.hasProperty('SONA_PASS') ? project.property('SONA_PASS') : System.getenv('SONA_PASS')
close = '1'
}
}
}
}