forked from iBlitzkriegi/Vixio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
197 lines (153 loc) · 5.29 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
plugins {
id "com.github.johnrengelman.shadow" version "1.2.4"
id 'com.github.ben-manes.versions' version '0.13.0'
id "de.undercouch.download" version "3.1.2"
id 'java'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
name 'spigot-repo'
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven{
url 'http://maven.sedmelluq.com'
}
}
import org.apache.tools.ant.filters.ReplaceTokens
group = project.property("groupId")
version = project.property("version")
sourceCompatibility = project.property("sourceversion")
configurations {
plugins {
description = 'dependencies that need to be present for compilation and on the server, but not in it\'s classpath'
transitive = true
}
providedServer {
description = 'dependencies that need to be present for compilation and on the server'
transitive = true
}
provided {
description = 'dependencies that only need to be present for compilation'
transitive = true
extendsFrom providedServer
extendsFrom plugins
}
compileOnly.extendsFrom provided
serverOnly {
description = 'dependencies that only need to be present for on the server'
transitive = true
extendsFrom providedServer
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
dependencies {
// Spigot API
provided group: 'org.spigotmc', name: 'spigot-api', version: project.property("apiversion")
// Spigot server
serverOnly group: 'org.spigotmc', name: 'spigot', version: project.property("apiversion")
// Bukkit
providedServer group: 'org.bukkit', name: 'bukkit', version: project.property("apiversion")
// Craftbukkit
providedServer group: 'org.bukkit', name: 'craftbukkit', version: project.property("apiversion")
// JDA
compile 'net.dv8tion:JDA:3.3.0_265'
// Provided local jars
provided fileTree(dir: 'libs/provided', include: '*.jar')
// Other plugins this depends on
plugins fileTree(dir: 'libs/plugins', include: '*.jar')
// Jars to include in that shaded jar
compile fileTree(dir: 'libs/compile', include: '*.jar')
compile 'com.sedmelluq:lavaplayer:1.2.43'
compile 'ca.pjer:chatter-bot-api:2.0.1'
compile 'com.vdurmont:emoji-java:3.1.3'
}
shadowJar {
classifier = ''
relocate 'org.apache.commons.lang3', project.group + ".org.apache.commons.lang3"
relocate 'org.apache.http', project.group + ".org.apache.http"
relocate 'org.apache.commons.io', project.group + ".org.apache.commons.io"
destinationDir = new File("C:\\Users\\matthew\\Desktop\\VixioSk\\plugins")
}
processResources {
from ('src/main/java') {
include 'plugin.yml'
}
filter ReplaceTokens, tokens: [
"apiversion": project.property("apiversion"),
"name" : project.property("name"),
"mainClass" : project.property("mainClass"),
"version" : project.property("version")
]
}
clean {
delete "final/"
delete "testserver/"
}
compileJava.dependsOn {
buildSpigot
}
jar {
actions = []
dependsOn = []
dependsOn('shadowJar')
}
task setupDevServer(dependsOn: 'extractServerJar', type: Copy) {
from 'config/serverfiles'
into 'testserver'
}
task extractServerJar(type: Copy) {
}
task copyPluginsToTestserver(dependsOn: ['build'], type: Copy) {
from "${buildDir}/libs"
from "/libs/plugins"
into "testserver/plugins"
}
task prepareDevServer(dependsOn: ['buildSpigot', 'setupDevServer', 'copyPluginsToTestserver']) {}
task startDevServer(dependsOn: [prepareDevServer], type: JavaExec) {
classpath configurations.serverOnly
main = "org.bukkit.craftbukkit.Main"
workingDir = "testserver/"
standardInput = System.in
}
// START Building Spigot and Bukkit
def spigotBuildDir = new File("$buildDir/spigot/")
task setupWorkspace(dependsOn: ['buildSpigot']) {}
task buildSpigot(type: Exec) {
if (hasSpigot()) {
enabled = false;
} else {
dependsOn 'cleanSpigotBuild', 'downloadBuildTools'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine "where git".execute().text.trim().replace('cmd\\git.exe', 'bin\\sh.exe'), '-login', '-c', "java -jar BuildTools.jar --rev " + project.property("apibuildtoolversion")
} else {
commandLine "java -jar BuildTools.jar --rev " + project.property("apibuildtoolversion")
}
workingDir = spigotBuildDir
}
}
task downloadBuildTools(type: de.undercouch.gradle.tasks.download.Download) {
spigotBuildDir.mkdirs()
src project.property("buildtoolurl")
dest new File(spigotBuildDir, "BuildTools.jar")
}
task cleanSpigotBuild() {
doLast {
spigotBuildDir.deleteDir()
}
}
def hasSpigot() {
def groupId = "org.spigotmc"
def version = project.property("apiversion")
return hasArtifact(groupId, "spigot-api", version) && hasArtifact(groupId, "spigot", version)
}
def hasArtifact(groupId, artifactId, version) {
def localMavenRepo = new File(new File(ant.properties['user.home'] as String), ".m2/repository/")
def file = new File(localMavenRepo, groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/")
return file.exists()
}
wrapper {
gradleVersion = '3.2.1'
}