-
Notifications
You must be signed in to change notification settings - Fork 31
/
build.gradle
111 lines (83 loc) · 2.3 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
buildscript {
repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
dependencies {
classpath group: 'com.github.HurricaneGamesOrg', name: 'ManualGradleDependencySupplier', version: '1e9e953fb4'
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'java'
}
apply plugin: 'org.hurricanegames.ManualGradleDependencySupplier'
defaultTasks 'build'
group 'protocolsupport'
version '1.16.3-1'
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.Files
import org.hurricanegames.manualgradledependencysupplier.DependencySupplier
import org.hurricanegames.manualgradledependencysupplier.DownloadDependencySupplier
import org.hurricanegames.manualgradledependencysupplier.ManualGradleDependencySupplier
Path projectDirectoryPath = projectDir.toPath().toAbsolutePath()
sourceCompatibility = JavaVersion.VERSION_1_8
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['resources']
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
compile group: 'it.unimi.dsi', name: 'fastutil', version: '8.2.2'
compileOnly ManualGradleDependencySupplier.supplyDependecies(
projectDirectoryPath.resolve('libraries_runtime'),
[
new DownloadDependencySupplier(
'bungeecord-1.16.4-1.jar',
new URL('https://papermc.io/api/v1/travertine/1.16/163/download')
)
],
true
)
}
compileJava {
doFirst {
classpath -= configurations.compileOnly
classpath += configurations.compileOnly
}
options.encoding = 'UTF-8'
options.incremental = false
}
shadowJar {
from sourceSets.main.java.srcDirs
from 'LICENSE'
archiveName = jar.archiveName
exclude 'META-INF/**'
relocate 'org.apache', 'protocolsupport.libs.org.apache'
relocate 'it.unimi.dsi.fastutil', 'protocolsupport.libs.it.unimi.dsi.fastutil'
minimize()
}
task copyFinalJarToTarget(type: DefaultTask) {doLast{
Path targetJarDirectory = projectDirectoryPath.resolve("target")
Files.createDirectories(targetJarDirectory)
Files.copy(
shadowJar.archivePath.toPath().toAbsolutePath(),
targetJarDirectory.resolve(shadowJar.baseName + '.jar'),
java.nio.file.StandardCopyOption.REPLACE_EXISTING
)
}}
jar.enabled = false
jar.finalizedBy(shadowJar)
shadowJar.finalizedBy(copyFinalJarToTarget)