71 lines
3.3 KiB
Groovy
71 lines
3.3 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
configurations.create('specialSource')
|
|
|
|
dependencies {
|
|
specialSource 'net.md-5:SpecialSource:1.11.0:shaded'
|
|
}
|
|
}
|
|
|
|
// Spigot server code remapping: https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/
|
|
// These dependencies and mappings are installed into the local Maven repository when BuildTools builds the Spigot dependencies.
|
|
def m2Repo = new File(repositories.mavenLocal().url.path)
|
|
def remappedMojang = new File(m2Repo, 'org/spigotmc/spigot/{spigotVersion}/spigot-{spigotVersion}-remapped-mojang.jar').path
|
|
def remappedObf = new File(m2Repo, 'org/spigotmc/spigot/{spigotVersion}/spigot-{spigotVersion}-remapped-obf.jar').path
|
|
def mojangMappings = new File(m2Repo, 'org/spigotmc/minecraft-server/{spigotVersion}/minecraft-server-{spigotVersion}-maps-mojang.txt').path
|
|
def spigotMappings = new File(m2Repo, 'org/spigotmc/minecraft-server/{spigotVersion}/minecraft-server-{spigotVersion}-maps-spigot.csrg').path
|
|
|
|
def specialSource = buildscript.configurations.specialSource.resolvedConfiguration.getFirstLevelModuleDependencies {
|
|
it.group == 'net.md-5' && it.name == 'SpecialSource'
|
|
}.first().moduleArtifacts.first().file.path
|
|
|
|
// Converts from Mojang's mappings to Minecraft's obfuscated mappings.
|
|
ext.remapMojangToObfuscated = { inputFile, outputFile, spigotVersion ->
|
|
println '> remapMojangToObfuscated'
|
|
println ' Input: ' + inputFile.path
|
|
println ' Output: ' + outputFile.path
|
|
println ' Spigot version: ' + spigotVersion
|
|
def classpathSeparator = System.properties['path.separator']
|
|
exec {
|
|
commandLine 'java',
|
|
'-cp', "${specialSource}${classpathSeparator}${remappedMojang}".replace('{spigotVersion}', spigotVersion),
|
|
'net.md_5.specialsource.SpecialSource',
|
|
'--live',
|
|
'-i', inputFile.path,
|
|
'-o', outputFile.path,
|
|
'-m', mojangMappings.replace('{spigotVersion}', spigotVersion),
|
|
'--reverse'
|
|
}
|
|
}
|
|
|
|
// Converts from Minecraft's obfuscated mappings to Spigot's mappings.
|
|
ext.remapObfuscatedToSpigot = { inputFile, outputFile, spigotVersion ->
|
|
println '> remapObfuscatedToSpigot'
|
|
println ' Input: ' + inputFile.path
|
|
println ' Output: ' + outputFile.path
|
|
println ' Spigot version: ' + spigotVersion
|
|
def classpathSeparator = System.properties['path.separator']
|
|
exec {
|
|
commandLine 'java',
|
|
'-cp', "${specialSource}${classpathSeparator}${remappedObf}".replace('{spigotVersion}', spigotVersion),
|
|
'net.md_5.specialsource.SpecialSource',
|
|
'--live',
|
|
'-i', inputFile.path,
|
|
'-o', outputFile.path,
|
|
'-m', spigotMappings.replace('{spigotVersion}', spigotVersion)
|
|
}
|
|
}
|
|
|
|
// Converts from Mojang's mappings to Spigot's mappings.
|
|
ext.remapMojangToSpigot = { inputFile, intermediateFile, outputFile, spigotVersion ->
|
|
println '> remapMojangToSpigot'
|
|
println ' Input: ' + inputFile.path
|
|
println ' Intermediate: ' + intermediateFile.path
|
|
println ' Output: ' + outputFile.path
|
|
println ' Spigot version: ' + spigotVersion
|
|
remapMojangToObfuscated(inputFile, intermediateFile, spigotVersion)
|
|
remapObfuscatedToSpigot(intermediateFile, outputFile, spigotVersion)
|
|
} |