-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
230 lines (193 loc) · 6.12 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
/*
* Copyright 2015-2016 Austin Keener & Michael Ritter
*
* 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.
*/
//to build everything: "gradlew build"
//to build and upload everything: "gradlew bintrayUpload"
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'com.jfrog.bintray' version '1.7.3'
id 'java'
id 'maven'
id 'maven-publish'
id 'signing'
id 'com.github.ben-manes.versions' version '0.15.0'
id 'com.github.johnrengelman.shadow' version '2.0.1'
}
def versionObj = new Version(major: 1, minor: 0, revision: 0)
group = "net.dv8tion"
archivesBaseName = "JDA"
version = "$versionObj"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
}
sourceSets {
examples {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
dependencies {
//General Utility
compile 'org.apache.commons:commons-lang3:3.6'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'org.json:json:20160810'
compile 'net.sf.trove4j:trove4j:3.0.3'
//Native Library Support
compile 'net.java.dev.jna:jna:4.4.0'
//Web Connection Support
compile 'com.neovisionaries:nv-websocket-client:2.3'
compile ( 'com.mashape.unirest:unirest-java:1.4.9' ) {
exclude group: 'junit', module: 'junit'
}
compile 'com.sedmelluq:lavaplayer:1.2.42'
//Sets the dependencies for the examples
examplesCompile configurations.compile
examplesRuntime configurations.runtime
}
task sourcesForRelease(type: Copy) {
from 'src/main/java'
into 'build/filteredSrc'
filter(ReplaceTokens, tokens: [
versionMajor: versionObj.major.toString(),
versionMinor: versionObj.minor.toString(),
versionRevision: versionObj.revision.toString(),
versionBuild: versionObj.build.toString()
])
}
compileJava {
source = sourcesForRelease.destinationDir
classpath = sourceSets.main.compileClasspath
options.encoding = 'UTF-8'
dependsOn sourcesForRelease
}
jar {
baseName = project.name
manifest {
attributes 'Implementation-Version': version
}
}
shadowJar {
classifier = "withDependencies"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from "${buildDir}/filteredSrc"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
javadoc {
failOnError = false
options.memberLevel = JavadocMemberLevel.PUBLIC
//### excludes ###
//jda internals
exclude("net/dv8tion/jda/bot/entities/impl")
exclude("net/dv8tion/jda/bot/handle")
exclude("net/dv8tion/jda/bot/managers/impl")
exclude("net/dv8tion/jda/client/entities/impl")
exclude("net/dv8tion/jda/client/handle")
exclude("net/dv8tion/jda/client/managers/impl")
exclude("net/dv8tion/jda/core/audio/AudioConnection.java",
"net/dv8tion/jda/core/audio/AudioWebSocket.java",
"net/dv8tion/jda/core/audio/AudioPacket.java",
"net/dv8tion/jda/core/audio/Decoder.java",
"net/dv8tion/jda/core/audio/hooks/ListenerProxy.java")
exclude("net/dv8tion/jda/core/entities/impl")
exclude("net/dv8tion/jda/core/handle")
exclude("net/dv8tion/jda/core/managers/impl")
exclude("net/dv8tion/jda/core/requests/GuildLock.java",
"net/dv8tion/jda/core/requests/WebSocketClient.java",
"net/dv8tion/jda/core/requests/RateLimiter.java",
"net/dv8tion/jda/core/requests/Request.java",
"net/dv8tion/jda/core/requests/Route.java",
"net/dv8tion/jda/core/requests/Requester.java",
"net/dv8tion/jda/core/requests/Response.java",
"net/dv8tion/jda/core/requests/ratelimit",
"net/dv8tion/jda/core/requests/restaction/CompletedFuture.java",
"net/dv8tion/jda/core/requests/restaction/RequestFuture.java")
//opuswrapper
exclude("tomp2p/opuswrapper")
//voice crypto
exclude("com/iwebpp/crypto")
}
bintray {
user = getProjectProperty('bintrayUsername')
key = getProjectProperty('bintrayApiKey')
publications = ["BintrayRelease"]
pkg {
repo = 'maven'
name = 'JDA-Audio'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/DV8FromTheWorld/JDA.git'
publish = true
version {
name = project.version
released = new Date()
}
}
}
publishing {
publications {
BintrayRelease(MavenPublication) {
from components.java
groupId group
artifactId archivesBaseName
version version
artifact javadocJar
artifact sourcesJar
}
}
}
String getProjectProperty(String propertyName)
{
String property = ""
if (hasProperty(propertyName))
{
property = this.properties[propertyName]
}
return property
}
task wrapper(type: Wrapper) {
gradleVersion = '4.0.1'
}
build {
dependsOn clean
dependsOn jar
dependsOn javadocJar
dependsOn sourcesJar
dependsOn shadowJar
jar.mustRunAfter clean
javadocJar.mustRunAfter jar
sourcesJar.mustRunAfter javadocJar
shadowJar.mustRunAfter sourcesJar
}
bintrayUpload {
dependsOn build
onlyIf { !getProjectProperty("bintrayUsername").empty }
onlyIf { !getProjectProperty("bintrayApiKey").empty }
onlyIf { System.getenv("BUILD_NUMBER") }
}
class Version {
String major, minor, revision
String getBuild() {
System.getenv("BUILD_NUMBER") ?: System.getProperty("BUILD_NUMBER") ?: "DEV"
}
String toString() {
"${major}.${minor}.${revision}_$build"
}
}