2016-08-17 15:23:28 -04:00
|
|
|
buildscript {
|
2016-10-02 11:58:41 -04:00
|
|
|
repositories {
|
|
|
|
jcenter()
|
2016-10-19 04:58:14 -04:00
|
|
|
maven {
|
2017-11-22 08:56:07 -05:00
|
|
|
name "Modmuss50 Repository"
|
|
|
|
url 'https://maven.modmuss50.me'
|
2016-10-19 04:58:14 -04:00
|
|
|
}
|
2016-10-02 11:58:41 -04:00
|
|
|
}
|
|
|
|
dependencies {
|
2019-04-18 17:22:36 -04:00
|
|
|
classpath "net.fabricmc:weave:0.3.1.17+"
|
2019-05-12 05:18:01 -04:00
|
|
|
classpath "net.fabricmc:stitch:0.1.2.51+"
|
2016-10-02 11:58:41 -04:00
|
|
|
classpath "commons-io:commons-io:1.4"
|
|
|
|
classpath "com.google.guava:guava:19.0"
|
2018-10-27 10:16:43 -04:00
|
|
|
classpath 'de.undercouch:gradle-download-task:3.4.3'
|
|
|
|
classpath 'net.fabricmc:tiny-remapper:+'
|
2016-10-02 11:58:41 -04:00
|
|
|
}
|
2016-08-17 15:23:28 -04:00
|
|
|
}
|
|
|
|
|
2018-12-08 07:32:48 -05:00
|
|
|
plugins {
|
|
|
|
id 'de.undercouch.download' version '3.4.3'
|
|
|
|
id 'maven'
|
|
|
|
id 'maven-publish'
|
|
|
|
}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-06-03 12:48:18 -04:00
|
|
|
def minecraft_version = "1.14.3-pre1"
|
2016-09-09 08:47:32 -04:00
|
|
|
|
|
|
|
def ENV = System.getenv()
|
2018-11-15 11:57:32 -05:00
|
|
|
// Fetch build number from Jenkins
|
|
|
|
def build_number = ENV.BUILD_NUMBER ?: "local"
|
|
|
|
|
2019-04-10 12:20:44 -04:00
|
|
|
def yarnVersion = "${minecraft_version}+build.$build_number"
|
2016-09-09 08:47:32 -04:00
|
|
|
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-12-08 07:32:48 -05:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven {
|
|
|
|
name "Modmuss50 Repository"
|
|
|
|
url 'https://maven.modmuss50.me'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
enigmaRuntime {
|
|
|
|
resolutionStrategy {
|
|
|
|
cacheDynamicVersionsFor 0, "seconds"
|
|
|
|
cacheChangingModulesFor 0, "seconds"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2019-05-07 11:56:34 -04:00
|
|
|
enigmaRuntime "net.fabricmc:stitch:0.1.2.49+"
|
2019-05-14 07:05:39 -04:00
|
|
|
enigmaRuntime "cuchaz:enigma:0.13.1.99:all"
|
2018-12-08 07:32:48 -05:00
|
|
|
}
|
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
def mappingsDir = file("mappings")
|
|
|
|
def cacheFilesMinecraft = file(".gradle/minecraft")
|
2018-10-31 09:05:19 -04:00
|
|
|
def tempDir = file(".gradle/temp")
|
2018-10-27 10:16:43 -04:00
|
|
|
def mergedFile = file("${minecraft_version}-merged.jar")
|
2019-01-09 15:28:08 -05:00
|
|
|
def intermediaryJar = file("${minecraft_version}-intermediary.jar")
|
|
|
|
def namedJar = file("${minecraft_version}-named.jar")
|
2018-10-27 10:16:43 -04:00
|
|
|
def versionFile = new File(cacheFilesMinecraft, "${minecraft_version}.json")
|
|
|
|
def clientJar = new File(cacheFilesMinecraft, "${minecraft_version}-client.jar")
|
|
|
|
def serverJar = new File(cacheFilesMinecraft, "${minecraft_version}-server.jar")
|
|
|
|
def libraries = new File(cacheFilesMinecraft, "${minecraft_version}-libraries")
|
2018-10-30 07:29:43 -04:00
|
|
|
def libs = new File("build/libs/")
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2016-08-17 15:23:28 -04:00
|
|
|
import groovy.json.JsonSlurper
|
|
|
|
import org.apache.commons.io.FileUtils
|
|
|
|
import com.google.common.hash.Hashing
|
|
|
|
import com.google.common.io.Files
|
2018-10-31 12:54:00 -04:00
|
|
|
import net.fabricmc.stitch.commands.CommandMergeTiny
|
2019-05-07 11:56:34 -04:00
|
|
|
import net.fabricmc.stitch.commands.CommandProposeFieldNames
|
2019-04-18 17:22:36 -04:00
|
|
|
import net.fabricmc.stitch.commands.CommandRewriteIntermediary
|
2018-10-31 12:53:07 -04:00
|
|
|
import net.fabricmc.stitch.merge.JarMerger
|
2018-10-27 10:16:43 -04:00
|
|
|
import net.fabricmc.tinyremapper.OutputConsumerPath
|
|
|
|
import net.fabricmc.tinyremapper.TinyRemapper
|
|
|
|
import net.fabricmc.tinyremapper.TinyUtils
|
2018-10-31 12:53:07 -04:00
|
|
|
import net.fabricmc.weave.CommandFindMappingErrors
|
2019-04-18 17:22:36 -04:00
|
|
|
import net.fabricmc.weave.CommandTinyify
|
2018-10-27 10:16:43 -04:00
|
|
|
import groovy.io.FileType
|
2018-11-15 11:57:32 -05:00
|
|
|
import java.util.zip.GZIPOutputStream
|
2016-08-17 15:23:28 -04:00
|
|
|
|
|
|
|
boolean validateChecksum(File file, String checksum) {
|
|
|
|
if (file != null) {
|
|
|
|
def hash = Files.hash(file, Hashing.sha1())
|
|
|
|
def builder = new StringBuilder()
|
|
|
|
hash.asBytes().each {
|
|
|
|
builder.append(Integer.toString((it & 0xFF) + 0x100, 16).substring(1))
|
|
|
|
}
|
|
|
|
return builder.toString().equals(checksum)
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
task downloadVersionsManifest {
|
|
|
|
//inputs.property "mc_ver", minecraft_version
|
|
|
|
inputs.property "currenttime", new Date()
|
|
|
|
def manifestFile = new File(cacheFilesMinecraft, "version_manifest.json")
|
|
|
|
outputs.file(manifestFile)
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":downloading minecraft versions manifest")
|
|
|
|
FileUtils.copyURLToFile(new URL("https://launchermeta.mojang.com/mc/game/version_manifest.json"), manifestFile)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def getManifestVersion(File manifestFile, String minecraft_version) {
|
|
|
|
def manifest = manifestFile.exists() ? new JsonSlurper().parseText(FileUtils.readFileToString(manifestFile)) : null
|
|
|
|
return manifest != null ? manifest.versions.stream().filter({it.id.equals(minecraft_version)}).findFirst() : java.util.Optional.empty()
|
|
|
|
}
|
|
|
|
|
|
|
|
task downloadWantedVersionManifest(dependsOn: downloadVersionsManifest) {
|
|
|
|
def manifestFile = downloadVersionsManifest.outputs.files.singleFile
|
|
|
|
def manifestVersion = getManifestVersion(manifestFile, minecraft_version)
|
|
|
|
|
|
|
|
//have to grab the release time as there's a current timestamp on each element?!
|
|
|
|
inputs.property "releaseTime", manifestVersion.isPresent() ? manifestVersion.get().releaseTime : -1
|
|
|
|
|
|
|
|
outputs.file versionFile
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
manifestVersion = getManifestVersion(manifestFile, minecraft_version) //nb need to re-read here in case it didn't exist before
|
|
|
|
if (manifestVersion.isPresent() || versionFile.exists()) {
|
|
|
|
|
|
|
|
if (manifestVersion.isPresent()) {
|
|
|
|
FileUtils.copyURLToFile(new URL(manifestVersion.get().url), versionFile)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException("No version data for Minecraft version ${minecraft_version}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
task downloadMcJars(dependsOn: downloadWantedVersionManifest) {
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
inputs.files versionFile
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
outputs.files(clientJar, serverJar)
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
outputs.upToDateWhen {
|
2016-08-17 15:23:28 -04:00
|
|
|
def version = new JsonSlurper().parseText(FileUtils.readFileToString(versionFile))
|
2018-10-27 10:16:43 -04:00
|
|
|
return clientJar.exists() && serverJar.exists() && validateChecksum(clientJar, version.downloads.client.sha1) && validateChecksum(serverJar, version.downloads.server.sha1)
|
|
|
|
}
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
if (!versionFile.exists()) {
|
|
|
|
throw new RuntimeException("Can't download the jars without the ${versionFile.name} file!")
|
|
|
|
}
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
//reload in case it changed
|
|
|
|
def version = new JsonSlurper().parseText(FileUtils.readFileToString(versionFile))
|
|
|
|
|
|
|
|
logger.lifecycle(":downloading minecraft jars")
|
2016-08-17 15:23:28 -04:00
|
|
|
|
|
|
|
if (!clientJar.exists() || !validateChecksum(clientJar, version.downloads.client.sha1)) {
|
|
|
|
logger.lifecycle(":downloading minecraft client")
|
|
|
|
FileUtils.copyURLToFile(new URL(version.downloads.client.url), clientJar)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!serverJar.exists() || !validateChecksum(serverJar, version.downloads.server.sha1)) {
|
|
|
|
logger.lifecycle(":downloading minecraft server")
|
|
|
|
FileUtils.copyURLToFile(new URL(version.downloads.server.url), serverJar)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
task mergeJars(dependsOn: downloadMcJars) {
|
|
|
|
inputs.files downloadMcJars.outputs.files.files
|
|
|
|
outputs.file(mergedFile)
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":merging jars")
|
2018-12-22 06:56:35 -05:00
|
|
|
def client = inputs.files.files.find {it.name.endsWith("-client.jar")}
|
|
|
|
def server = inputs.files.files.find {it.name.endsWith("-server.jar")}
|
|
|
|
def merged = mergedFile
|
2016-08-17 15:23:28 -04:00
|
|
|
|
2019-01-16 13:37:56 -05:00
|
|
|
if(merged.exists()){
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-08-17 15:23:28 -04:00
|
|
|
def jarMerger = new JarMerger(client, server, merged)
|
|
|
|
jarMerger.merge()
|
|
|
|
jarMerger.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-12-09 16:14:34 -05:00
|
|
|
task setupYarn(dependsOn: mergeJars) {
|
2016-10-19 04:58:14 -04:00
|
|
|
|
2016-08-17 15:23:28 -04:00
|
|
|
}
|
|
|
|
|
2018-12-09 16:14:34 -05:00
|
|
|
task yarn(dependsOn: setupYarn) {
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
2018-12-08 07:32:48 -05:00
|
|
|
ant.java(
|
|
|
|
classname: 'cuchaz.enigma.Main',
|
|
|
|
classpath: configurations.enigmaRuntime.asPath,
|
|
|
|
fork: true,
|
|
|
|
spawn: true
|
|
|
|
) {
|
2019-03-17 12:49:10 -04:00
|
|
|
jvmarg(value: "-Xmx2048m")
|
2018-10-27 10:16:43 -04:00
|
|
|
arg(value: mergedFile.getAbsolutePath())
|
|
|
|
arg(value: mappingsDir.getAbsolutePath())
|
|
|
|
}
|
2016-08-17 15:23:28 -04:00
|
|
|
}
|
|
|
|
}
|
2016-09-08 18:42:45 -04:00
|
|
|
|
2018-11-01 03:02:17 -04:00
|
|
|
task buildEnigma(type: Zip) {
|
2018-10-27 10:16:43 -04:00
|
|
|
from mappingsDir
|
2016-09-08 18:42:45 -04:00
|
|
|
include "**/*"
|
2018-12-09 16:14:34 -05:00
|
|
|
archiveName "yarn-enigma-${yarnVersion}.zip"
|
2016-09-08 18:42:45 -04:00
|
|
|
destinationDir(file("build/libs"))
|
2016-09-09 08:47:32 -04:00
|
|
|
}
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
task checkMappings {
|
|
|
|
inputs.dir mappingsDir
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":checking mappings")
|
2016-10-19 04:58:14 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
String[] args = [
|
|
|
|
mergedFile.getAbsolutePath(),
|
|
|
|
mappingsDir.getAbsolutePath()
|
|
|
|
]
|
2016-10-19 04:58:14 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
new CommandFindMappingErrors().run(args)
|
|
|
|
}
|
2016-10-19 04:58:14 -04:00
|
|
|
}
|
|
|
|
|
2018-10-31 09:05:19 -04:00
|
|
|
task downloadIntermediary(type: Download){
|
2019-04-10 11:36:17 -04:00
|
|
|
def url = "https://github.com/FabricMC/intermediary/raw/master/mappings/${minecraft_version}.tiny"
|
|
|
|
src url.replaceAll(" ", "%20")
|
2018-10-31 09:05:19 -04:00
|
|
|
dest new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny")
|
|
|
|
}
|
|
|
|
|
2019-04-18 17:22:36 -04:00
|
|
|
task patchIntermediary(dependsOn: ["mergeJars", "downloadIntermediary"], type: FileOutput) {
|
|
|
|
def intermediaryTinyInput = downloadIntermediary.dest
|
|
|
|
|
|
|
|
def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-full.tiny")
|
|
|
|
outputs.file(outputFile)
|
|
|
|
fileOutput = outputFile
|
|
|
|
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2019-04-18 17:22:36 -04:00
|
|
|
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":patching intermediary")
|
|
|
|
String[] args = [
|
|
|
|
mergedFile.getAbsolutePath(),
|
|
|
|
intermediaryTinyInput.getAbsolutePath(),
|
|
|
|
outputFile.getAbsolutePath(),
|
|
|
|
"--writeAll"
|
|
|
|
]
|
|
|
|
|
|
|
|
new CommandRewriteIntermediary().run(args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-09 16:14:34 -05:00
|
|
|
task buildYarnTiny(dependsOn: "mergeJars",type: FileOutput) {
|
2018-10-27 10:16:43 -04:00
|
|
|
inputs.dir mappingsDir
|
|
|
|
if (!libs.exists()) {
|
|
|
|
libs.mkdirs()
|
|
|
|
}
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2018-12-09 16:14:34 -05:00
|
|
|
def yarnTiny = new File(tempDir, "yarn-mappings.tiny")
|
|
|
|
fileOutput = yarnTiny
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":generating tiny mappings")
|
|
|
|
|
|
|
|
String[] args = [
|
|
|
|
mergedFile.getAbsolutePath(),
|
|
|
|
mappingsDir.getAbsolutePath(),
|
2018-12-09 16:14:34 -05:00
|
|
|
yarnTiny.getAbsolutePath(),
|
2018-11-02 12:17:55 -04:00
|
|
|
"official",
|
|
|
|
"named"
|
2018-10-27 10:16:43 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
new CommandTinyify().run(args)
|
2018-10-31 09:05:19 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 17:22:36 -04:00
|
|
|
task mergeTiny(dependsOn: ["buildYarnTiny", "patchIntermediary"], type: FileOutput) {
|
2018-12-09 16:14:34 -05:00
|
|
|
def yarnTinyInput = buildYarnTiny.fileOutput
|
2019-04-18 17:22:36 -04:00
|
|
|
def intermediaryTinyInput = patchIntermediary.fileOutput
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-05-07 11:56:34 -04:00
|
|
|
def resultMappings = new File(tempDir, "mappings.tiny")
|
|
|
|
outputs.file(resultMappings)
|
|
|
|
fileOutput = resultMappings
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2018-10-31 09:05:19 -04:00
|
|
|
doLast {
|
2018-12-09 16:14:34 -05:00
|
|
|
logger.lifecycle(":merging yarn and intermediary")
|
2018-10-31 09:05:19 -04:00
|
|
|
String[] args = [
|
2018-12-09 16:14:34 -05:00
|
|
|
yarnTinyInput.getAbsolutePath(),
|
2018-10-31 09:05:19 -04:00
|
|
|
intermediaryTinyInput.getAbsolutePath(),
|
2019-05-07 11:56:34 -04:00
|
|
|
resultMappings.getAbsolutePath(),
|
2018-11-02 12:17:55 -04:00
|
|
|
"intermediary",
|
|
|
|
"official"
|
2018-10-31 09:05:19 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
new CommandMergeTiny().run(args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-02 11:07:46 -04:00
|
|
|
task tinyJar(type: Jar, dependsOn: "mergeTiny") {
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2018-12-09 16:14:34 -05:00
|
|
|
archiveName = "yarn-${yarnVersion}.jar"
|
2018-11-02 11:07:46 -04:00
|
|
|
destinationDir(file("build/libs"))
|
2018-11-02 12:02:21 -04:00
|
|
|
classifier = ""
|
2018-11-02 11:07:46 -04:00
|
|
|
from (mergeTiny.fileOutput) {
|
|
|
|
rename { "mappings/mappings.tiny" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task compressTiny(dependsOn: ["tinyJar", "mergeTiny"], type: FileOutput){
|
2018-12-09 16:14:34 -05:00
|
|
|
def outputFile = new File(libs, "yarn-tiny-${yarnVersion}.gz")
|
2018-10-31 09:05:19 -04:00
|
|
|
outputs.file(outputFile)
|
|
|
|
fileOutput = outputFile
|
|
|
|
|
|
|
|
def inputFile = mergeTiny.fileOutput
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2018-10-31 09:05:19 -04:00
|
|
|
|
|
|
|
doLast {
|
2018-10-27 10:16:43 -04:00
|
|
|
logger.lifecycle(":compressing tiny mappings")
|
|
|
|
|
|
|
|
def buffer = new byte[1024]
|
|
|
|
def fileOutputStream = new FileOutputStream(outputFile)
|
|
|
|
def outputStream = new GZIPOutputStream(fileOutputStream)
|
|
|
|
def fileInputStream = new FileInputStream(inputFile)
|
|
|
|
|
|
|
|
def length
|
|
|
|
while ((length = fileInputStream.read(buffer)) > 0) {
|
|
|
|
outputStream.write(buffer, 0, length)
|
|
|
|
}
|
|
|
|
|
|
|
|
fileInputStream.close()
|
|
|
|
outputStream.finish()
|
|
|
|
outputStream.close()
|
|
|
|
inputFile.delete()
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2018-11-02 12:17:55 -04:00
|
|
|
clean.doFirst {
|
|
|
|
delete tempDir, cacheFilesMinecraft
|
|
|
|
}
|
|
|
|
|
2018-10-31 09:05:19 -04:00
|
|
|
tasks.build.dependsOn "compressTiny"
|
2018-11-01 03:02:17 -04:00
|
|
|
tasks.build.dependsOn "buildEnigma"
|
2018-11-02 11:07:46 -04:00
|
|
|
tasks.build.dependsOn "tinyJar"
|
2016-10-02 11:58:41 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
task downloadMcLibs(dependsOn: downloadWantedVersionManifest) {
|
|
|
|
inputs.files versionFile
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
outputs.file(libraries)
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
|
|
|
if (!versionFile.exists()) {
|
|
|
|
throw new RuntimeException("Can't download the jars without the ${versionFile.name} file!")
|
|
|
|
}
|
|
|
|
|
|
|
|
def version = new JsonSlurper().parseText(FileUtils.readFileToString(versionFile))
|
|
|
|
|
|
|
|
logger.lifecycle(":downloading minecraft libraries")
|
|
|
|
|
|
|
|
if (!libraries.exists()) {
|
|
|
|
libraries.mkdirs()
|
|
|
|
}
|
|
|
|
|
|
|
|
version.libraries.each {
|
|
|
|
def downloadUrl = it.downloads.artifact.url
|
|
|
|
|
|
|
|
download {
|
|
|
|
src downloadUrl
|
|
|
|
dest new File(libraries, downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1))
|
|
|
|
overwrite false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 08:52:54 -04:00
|
|
|
}
|
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
task mapIntermediaryJar(dependsOn: [downloadMcLibs, build]) {
|
2018-10-27 10:16:43 -04:00
|
|
|
inputs.files downloadMcLibs.outputs.files.files
|
2019-01-09 15:28:08 -05:00
|
|
|
outputs.file(intermediaryJar)
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2018-10-27 10:37:37 -04:00
|
|
|
//Force the task to always run
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2018-10-27 10:37:37 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
2019-01-09 15:28:08 -05:00
|
|
|
logger.lifecycle(":mapping minecraft to intermdiary")
|
|
|
|
def tinyInput = new File("build/libs/yarn-tiny-${yarnVersion}.gz")
|
|
|
|
mapJar(intermediaryJar, mergedFile, tinyInput, libraries, "official", "intermediary")
|
|
|
|
}
|
|
|
|
}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
task mapNamedJar(dependsOn: mapIntermediaryJar) {
|
|
|
|
inputs.files downloadMcLibs.outputs.files.files
|
|
|
|
outputs.file(namedJar)
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
//Force the task to always run
|
2019-05-07 11:56:34 -04:00
|
|
|
outputs.upToDateWhen {false}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":mapping minecraft to named")
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
def tinyInput = new File("build/libs/yarn-tiny-${yarnVersion}.gz")
|
|
|
|
mapJar(namedJar, intermediaryJar, tinyInput, libraries, "intermediary", "named")
|
2018-10-27 10:16:43 -04:00
|
|
|
}
|
2018-10-31 12:53:07 -04:00
|
|
|
}
|
2018-10-30 07:29:43 -04:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
maven(MavenPublication) {
|
|
|
|
groupId 'net.fabricmc'
|
2018-12-09 16:14:34 -05:00
|
|
|
artifactId "yarn"
|
|
|
|
version yarnVersion
|
2018-10-30 07:29:43 -04:00
|
|
|
|
2018-10-31 09:05:19 -04:00
|
|
|
artifact (compressTiny.fileOutput) {
|
2018-10-30 07:29:43 -04:00
|
|
|
classifier "tiny"
|
2018-11-15 11:57:32 -05:00
|
|
|
builtBy compressTiny
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
2018-11-01 03:02:17 -04:00
|
|
|
artifact (buildEnigma) {
|
|
|
|
classifier "enigma"
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
2018-11-02 11:07:46 -04:00
|
|
|
artifact (tinyJar)
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url "http://mavenupload.modmuss50.me/"
|
|
|
|
if (project.hasProperty('mavenPass')) {
|
|
|
|
credentials {
|
|
|
|
username 'buildslave'
|
|
|
|
password project.getProperty('mavenPass')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
void mapJar(File output, File input, File mappings, File libraries, String from, String to){
|
|
|
|
if (output.exists()) {
|
|
|
|
output.delete()
|
|
|
|
}
|
|
|
|
|
|
|
|
def remapper = TinyRemapper.newRemapper()
|
|
|
|
.withMappings(TinyUtils.createTinyMappingProvider(mappings.toPath(), from, to))
|
|
|
|
.renameInvalidLocals(true)
|
|
|
|
.rebuildSourceFilenames(true)
|
|
|
|
.build()
|
|
|
|
|
|
|
|
try {
|
|
|
|
def outputConsumer = new OutputConsumerPath(output.toPath())
|
|
|
|
outputConsumer.addNonClassFiles(input.toPath())
|
2019-04-15 10:39:14 -04:00
|
|
|
remapper.readInputs(input.toPath())
|
2019-01-09 15:28:08 -05:00
|
|
|
|
|
|
|
libraries.eachFileRecurse(FileType.FILES) {file ->
|
2019-04-15 10:39:14 -04:00
|
|
|
remapper.readClassPath(file.toPath())
|
2019-01-09 15:28:08 -05:00
|
|
|
}
|
2019-04-15 10:39:14 -04:00
|
|
|
remapper.apply(outputConsumer)
|
2019-01-09 15:28:08 -05:00
|
|
|
outputConsumer.close()
|
2019-01-16 13:37:56 -05:00
|
|
|
remapper.finish()
|
2019-01-09 15:28:08 -05:00
|
|
|
} catch (Exception e) {
|
2019-01-16 13:37:56 -05:00
|
|
|
remapper.finish()
|
2019-01-09 15:28:08 -05:00
|
|
|
throw new RuntimeException("Failed to remap jar", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-30 07:29:43 -04:00
|
|
|
class FileOutput extends DefaultTask {
|
|
|
|
@OutputFile File fileOutput
|
2018-10-31 12:54:00 -04:00
|
|
|
}
|