-
Notifications
You must be signed in to change notification settings - Fork 143
/
build.gradle
209 lines (181 loc) · 5.87 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
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.1.0'
}
}
plugins {
id "eclipse"
id "jacoco"
id "java-library"
id "maven-publish"
id "org.ajoberstar.github-pages" version "1.7.2"
id "signing"
}
def getProperty = { property ->
if (!project.hasProperty(property)) {
throw new GradleException("${property} property must be set")
}
return project.property(property)
}
group = "com.pusher"
version = "2.4.4"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
ext.sharedManifest = manifest {
attributes(
'Created-By': 'Pusher',
'Implementation-Vendor': 'Pusher',
'Implementation-Title': 'Pusher Java Websocket API Example',
'Implementation-Version': version,
'Package': 'com.pusher.client.example',
'Main-Class': 'com.pusher.client.example.ExampleApp'
)
}
repositories {
mavenCentral()
}
dependencies {
implementation "com.google.code.gson:gson:2.9.1"
implementation "org.java-websocket:Java-WebSocket:1.5.3"
testImplementation "org.mockito:mockito-all:1.8.5"
testImplementation "org.powermock:powermock-module-junit4:1.4.11"
testImplementation "org.powermock:powermock-api-mockito:1.4.11"
testImplementation "com.google.truth:truth:1.0.1"
}
processResources {
filter(ReplaceTokens, tokens: [
version: project.version
])
}
javadoc {
/* info for JavaDoc options http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#overviewcomment */
title "Pusher Java Websocket API"
options.overview = file("src/main/javadoc/overview.html")
// uncomment this to use the custom javadoc styles
//options.stylesheetFile = file("src/main/javadoc/css/styles.css")
exclude "com/pusher/client/channel/impl/*"
exclude "com/pusher/client/connection/impl/*"
exclude "com/pusher/client/connection/websocket/*"
exclude "com/pusher/client/crypto/nacl/*"
exclude "com/pusher/client/util/internal/*"
exclude "org/java_websocket/*"
exclude "com/pusher/client/example/*"
options.linkSource = true
}
jar {
manifest = project.manifest {
from sharedManifest
}
}
task fatJar(type: Jar, dependsOn: configurations.runtimeClasspath) {
manifest = project.manifest {
from sharedManifest
}
archiveBaseName.set(project.name + '-with-dependencies')
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
archiveClassifier.set('jar-with-dependencies')
}
assemble.dependsOn fatJar
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
assemble.dependsOn sourcesJar
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
assemble.dependsOn javadocJar
githubPages {
repoUri = 'https://github.com/pusher/pusher-websocket-java.git'
pages {
from javadoc.outputs.files
}
commitMessage = "JavaDoc gh-pages for ${version}"
credentials {
username = { getProperty("github.username") }
password = { getProperty("github.password") }
}
}
artifacts {
archives jar, fatJar, sourcesJar, javadocJar
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'pusher-java-client'
from components.java
pom {
name = 'Pusher Java Client Library'
packaging = 'jar'
artifactId = 'pusher-java-client'
description = 'This is a Java client library for Pusher, targeted at core Java and Android.'
url = 'http://github.com/pusher/pusher-websocket-java'
scm {
connection = 'scm:git:[email protected]:pusher/pusher-websocket-java'
developerConnection = 'scm:git:[email protected]:pusher/pusher-websocket-java'
url = 'http://github.com/pusher/pusher-websocket-java'
}
licenses {
license {
name = 'MIT'
url = 'https://raw.github.com/pusher/pusher-websocket-java/master/LICENCE.txt'
distribution = 'https://raw.github.com/pusher/pusher-websocket-java/mvn-repo/'
}
}
organization {
name = 'Pusher'
url = 'http://pusher.com'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/pusher/pusher-websocket-java/issues'
}
developers {
developer {
id = 'mike'
name = 'Mike Pye'
email = '[email protected]'
}
}
}
}
}
repositories {
maven {
def releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotRepositoryUrl : releaseRepositoryUrl
credentials {
username = findProperty("maven.username") ?: ""
password = findProperty("maven.password") ?: ""
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
jacoco {
toolVersion = "0.8.8"
}
jacocoTestReport {
reports.xml.required = true
reports.html.required = false
reports.csv.required = false
}
// Test Logging - https://stackoverflow.com/a/42425815/2623314
test {
testLogging {
showStandardStreams = true
}
}