-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbuild.gradle
More file actions
165 lines (134 loc) · 3.68 KB
/
build.gradle
File metadata and controls
165 lines (134 loc) · 3.68 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
import de.undercouch.gradle.tasks.download.Download
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: 'com.github.rodionmoiseev.gradle.plugins', name: 'idea-utils', version: '0.2'
}
}
plugins {
id "de.undercouch.download" version "4.0.2"
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
group = project.property("group")
version = project.property("version")
sourceCompatibility = project.property("sourceversion")
targetCompatibility = project.property("sourceversion")
jar
{
eachFile
{
copyDetails ->
if (copyDetails.path == 'plugin.yml')
{
filter
{
line -> line.replace('{{version}}', "$version")
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
repositories
{
mavenLocal()
mavenCentral()
maven
{
url('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
}
maven
{
url('https://oss.sonatype.org/content/repositories/snapshots')
}
}
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/jacoco")
}
jacocoTestReport
{
reports
{
xml.enabled = true
html.enabled = true
}
}
build.dependsOn jar
dependencies
{
compileOnly'org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT'
testCompile 'junit:junit:4.12'
testCompile 'com.github.seeseemelk:MockBukkit-v1.14:0.2.1'
}
task deploy(type: Copy, dependsOn: ['build']) {
from "${buildDir}/libs"
into "final/"
}
task setupDevServer(dependsOn: 'extractServerJar', type: Copy) {
from 'config/serverfiles'
into 'testserver'
}
task copyPluginToTestserver(dependsOn: ['build', 'jar'], type: Copy) {
from "${buildDir}/libs"
include "*.jar"
into "testserver/plugins"
}
task prepareDevServer(dependsOn: ['buildSpigot', 'setupDevServer', 'copyPluginToTestserver']) {}
task startDevServer(dependsOn: [prepareDevServer], type: JavaExec) {
classpath configurations.compile, configurations.runtime
main = "-jar"
args "server.jar"
workingDir = "testserver/"
standardInput = System.in
}
// START Building Spigot and Bukkit
def spigotBuildDir = new File("$buildDir/spigot/")
task extractServerJar(type: Copy) {
from spigotBuildDir
into "testserver/"
include "spigot-" + project.property("apibuildtoolversion") + ".jar"
rename "spigot-" + project.property("apibuildtoolversion") + ".jar", "server.jar"
}
task setupWorkspace(dependsOn: ['buildSpigot']) {
}
task buildSpigot(type: Exec) {
if (hasSpigotJar())
{
enabled = false
dependsOn = []
} else {
dependsOn = ['downloadBuildTool']
}
// Determine the current OS.
def os_name = System.getProperty("os.name").toLowerCase()
def os_windows = os_name.contains("windows")
def os_linux = os_name.contains("linux")
workingDir = spigotBuildDir
if (os_windows)
{
executable = 'C:\\Program Files\\Git\\bin\\bash.exe'
}else if(os_linux)
{
executable = 'bash'
}
args = ['-c', 'java -jar ./BuildTools.jar --rev ' + project.property("apibuildtoolversion") ]
}
task downloadBuildTool(type: Download) {
spigotBuildDir.mkdirs()
src project.property("buildtoolurl")
dest new File(spigotBuildDir, "BuildTools.jar")
}
def hasSpigotJar() {
def file = new File("$buildDir/spigot/spigot-" + project.property("apibuildtoolversion") + ".jar")
return file.exists()
}