-
Notifications
You must be signed in to change notification settings - Fork 51
/
build.gradle
179 lines (143 loc) · 4.79 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
buildscript {
ext {
grgitVersion = '2.2.1'
sonarqubeVersion = '2.6.2'
}
repositories {
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
}
dependencies {
classpath "org.ajoberstar:grgit:${grgitVersion}"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${sonarqubeVersion}"
}
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.ajoberstar.grgit'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'
group = 'com.fredboat.lavalink.client'
version = "${versionFromTag()}"
description = 'JDA based client for the Lavalink-Server'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
ext {
//@formatter:off
gradleVersion = '7.4.2'
lavaplayerVersion = '1.3.71'
javaWebSocketVersion = '1.5.1'
slf4jVersion = '1.7.25'
jsonOrgVersion = '20180130'
jdaVersion = '4.1.1_135'
spotbugsAnnotationsVersion = '3.1.3'
prometheusVersion = '0.4.0'
junitJupiterVersion = '5.2.0'
junitPlatformVersion = '1.2.0'
logbackVersion = '1.2.3'
unirestVersion = '1.4.9'
//@formatter:on
}
dependencies {
api group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion
api group: 'org.java-websocket', name: 'Java-WebSocket', version: javaWebSocketVersion
api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
api group: 'org.json', name: 'json', version: jsonOrgVersion
compileOnly group: 'net.dv8tion', name: 'JDA', version: jdaVersion
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: spotbugsAnnotationsVersion
compileOnly group: 'io.prometheus', name: 'simpleclient', version: prometheusVersion
testImplementation group: 'net.dv8tion', name: 'JDA', version: jdaVersion
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitJupiterVersion
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: junitPlatformVersion
testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: junitPlatformVersion
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
testImplementation group: 'com.mashape.unirest', name: 'unirest-java', version: unirestVersion
}
compileJava {
dependsOn(clean)
options.encoding = 'UTF-8'
compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
wrapper {
gradleVersion = project.ext.gradleVersion
//noinspection UnnecessaryQualifiedReference
distributionType = Wrapper.DistributionType.ALL
}
build {
doLast {
println 'Version: ' + version
}
}
test {
useJUnitPlatform()
systemProperty("TEST_TOKEN", System.getProperty("TEST_TOKEN"))
systemProperty("TEST_VOICE_CHANNEL", System.getProperty("TEST_VOICE_CHANNEL"))
jacoco {
includes['lavalink.client.*']
}
}
sonarqube {
properties {
property "sonar.inclusions", "src/main/java/**/*"
}
}
jar.mustRunAfter clean
publishToMavenLocal.dependsOn jar
// called by jitpack
task install {
dependsOn test
dependsOn publishToMavenLocal
doLast {
println 'Version: ' + version
}
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
groupId project.group
artifactId project.name
version project.version
pom {
name = project.name
description = project.description
url = 'https://github.com/FredBoat/Lavalink-Client'
licenses {
license {
name = 'MIT'
url = 'https://choosealicense.com/licenses/mit/'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/FredBoat/Lavalink-Client'
}
}
}
}
}
@SuppressWarnings("GrMethodMayBeStatic")
String versionFromTag() {
def headTag = grgit.tag.list().find {
it.commit == grgit.head()
}
def clean = grgit.status().clean //uncommitted changes? -> should be SNAPSHOT
if (headTag && clean) {
headTag.getName()
} else {
"${grgit.head().id}-SNAPSHOT"
}
}