This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 158
/
build.gradle
163 lines (142 loc) · 4.96 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
allprojects {
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'idea'
group = 'be.isach'
version = '2.8-DEV-b5'
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
java {
toolchain {
// minimum Java version to compile all subprojects
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
shaded
compile.extendsFrom shaded
}
processResources {
inputs.property("version", project.version)
filter org.apache.tools.ant.filters.ReplaceTokens, tokens: [
'VERSION': project.version
]
}
afterEvaluate {
jar {
dependsOn configurations.shaded
from configurations.shaded.collect {
it.isDirectory() ?
it :
zipTree(it)
}
}
}
}
defaultTasks 'obfuscate'
subprojects.each {
if (!it.hasProperty("remapMcVersion")) return
tasks.register("obf" + it.name, VersionedObfTask, it)
}
dependencies {
subprojects.each { p ->
if (p.name.equals("core")) {
shaded(project(path: ':core', configuration: 'shadow'))
return;
}
shaded(p) {
transitive false
}
}
}
subprojects { subproj ->
repositories {
mavenLocal()
mavenCentral()
// Lib's Disguises
maven {
url 'https://repo.md-5.net/content/groups/public/'
}
// WorldEdit
maven {
url 'https://repo.aikar.co/nexus/content/groups/aikar'
}
// BungeeCord
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
// PlaceholderAPI
maven {
url 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
// PlayerPoints
maven {
url 'https://repo.rosewooddev.io/repository/public/'
}
// Spigot
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
// WorldGuard
maven {
url "https://maven.enginehub.org/repo/"
}
// Vault
maven {
url 'https://jitpack.io'
}
// Mojang Authlib
maven {
url 'https://libraries.minecraft.net'
}
}
def version = 8
if (subproj.hasProperty("javaVersion")) {
version = subproj.property("javaVersion")
}
subproj.tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(version)
}
}
}
abstract class VersionedObfTask extends DefaultTask {
private Project subproj;
@Inject
public VersionedObfTask(Project subproj) {
this.subproj = subproj
dependsOn 'jar'
description 'Generates an obfuscated version of the jar for use with Spigot.'
group = 'jar preparation'
ext.toolingDir = System.getProperty("user.dir")
ext.homeDir = project.gradle.gradleUserHomeDir.parent
}
@TaskAction
def go() {
def nms = subproj.name
def mcVer = subproj.getProperty("remapMcVersion")
project.exec {
workingDir project.buildDir
commandLine 'java', '-cp', ext.toolingDir + '/tooling/specialsource/SpecialSource.jar' + File.pathSeparator + ext.homeDir + "/.m2/repository/org/spigotmc/spigot/$mcVer-R0.1-SNAPSHOT/spigot-$mcVer-R0.1-SNAPSHOT-remapped-mojang.jar",
'net.md_5.specialsource.SpecialSource', '--live', '--only', "be/isach/ultracosmetics/$nms", '-q',
'-i', 'libs/' + project.name + '-' + project.version + '.jar',
'-o', 'libs/obfuscated-donotuse-' + project.name + '-' + project.version + '.jar',
'-m', ext.homeDir + "/.m2/repository/org/spigotmc/minecraft-server/$mcVer-R0.1-SNAPSHOT/minecraft-server-$mcVer-R0.1-SNAPSHOT-maps-mojang.txt",
'--reverse'
}
project.exec {
workingDir project.buildDir
commandLine 'java', '-cp', ext.toolingDir + '/tooling/specialsource/SpecialSource.jar' + File.pathSeparator + ext.homeDir + "/.m2/repository/org/spigotmc/spigot/$mcVer-R0.1-SNAPSHOT/spigot-$mcVer-R0.1-SNAPSHOT-remapped-obf.jar",
'net.md_5.specialsource.SpecialSource', '--live', '--only', "be/isach/ultracosmetics/$nms", '-q',
'-i', 'libs/obfuscated-donotuse-' + project.name + '-' + project.version + '.jar',
'-o', 'libs/' + project.name + '-' + project.version + '.jar',
'-m', ext.homeDir + "/.m2/repository/org/spigotmc/minecraft-server/$mcVer-R0.1-SNAPSHOT/minecraft-server-$mcVer-R0.1-SNAPSHOT-maps-spigot.csrg"
}
}
}
tasks.register("obfuscate") {
dependsOn tasks.withType(VersionedObfTask)
group = 'jar preparation'
}