Use classpath Weave instead of downloading

This commit is contained in:
Shadowfacts 2016-10-02 11:58:41 -04:00
parent 6c02b4a834
commit 0bb8d63809
No known key found for this signature in database
GPG Key ID: 94A5AB95422746E5
1 changed files with 35 additions and 54 deletions

View File

@ -1,18 +1,18 @@
buildscript {
repositories {
jcenter()
maven {
name = "Fabric"
url = "http://maven.fabricmc.net/"
}
}
dependencies {
classpath("net.fabricmc:weave:0.1.0.6") {
exclude module: 'procyon-compilertools'
}
classpath "commons-io:commons-io:1.4"
classpath "com.google.guava:guava:19.0"
}
repositories {
jcenter()
maven {
name = "Fabric"
url = "http://maven.fabricmc.net/"
}
}
dependencies {
classpath("net.fabricmc:weave:0.1.0.6") {
exclude module: 'procyon-compilertools'
}
classpath "commons-io:commons-io:1.4"
classpath "com.google.guava:guava:19.0"
}
}
def minecraft_version = "16w38a"
@ -21,7 +21,7 @@ def pomfVersion = "${minecraft_version}"
def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {
pomfVersion = pomfVersion + "." + "${System.getenv().BUILD_NUMBER}"
pomfVersion = pomfVersion + "." + "${System.getenv().BUILD_NUMBER}"
}
import groovy.json.JsonSlurper
@ -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,57 +145,37 @@ 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")
def fileOutputStream = new FileOutputStream(outputFile)
def outputStream = new GZIPOutputStream(fileOutputStream)
def outputStream = new GZIPOutputStream(fileOutputStream)
def inputFile = new File("mappings.tiny")
def fileInputStream = new FileInputStream(inputFile)
def fileInputStream = new FileInputStream(inputFile)
def length;
while ((length = fileInputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
def length
while ((length = fileInputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length)
}
fileInputStream.close()
outputStream.finish()
outputStream.close()
fileInputStream.close()
outputStream.finish()
outputStream.close()
inputFile.delete()
}