mirror of https://github.com/FabricMC/yarn.git
Use classpath Weave instead of downloading
This commit is contained in:
parent
6c02b4a834
commit
0bb8d63809
45
build.gradle
45
build.gradle
|
@ -30,6 +30,7 @@ import com.google.common.hash.HashCode
|
|||
import com.google.common.hash.Hashing
|
||||
import com.google.common.io.Files
|
||||
import net.fabricmc.weave.merge.JarMerger
|
||||
import net.fabricmc.weave.CommandTinyify
|
||||
import groovy.util.XmlSlurper
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -144,41 +145,21 @@ task build(type: Zip) {
|
|||
}
|
||||
|
||||
task buildTiny << {
|
||||
def cacheFiles = new File(".gradle/weave")
|
||||
if (!cacheFiles.exists()) cacheFiles.mkdirs()
|
||||
|
||||
def mavenMetadata = new File(cacheFiles, "maven-metadata.xml")
|
||||
|
||||
logger.lifecycle(":downloading weave metadata")
|
||||
FileUtils.copyURLToFile(new URL("http://maven.fabricmc.net/net/fabricmc/weave/maven-metadata.xml"), mavenMetadata)
|
||||
|
||||
def metadata = new XmlSlurper().parseText(FileUtils.readFileToString(mavenMetadata))
|
||||
def weaveVersion = metadata.versioning.release
|
||||
|
||||
def weave = new File(cacheFiles, "${weaveVersion}.jar")
|
||||
|
||||
if(!weave.exists()){
|
||||
logger.lifecycle(":downloading weave")
|
||||
FileUtils.copyURLToFile(new URL("http://maven.fabricmc.net/net/fabricmc/weave/${weaveVersion}/weave-${weaveVersion}-fat.jar"), weave)
|
||||
}
|
||||
|
||||
|
||||
logger.lifecycle(":generating tiny mappings")
|
||||
|
||||
ant.java(jar: weave.getAbsolutePath(), fork: true, spawn: false) {
|
||||
arg(value : "tinyify")
|
||||
arg(value: new File("${minecraft_version}-merged.jar").getAbsolutePath())
|
||||
arg(value: new File("mappings").getAbsolutePath())
|
||||
arg(value : "mappings.tiny")
|
||||
arg(value : "mojang")
|
||||
arg(value : "pomf")
|
||||
}
|
||||
String[] args = [
|
||||
new File("${minecraft_version}-merged.jar").getAbsolutePath(),
|
||||
new File("mappings").getAbsolutePath(),
|
||||
"mappings.tiny",
|
||||
"moajng",
|
||||
"pomf"
|
||||
]
|
||||
|
||||
new CommandTinyify().run(args)
|
||||
|
||||
logger.lifecycle(":compressing tiny mappings")
|
||||
def libs = new File("build/libs/")
|
||||
if(!libs.exists()){
|
||||
libs.mkdirs()
|
||||
}
|
||||
if (!libs.exists()) libs.mkdirs()
|
||||
|
||||
def buffer = new byte[1024]
|
||||
def outputFile = new File(libs, "pomf-tiny-${pomfVersion}.gz")
|
||||
|
@ -187,9 +168,9 @@ task buildTiny << {
|
|||
def inputFile = new File("mappings.tiny")
|
||||
def fileInputStream = new FileInputStream(inputFile)
|
||||
|
||||
def length;
|
||||
def length
|
||||
while ((length = fileInputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, length);
|
||||
outputStream.write(buffer, 0, length)
|
||||
}
|
||||
|
||||
fileInputStream.close()
|
||||
|
|
Loading…
Reference in New Issue