mirror of https://github.com/FabricMC/yarn.git
Use classpath Weave instead of downloading
This commit is contained in:
parent
6c02b4a834
commit
0bb8d63809
89
build.gradle
89
build.gradle
|
@ -1,18 +1,18 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
maven {
|
maven {
|
||||||
name = "Fabric"
|
name = "Fabric"
|
||||||
url = "http://maven.fabricmc.net/"
|
url = "http://maven.fabricmc.net/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("net.fabricmc:weave:0.1.0.6") {
|
classpath("net.fabricmc:weave:0.1.0.6") {
|
||||||
exclude module: 'procyon-compilertools'
|
exclude module: 'procyon-compilertools'
|
||||||
}
|
}
|
||||||
classpath "commons-io:commons-io:1.4"
|
classpath "commons-io:commons-io:1.4"
|
||||||
classpath "com.google.guava:guava:19.0"
|
classpath "com.google.guava:guava:19.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def minecraft_version = "16w38a"
|
def minecraft_version = "16w38a"
|
||||||
|
@ -21,7 +21,7 @@ def pomfVersion = "${minecraft_version}"
|
||||||
def ENV = System.getenv()
|
def ENV = System.getenv()
|
||||||
|
|
||||||
if (ENV.BUILD_NUMBER) {
|
if (ENV.BUILD_NUMBER) {
|
||||||
pomfVersion = pomfVersion + "." + "${System.getenv().BUILD_NUMBER}"
|
pomfVersion = pomfVersion + "." + "${System.getenv().BUILD_NUMBER}"
|
||||||
}
|
}
|
||||||
|
|
||||||
import groovy.json.JsonSlurper
|
import groovy.json.JsonSlurper
|
||||||
|
@ -30,6 +30,7 @@ import com.google.common.hash.HashCode
|
||||||
import com.google.common.hash.Hashing
|
import com.google.common.hash.Hashing
|
||||||
import com.google.common.io.Files
|
import com.google.common.io.Files
|
||||||
import net.fabricmc.weave.merge.JarMerger
|
import net.fabricmc.weave.merge.JarMerger
|
||||||
|
import net.fabricmc.weave.CommandTinyify
|
||||||
import groovy.util.XmlSlurper
|
import groovy.util.XmlSlurper
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -144,57 +145,37 @@ task build(type: Zip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildTiny << {
|
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")
|
logger.lifecycle(":generating tiny mappings")
|
||||||
|
|
||||||
ant.java(jar: weave.getAbsolutePath(), fork: true, spawn: false) {
|
String[] args = [
|
||||||
arg(value : "tinyify")
|
new File("${minecraft_version}-merged.jar").getAbsolutePath(),
|
||||||
arg(value: new File("${minecraft_version}-merged.jar").getAbsolutePath())
|
new File("mappings").getAbsolutePath(),
|
||||||
arg(value: new File("mappings").getAbsolutePath())
|
"mappings.tiny",
|
||||||
arg(value : "mappings.tiny")
|
"moajng",
|
||||||
arg(value : "mojang")
|
"pomf"
|
||||||
arg(value : "pomf")
|
]
|
||||||
}
|
|
||||||
|
new CommandTinyify().run(args)
|
||||||
|
|
||||||
logger.lifecycle(":compressing tiny mappings")
|
logger.lifecycle(":compressing tiny mappings")
|
||||||
def libs = new File("build/libs/")
|
def libs = new File("build/libs/")
|
||||||
if(!libs.exists()){
|
if (!libs.exists()) libs.mkdirs()
|
||||||
libs.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
def buffer = new byte[1024]
|
def buffer = new byte[1024]
|
||||||
def outputFile = new File(libs, "pomf-tiny-${pomfVersion}.gz")
|
def outputFile = new File(libs, "pomf-tiny-${pomfVersion}.gz")
|
||||||
def fileOutputStream = new FileOutputStream(outputFile)
|
def fileOutputStream = new FileOutputStream(outputFile)
|
||||||
def outputStream = new GZIPOutputStream(fileOutputStream)
|
def outputStream = new GZIPOutputStream(fileOutputStream)
|
||||||
def inputFile = new File("mappings.tiny")
|
def inputFile = new File("mappings.tiny")
|
||||||
def fileInputStream = new FileInputStream(inputFile)
|
def fileInputStream = new FileInputStream(inputFile)
|
||||||
|
|
||||||
def length;
|
def length
|
||||||
while ((length = fileInputStream.read(buffer)) > 0) {
|
while ((length = fileInputStream.read(buffer)) > 0) {
|
||||||
outputStream.write(buffer, 0, length);
|
outputStream.write(buffer, 0, length)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileInputStream.close()
|
fileInputStream.close()
|
||||||
outputStream.finish()
|
outputStream.finish()
|
||||||
outputStream.close()
|
outputStream.close()
|
||||||
inputFile.delete()
|
inputFile.delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue