-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
137 lines (104 loc) · 2.76 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
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'maven-publish'
}
defaultTasks 'build'
group 'org.hurricanegames'
version '1.3'
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.Files
Path projectDirectoryPath = projectDir.toPath().toAbsolutePath()
sourceCompatibility = JavaVersion.VERSION_16
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['resources']
}
}
}
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/public/'
}
maven {
url 'https://papermc.io/repo/repository/maven-public/'
}
maven {
url 'https://repo.dmulloy2.net/nexus/repository/public/'
}
maven {
url 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
maven {
url 'https://jitpack.io'
}
}
configurations {
runtimeDependencies
compileOnly {
extendsFrom runtimeDependencies
}
testImplementation {
extendsFrom runtimeDependencies
}
}
dependencies {
runtimeDependencies group: 'io.papermc.paper', name: 'paper-api', version: '1.17.1-R0.1-SNAPSHOT'
runtimeDependencies group: 'me.clip', name: 'placeholderapi', version: '2.10.4'
runtimeDependencies group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '4.7.0'
runtimeDependencies group: 'com.github.ProtocolSupport', name: 'ProtocolSupport', version: 'a82f2b4627'
implementation group: 'com.github.HurricaneGamesOrg', name: 'HurricaneGamesOrgPluginLib', version: '997fc2eb6b'
}
compileJava {
options.encoding = 'UTF-8'
options.incremental = false
}
processResources {
filesMatching('plugin.yml') {
expand 'version': project.version
}
}
shadowJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveClassifier = ""
from sourceSets.main.java.srcDirs
from 'LICENSE'
exclude 'META-INF/**'
exclude 'module-info.class'
String relocatePrefix = group + '.' + rootProject.name.toLowerCase() + '.zlibs.'
relocate 'org.hurricanegames.commandlib', relocatePrefix + 'org.hurricanegames.commandlib'
minimize()
}
task copyFinalJarToTarget(type: DefaultTask) {doLast{
Path targetJarDirectory = projectDirectoryPath.resolve('target')
Files.createDirectories(targetJarDirectory)
Files.copy(
shadowJar.archiveFile.get().getAsFile().toPath().toAbsolutePath(),
targetJarDirectory.resolve(shadowJar.archiveBaseName.get() + '.jar'),
java.nio.file.StandardCopyOption.REPLACE_EXISTING
)
}}
compileJava.dependsOn(clean)
jar.enabled = false
jar.finalizedBy(shadowJar)
shadowJar.finalizedBy(copyFinalJarToTarget)
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
publishing {
publications {
release(MavenPublication) {
from components.java
artifacts = [shadowJar]
}
}
}