This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
build.gradle
240 lines (202 loc) · 8.04 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
// Gradle plugins
buildscript {
repositories {
maven {
name = 'gradle-plugins'
url = 'https://plugins.gradle.org/m2'
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven'
}
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
}
dependencies {
classpath('net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT') {
// The gradle Kotlin plugin depends on Intellij's custom fork
// of GNU Trove, which it doesn't relocate.
// Therefore, we need to remove any other version of Trove
// from the classpath, to ensure that 'gnu.trove.*' always
// resolves to Intellij's version of Trove at runtime
// See https://youtrack.jetbrains.com/issue/IDEA-211616
exclude group: 'trove', module: 'trove'
exclude group: 'net.sf.trove4j', module: 'trove4j'
}
classpath 'gradle.plugin.net.minecrell:licenser:0.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
classpath 'org.spongepowered:spongegradle:0.8.2-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
classpath 'de.sebastianboegl.gradle.plugins:shadow-log4j-transformer:1.0.1'
}
}
// MC Tester stuff, not actually used yet
// TODO - get MCTester working on SV
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.30'
}
// ForgeGradle tries to pull in typesafe config 1.2.1,
// which causes issues when running Sponge from Intellij.
// We force Gradle to use 1.3.1, which resolves the issue
configurations.all {
resolutionStrategy {
force 'com.typesafe:config:1.3.1'
// Force McTester to use our local SpongeAPI
dependencySubstitution {
substitute(module("org.spongepowered:spongeapi")).with(project(":SpongeCommon:SpongeAPI"))
}
}
}
ext.implementationId = "spongevanilla"
// Apply shared implementation Gradle config
apply from: project(':SpongeCommon').file('gradle/implementation.gradle')
apply plugin: 'de.sebastianboegl.shadow.transformer.log4j'
version = "$minecraft.version-$implementationVersion"
minecraft {
tweakClass = 'org.spongepowered.server.launch.VanillaServerTweaker'
atSource sourceSets.main
}
configurations {
// While we could set this to 'runtime', Eclipse doesn't support runtime dependencies
// properly so this was always going before 'compile' in Eclipse
shadow
log4j
}
configurations.forgeGradleMcDeps {
transitive = false
}
dependencies {
compile 'org.ow2.asm:asm-debug-all:5.2'
compile 'net.sf.jopt-simple:jopt-simple:5.0.4'
compile 'org.apache.logging.log4j:log4j-iostreams:2.8.1'
runtime 'com.lmax:disruptor:3.4.2' // Async Logging
compile 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
// Terminal console
compile 'net.minecrell:terminalconsoleappender:1.2.0'
runtime 'org.jline:jline-terminal-jansi:3.12.1'
// log4j 2.15 to avoid nasty exploit
runtime 'org.apache.logging.log4j:log4j-api:2.17.1'
runtime 'org.apache.logging.log4j:log4j-core:2.17.1'
shadow 'org.ow2.asm:asm-all:5.2'
log4j('org.apache.logging.log4j:log4j-core:2.8.1') {
transitive = false
}
}
// Set main class and classpath for Minecraft server and Launchwrapper
jar {
manifest {
attributes(
'Main-Class': 'org.spongepowered.server.launch.VersionCheckingMain',
'Class-Path': 'minecraft_server.1.12.2.jar libraries/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar'
)
}
}
// Reobfuscate to SRG mappings
reobf.jar.mappingType = 'SEARGE'
task('buildCompactMappings', type: org.spongepowered.gradle.cmap.BuildCompactMappingsTask, dependsOn: ['extractMcpMappings', 'splitServerJar']) {
minecraftJar = plugins[forgeGradlePlugin].delayedFile(net.minecraftforge.gradle.common.Constants.JAR_SERVER_PURE)
srg = plugins[forgeGradlePlugin].delayedFile(net.minecraftforge.gradle.common.Constants.MCP_DATA_SRG)
output = new File(temporaryDir, "mappings.cmap")
}
shadowJar {
// Exclude development Log4j configuration
exclude 'log4j2-test.xml'
configurations += [project.configurations.shadow]
from tasks.buildCompactMappings
from({zipTree(project.configurations.log4j.resolve().first())}) {
include 'META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat'
}
dependencies {
include dependency('net.sf.jopt-simple:jopt-simple')
include dependency('org.ow2.asm:asm-all')
include dependency('com.typesafe:config')
include dependency('org.apache.logging.log4j:log4j-iostreams')
include dependency('com.lmax:disruptor')
include dependency('net.minecrell:terminalconsoleappender')
include dependency('org.jline:jline-terminal')
include dependency('org.jline:jline-terminal-jansi')
include dependency('org.jline:jline-reader')
include dependency('org.fusesource.jansi:jansi')
include dependency('org.apache.logging.log4j:log4j-api:2.17.1')
include dependency('org.apache.logging.log4j:log4j-core:2.17.1')
include dependency('com.eclipsesource.minimal-json:minimal-json')
}
}
test {
systemProperty 'lwts.tweaker', 'org.spongepowered.server.launch.TestTweaker'
}
license {
exclude 'net/minecraftforge/**'
}
// MCTester stuffs:
// TODO - add MCTester tests for SV since SF has a few that test against Forge implementation
// would be nice to have them centralized in Common, but we can't all be perfect...
//dependencies {
// testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
// testCompile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.23.4"
// testCompile "org.jetbrains.kotlin:kotlin-reflect:1.3.0"
// testCompile "org.apache.logging.log4j:log4j-core:2.8.1"
//}
//
//compileKotlin {
// kotlinOptions.jvmTarget = "1.8"
//}
//compileTestKotlin {
// kotlinOptions.jvmTarget = "1.8"
//}
//
//license.include '**/*.kt'
//
//// Based on https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-integration-testing/
//
//sourceSets {
// integrationTest {
// java {
// // This is a terrible hack to get McTester to work in development
// // We want to include the following:
// // * Dependencies from the 'test' sourceset
// // * Deobfuscated (dev jar) classes
// //
// // We do NOT want to include:
// // * Reobfuscated classess
// //
// // To that end, we explicitly include the output of 'shadowDevJar' and 'test.compileClasspath',
// // while exlucding the outputs of the SpongeCommon and SpongeForge regular (obfuscated) jars
//
// // Eventually, this should no longer be necessary once McTester supports obfuscated Sponge jars
// // For the time being, we're stuck with this
// def newFiles = (tasks.shadowDevJar.outputs.files + ((sourceSets.test.compileClasspath - tasks.jar.outputs.files))) - project(":SpongeCommon").tasks.jar.outputs.files
//
// compileClasspath += newFiles
// runtimeClasspath += newFiles
//
// srcDirs += file('src/integration-test/java')
// }
// kotlin {
// srcDirs += file('src/integration-test/kotlin')
// }
// resources.srcDir file('src/integration-test/resources')
// }
//}
//
//
//task runMcTester(type: Test) {
// testClassesDir = sourceSets.integrationTest.output.classesDir
// classpath = sourceSets.integrationTest.runtimeClasspath
// outputs.upToDateWhen { false }
//}
//
//
//compileIntegrationTestKotlin {
// kotlinOptions.jvmTarget = "1.8"
//}
//
//tasks.withType(JavaCompile) {
// options.incremental = false
//}
// Unfortunately, Mixin's annotation processor requires that SpongeCommon
// is compiled, in order for SpongeForge's references to SpongeCommon
// to be resolved by the AP. See https://github.com/SpongePowered/Mixin/issues/320
project(":SpongeCommon").tasks.compileJava.outputs.upToDateWhen { false }