Produce TinyV2 mappings (#914)

This commit is contained in:
Fudge 2019-11-07 13:38:33 +02:00 committed by Player
parent c37fc0ee16
commit 62a62ba816
2 changed files with 193 additions and 122 deletions

View File

@ -5,11 +5,10 @@ buildscript {
name "Fabric Repository" name "Fabric Repository"
url 'https://maven.fabricmc.net' url 'https://maven.fabricmc.net'
} }
mavenLocal()
} }
dependencies { dependencies {
classpath "cuchaz:enigma:0.14.2.134" classpath "cuchaz:enigma:0.14.2.134"
classpath "net.fabricmc:stitch:0.2.1.61" classpath "net.fabricmc:stitch:0.3.0.66"
classpath "commons-io:commons-io:2.6" classpath "commons-io:commons-io:2.6"
classpath "com.google.guava:guava:28.0-jre" classpath "com.google.guava:guava:28.0-jre"
classpath 'de.undercouch:gradle-download-task:3.4.3' classpath 'de.undercouch:gradle-download-task:3.4.3'
@ -46,11 +45,13 @@ configurations {
cacheChangingModulesFor 0, "seconds" cacheChangingModulesFor 0, "seconds"
} }
} }
intermediary
} }
dependencies { dependencies {
enigmaRuntime "net.fabricmc:stitch:0.2.1.61" enigmaRuntime "net.fabricmc:stitch:0.3.0.66"
enigmaRuntime "cuchaz:enigma:0.14.2.134:all" enigmaRuntime "cuchaz:enigma:0.14.2.134"
intermediary "net.fabricmc:intermediary:$minecraft_version"
} }
def setupGroup = "jar setup" def setupGroup = "jar setup"
@ -58,7 +59,6 @@ def yarnGroup = "yarn"
def buildMappingGroup = "mapping build" def buildMappingGroup = "mapping build"
def mapJarGroup = "jar mapping" def mapJarGroup = "jar mapping"
def mappingsDir = file("mappings") def mappingsDir = file("mappings")
def mappingsExportOfficialDir = file("mappings_official")
def cacheFilesMinecraft = file(".gradle/minecraft") def cacheFilesMinecraft = file(".gradle/minecraft")
def tempDir = file(".gradle/temp") def tempDir = file(".gradle/temp")
def mergedFile = file("${minecraft_version}-merged.jar") def mergedFile = file("${minecraft_version}-merged.jar")
@ -71,18 +71,19 @@ def serverJar = new File(cacheFilesMinecraft, "${minecraft_version}-server.jar")
def libraries = new File(cacheFilesMinecraft, "libraries") def libraries = new File(cacheFilesMinecraft, "libraries")
def libs = new File("build/libs/") def libs = new File("build/libs/")
import com.google.common.hash.Hashing
import com.google.common.collect.Iterables
import cuchaz.enigma.command.CheckMappingsCommand import cuchaz.enigma.command.CheckMappingsCommand
import cuchaz.enigma.command.ComposeMappingsCommand import cuchaz.enigma.command.ComposeMappingsCommand
import cuchaz.enigma.command.ConvertMappingsCommand import cuchaz.enigma.command.ConvertMappingsCommand
import com.google.common.hash.Hashing
import com.google.common.io.Files
import com.google.common.net.UrlEscapers
import groovy.io.FileType import groovy.io.FileType
import groovy.json.JsonSlurper import groovy.json.JsonSlurper
import net.fabricmc.stitch.commands.CommandMergeTiny import net.fabricmc.stitch.commands.CommandMergeTiny
import net.fabricmc.stitch.commands.CommandProposeFieldNames import net.fabricmc.stitch.commands.CommandProposeFieldNames
import net.fabricmc.stitch.commands.CommandReorderTiny import net.fabricmc.stitch.commands.CommandReorderTiny
import net.fabricmc.stitch.commands.CommandRewriteIntermediary import net.fabricmc.stitch.commands.CommandRewriteIntermediary
import net.fabricmc.stitch.commands.tinyv2.CommandProposeV2FieldNames
import net.fabricmc.stitch.merge.JarMerger import net.fabricmc.stitch.merge.JarMerger
import net.fabricmc.tinyremapper.OutputConsumerPath import net.fabricmc.tinyremapper.OutputConsumerPath
import net.fabricmc.tinyremapper.TinyRemapper import net.fabricmc.tinyremapper.TinyRemapper
@ -90,11 +91,14 @@ import net.fabricmc.tinyremapper.TinyUtils
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path
import java.util.zip.GZIPOutputStream import java.util.zip.GZIPOutputStream
boolean validateChecksum(File file, String checksum) { boolean validateChecksum(File file, String checksum) {
if (file != null) { if (file != null) {
def hash = Files.asByteSource(file).hash(Hashing.sha1()) def hash = com.google.common.io.Files.asByteSource(file).hash(Hashing.sha1())
def builder = new StringBuilder() def builder = new StringBuilder()
hash.asBytes().each { hash.asBytes().each {
builder.append(Integer.toString((it & 0xFF) + 0x100, 16).substring(1)) builder.append(Integer.toString((it & 0xFF) + 0x100, 16).substring(1))
@ -118,7 +122,9 @@ task downloadVersionsManifest {
def getManifestVersion(File manifestFile, String minecraft_version) { def getManifestVersion(File manifestFile, String minecraft_version) {
def manifest = manifestFile.exists() ? new JsonSlurper().parseText(FileUtils.readFileToString(manifestFile)) : null 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() return manifest != null ? manifest.versions.stream().filter({
it.id.equals(minecraft_version)
}).findFirst() : java.util.Optional.empty()
} }
task downloadWantedVersionManifest(dependsOn: downloadVersionsManifest) { task downloadWantedVersionManifest(dependsOn: downloadVersionsManifest) {
@ -132,7 +138,8 @@ task downloadWantedVersionManifest(dependsOn: downloadVersionsManifest) {
outputs.file versionFile outputs.file versionFile
doLast { doLast {
manifestVersion = getManifestVersion(manifestFile, minecraft_version) //nb need to re-read here in case it didn't exist before 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() || versionFile.exists()) {
if (manifestVersion.isPresent()) { if (manifestVersion.isPresent()) {
@ -178,13 +185,27 @@ task downloadMcJars(dependsOn: downloadWantedVersionManifest) {
} }
} }
task downloadIntermediary(type: Download){ task extractIntermediary(type: FileOutput) {
group = buildMappingGroup group = buildMappingGroup
def url = "https://github.com/FabricMC/intermediary/raw/master/mappings/${minecraft_version}.tiny"
src UrlEscapers.urlFragmentEscaper().escape(url) def v1Input = Iterables.getOnlyElement(configurations.intermediary.files)
dest new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny")
output = new File(cacheFilesMinecraft.getPath(), "${minecraft_version}-intermediary.tiny")
doLast {
FileSystems.newFileSystem(v1Input.toPath(), null).withCloseable {
Path fileToExtract = it.getPath("mappings/mappings.tiny")
try {
Files.copy(fileToExtract, output.toPath())
} catch (Exception ignored) {
} // fuck groovy
}
}
} }
task mergeJars(dependsOn: downloadMcJars) { task mergeJars(dependsOn: downloadMcJars) {
group = setupGroup group = setupGroup
inputs.files downloadMcJars.outputs.files.files inputs.files downloadMcJars.outputs.files.files
@ -192,11 +213,11 @@ task mergeJars(dependsOn: downloadMcJars) {
doLast { doLast {
logger.lifecycle(":merging jars") logger.lifecycle(":merging jars")
def client = inputs.files.files.find {it.name.endsWith("-client.jar")} def client = inputs.files.files.find { it.name.endsWith("-client.jar") }
def server = inputs.files.files.find {it.name.endsWith("-server.jar")} def server = inputs.files.files.find { it.name.endsWith("-server.jar") }
def merged = mergedFile def merged = mergedFile
if(merged.exists()){ if (merged.exists()) {
return return
} }
@ -213,7 +234,7 @@ task downloadMcLibs(dependsOn: downloadWantedVersionManifest) {
outputs.dir(libraries) outputs.dir(libraries)
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
if (!versionFile.exists()) { if (!versionFile.exists()) {
@ -240,62 +261,61 @@ task downloadMcLibs(dependsOn: downloadWantedVersionManifest) {
} }
} }
task invertIntermediary(dependsOn: ["downloadIntermediary"], type: FileOutput) { task invertIntermediary(dependsOn: extractIntermediary, type: FileOutput) {
group = buildMappingGroup group = buildMappingGroup
def inputFile = downloadIntermediary.dest def v1Input = extractIntermediary.output
def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-inverted.tiny") output = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-inverted.tiny")
outputs.file(outputFile) outputs.file(output)
fileOutput = outputFile
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":building inverted intermediary") logger.lifecycle(":building inverted intermediary")
String[] args = [
inputFile.getAbsolutePath(), String[] v1Args = [
outputFile.getAbsolutePath(), v1Input.getAbsolutePath(),
"intermediary", "official" output.getAbsolutePath(),
"intermediary", "official"
] ]
new CommandReorderTiny().run(args) new CommandReorderTiny().run(v1Args)
} }
} }
task patchIntermediary(dependsOn: ["mergeJars", "downloadIntermediary"], type: FileOutput) { task patchIntermediary(dependsOn: [mergeJars, extractIntermediary]) {
group = buildMappingGroup group = buildMappingGroup
def intermediaryTinyInput = downloadIntermediary.dest def intermediaryTinyInput = extractIntermediary.output
def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-full.tiny") def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-full.tiny")
outputs.file(outputFile) outputs.file(outputFile)
fileOutput = outputFile
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":patching intermediary") logger.lifecycle(":patching intermediary")
String[] args = [ String[] args = [
mergedFile.getAbsolutePath(), mergedFile.getAbsolutePath(),
intermediaryTinyInput.getAbsolutePath(), intermediaryTinyInput.getAbsolutePath(),
outputFile.getAbsolutePath(), outputFile.getAbsolutePath(),
"--writeAll" "--writeAll"
] ]
new CommandRewriteIntermediary().run(args) new CommandRewriteIntermediary().run(args)
} }
} }
task mapIntermediaryJar(dependsOn: [downloadMcLibs, downloadIntermediary, mergeJars]) { task mapIntermediaryJar(dependsOn: [downloadMcLibs, extractIntermediary, mergeJars]) {
group = mapJarGroup group = mapJarGroup
inputs.files downloadMcLibs.outputs.files.files inputs.files downloadMcLibs.outputs.files.files
outputs.file(intermediaryJar) outputs.file(intermediaryJar)
//Force the task to always run //Force the task to always run
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":mapping minecraft to intermediary") logger.lifecycle(":mapping minecraft to intermediary")
def tinyInput = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny") def tinyInput = extractIntermediary.output
mapJar(intermediaryJar, mergedFile, tinyInput, libraries, "official", "intermediary") mapJar(intermediaryJar, mergedFile, tinyInput, libraries, "official", "intermediary")
} }
} }
@ -309,10 +329,10 @@ task yarn(dependsOn: setupYarn) {
doLast { doLast {
ant.setLifecycleLogLevel "WARN" ant.setLifecycleLogLevel "WARN"
ant.java( ant.java(
classname: 'cuchaz.enigma.Main', classname: 'cuchaz.enigma.Main',
classpath: configurations.enigmaRuntime.asPath, classpath: configurations.enigmaRuntime.asPath,
fork: true, fork: true,
spawn: true spawn: true
) { ) {
jvmarg(value: "-Xmx2048m") jvmarg(value: "-Xmx2048m")
arg(value: '-jar') arg(value: '-jar')
@ -332,95 +352,103 @@ task checkMappings {
logger.lifecycle(":checking mappings") logger.lifecycle(":checking mappings")
String[] args = [ String[] args = [
mergedFile.getAbsolutePath(), mergedFile.getAbsolutePath(),
mappingsDir.getAbsolutePath() mappingsDir.getAbsolutePath()
] ]
new CheckMappingsCommand().run(args) new CheckMappingsCommand().run(args)
} }
} }
task buildYarnTiny(dependsOn: "mergeJars", type: FileOutput) { task buildYarnTiny(dependsOn: mergeJars, type: WithV2FileOutput) {
group = buildMappingGroup group = buildMappingGroup
inputs.dir mappingsDir inputs.dir mappingsDir
if (!libs.exists()) { if (!libs.exists()) {
libs.mkdirs() libs.mkdirs()
} }
def yarnTiny = new File(tempDir, "yarn-mappings.tiny") v1Output = new File(tempDir, "yarn-mappings.tiny")
fileOutput = yarnTiny v2Output = new File(tempDir, "yarn-mappings-v2.tiny")
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":generating tiny mappings") logger.lifecycle(":generating tiny mappings")
String[] args = [ String[] v1Args = [
"enigma", "enigma",
mappingsDir.getAbsolutePath(), mappingsDir.getAbsolutePath(),
"tiny:intermediary:named", "tiny:intermediary:named",
yarnTiny.getAbsolutePath() v1Output.getAbsolutePath()
] ]
new ConvertMappingsCommand().run(args) String[] v2Args = [
"enigma",
mappingsDir.getAbsolutePath(),
"tinyv2:intermediary:named",
v2Output.getAbsolutePath()
]
new ConvertMappingsCommand().run(v1Args)
new ConvertMappingsCommand().run(v2Args)
def x = 2
} }
} }
task mergeTiny(dependsOn: ["buildYarnTiny", "invertIntermediary"], type: FileOutput) { task mergeTiny(dependsOn: ["buildYarnTiny", "invertIntermediary"], type: FileOutput) {
group = buildMappingGroup group = buildMappingGroup
def yarnTinyInput = buildYarnTiny.fileOutput def yarnTinyInput = buildYarnTiny.v1Output
def intermediaryTinyInput = invertIntermediary.fileOutput def intermediaryTinyInput = invertIntermediary.output
def unorderedResultMappings = new File(tempDir, "mappings-unordered.tiny") def unorderedResultMappings = new File(tempDir, "mappings-unordered.tiny")
def resultMappings = new File(tempDir, "mappings.tiny") output = new File(tempDir, "mappings.tiny")
outputs.file(resultMappings) outputs.file(output)
fileOutput = resultMappings
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":merging yarn and intermediary") logger.lifecycle(":merging yarn and intermediary")
String[] args = [ String[] args = [
intermediaryTinyInput.getAbsolutePath(), intermediaryTinyInput.getAbsolutePath(),
yarnTinyInput.getAbsolutePath(), yarnTinyInput.getAbsolutePath(),
unorderedResultMappings.getAbsolutePath(), unorderedResultMappings.getAbsolutePath(),
"intermediary", "intermediary",
"official" "official"
] ]
new CommandMergeTiny().run(args) new CommandMergeTiny().run(args)
logger.lifecycle(":reordering merged intermediary") logger.lifecycle(":reordering merged intermediary")
String[] args2 = [ String[] args2 = [
unorderedResultMappings.getAbsolutePath(), unorderedResultMappings.getAbsolutePath(),
resultMappings.getAbsolutePath(), output.getAbsolutePath(),
"official", "intermediary", "named" "official", "intermediary", "named"
] ]
new CommandReorderTiny().run(args2) new CommandReorderTiny().run(args2)
} }
} }
task tinyJar(type: Jar, dependsOn: "mergeTiny") { task tinyJar(type: Jar, dependsOn: mergeTiny) {
group = buildMappingGroup group = buildMappingGroup
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
archiveName = "yarn-${yarnVersion}.jar" archiveName = "yarn-${yarnVersion}.jar"
destinationDir(file("build/libs")) destinationDir(file("build/libs"))
classifier = "" classifier = ""
from (mergeTiny.fileOutput) { from(mergeTiny.output) {
rename { "mappings/mappings.tiny" } rename { "mappings/mappings.tiny" }
} }
} }
task compressTiny(dependsOn: ["tinyJar", "mergeTiny"], type: FileOutput){ task compressTiny(dependsOn: [tinyJar, mergeTiny], type: FileOutput) {
group = buildMappingGroup group = buildMappingGroup
def outputFile = new File(libs, "yarn-tiny-${yarnVersion}.gz") def outputFile = new File(libs, "yarn-tiny-${yarnVersion}.gz")
outputs.file(outputFile) outputs.file(outputFile)
fileOutput = outputFile output = outputFile
def inputFile = mergeTiny.fileOutput def inputFile = mergeTiny.output
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":compressing tiny mappings") logger.lifecycle(":compressing tiny mappings")
@ -445,57 +473,56 @@ clean.doFirst {
delete tempDir, cacheFilesMinecraft delete tempDir, cacheFilesMinecraft
} }
tasks.build.dependsOn "compressTiny" tasks.build.dependsOn "compressTiny","tinyJar","v2UnmergedYarnJar"
tasks.build.dependsOn "tinyJar"
task mapYarnJar(dependsOn: ["compressTiny", "mapIntermediaryJar"]) { task mapYarnJar(dependsOn: [compressTiny, mapIntermediaryJar]) {
group = mapJarGroup group = mapJarGroup
inputs.files downloadMcLibs.outputs.files.files inputs.files downloadMcLibs.outputs.files.files
outputs.file(yarnJar) outputs.file(yarnJar)
//Force the task to always run //Force the task to always run
outputs.upToDateWhen {false} outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":mapping minecraft to yarn") logger.lifecycle(":mapping minecraft to yarn")
def tinyInput = new File("build/libs/yarn-tiny-${yarnVersion}.gz") File tinyInput = compressTiny.output
mapJar(yarnJar, intermediaryJar, tinyInput, libraries, "intermediary", "named") mapJar(yarnJar, intermediaryJar, tinyInput, libraries, "intermediary", "named")
} }
} }
task exportMappingsOfficial(dependsOn: "downloadIntermediary") { task exportMappingsOfficial(dependsOn: extractIntermediary) {
def composeInput = downloadIntermediary.dest def composeInput = extractIntermediary.output
doLast { doLast {
logger.lifecycle(":exporting mappings") logger.lifecycle(":exporting mappings")
String[] args = [ String[] args = [
"tiny", "tiny",
composeInput.getAbsolutePath(), composeInput.getAbsolutePath(),
"enigma", "enigma",
file("mappings/").getAbsolutePath(), file("mappings/").getAbsolutePath(),
"enigma", "enigma",
file("mappings_official/").getAbsolutePath(), file("mappings_official/").getAbsolutePath(),
"right" "right"
] ]
new ComposeMappingsCommand().run(args) new ComposeMappingsCommand().run(args)
} }
} }
task importMappingsOfficial(dependsOn: "invertIntermediary") { task importMappingsOfficial(dependsOn: invertIntermediary) {
def composeInput = invertIntermediary.fileOutput def composeInput = invertIntermediary.output
doLast { doLast {
logger.lifecycle(":importing mappings") logger.lifecycle(":importing mappings")
String[] args = [ String[] args = [
"tiny", "tiny",
composeInput.getAbsolutePath(), composeInput.getAbsolutePath(),
"enigma", "enigma",
file("mappings_official/").getAbsolutePath(), file("mappings_official/").getAbsolutePath(),
"enigma", "enigma",
file("mappings/").getAbsolutePath(), file("mappings/").getAbsolutePath(),
"right" "right"
] ]
new ComposeMappingsCommand().run(args) new ComposeMappingsCommand().run(args)
@ -504,19 +531,18 @@ task importMappingsOfficial(dependsOn: "invertIntermediary") {
task buildTinyWithEnum(dependsOn: "mergeTiny", type: FileOutput) { task buildTinyWithEnum(dependsOn: "mergeTiny", type: FileOutput) {
group = buildMappingGroup group = buildMappingGroup
def noEnum = mergeTiny.fileOutput def noEnum = mergeTiny.output
def namedWithEnum = new File(tempDir, "named-with-enum.tiny") output = new File(tempDir, "named-with-enum.tiny")
fileOutput = namedWithEnum
outputs.file(namedWithEnum) outputs.file(output)
outputs.upToDateWhen { false } outputs.upToDateWhen { false }
doLast { doLast {
logger.lifecycle(":seeking auto-mappable fields") logger.lifecycle(":seeking auto-mappable fields")
String[] argsPropose = [ String[] argsPropose = [
mergedFile.getAbsolutePath(), // must use official jar mergedFile.getAbsolutePath(), // must use official jar
noEnum.getAbsolutePath(), noEnum.getAbsolutePath(),
namedWithEnum.getAbsolutePath() output.getAbsolutePath()
] ]
new CommandProposeFieldNames().run(argsPropose) new CommandProposeFieldNames().run(argsPropose)
@ -534,10 +560,42 @@ task mapNamedJar(dependsOn: [buildTinyWithEnum, mapIntermediaryJar]) {
doLast { doLast {
logger.lifecycle(":mapping minecraft to named") logger.lifecycle(":mapping minecraft to named")
mapJar(namedJar, intermediaryJar, buildTinyWithEnum.fileOutput, libraries, "intermediary", "named") mapJar(namedJar, intermediaryJar, buildTinyWithEnum.output, libraries, "intermediary", "named")
} }
} }
task insertAutoGeneratedEnumMappings(dependsOn : [buildYarnTiny,mapIntermediaryJar], type : FileOutput){
group = buildMappingGroup
def noEnumV2 = buildYarnTiny.v2Output
output = new File(tempDir, "unmerged-named-v2-with-enum.tiny")
outputs.upToDateWhen { false }
doLast {
logger.lifecycle(":seeking auto-mappable fields for unmerged mappings")
String[] argsProposeV2 = [
intermediaryJar.getAbsolutePath(), // must use intermediary jar
noEnumV2.getAbsolutePath(),
output.getAbsolutePath()
]
new CommandProposeV2FieldNames().run(argsProposeV2)
}
}
task v2UnmergedYarnJar(dependsOn: insertAutoGeneratedEnumMappings, type: Jar) {
def mappings = insertAutoGeneratedEnumMappings.output
group = "mapping build"
outputs.upToDateWhen { false }
archiveName = "yarn-${yarnVersion}-v2.jar"
from(file(mappings)) {
rename mappings.name, "mappings/mappings.tiny"
}
destinationDir(file("build/libs"))
}
publishing { publishing {
publications { publications {
@ -546,12 +604,16 @@ publishing {
artifactId "yarn" artifactId "yarn"
version yarnVersion version yarnVersion
artifact (compressTiny.fileOutput) { artifact(compressTiny.output) {
classifier "tiny" classifier "tiny"
builtBy compressTiny builtBy compressTiny
} }
artifact (tinyJar) artifact(tinyJar)
artifact(v2UnmergedYarnJar) {
classifier "v2"
}
} }
} }
repositories { repositories {
maven { maven {
@ -567,23 +629,23 @@ publishing {
} }
void mapJar(File output, File input, File mappings, File libraries, String from, String to){ void mapJar(File output, File input, File mappings, File libraries, String from, String to) {
if (output.exists()) { if (output.exists()) {
output.delete() output.delete()
} }
def remapper = TinyRemapper.newRemapper() def remapper = TinyRemapper.newRemapper()
.withMappings(TinyUtils.createTinyMappingProvider(mappings.toPath(), from, to)) .withMappings(TinyUtils.createTinyMappingProvider(mappings.toPath(), from, to))
.renameInvalidLocals(true) .renameInvalidLocals(true)
.rebuildSourceFilenames(true) .rebuildSourceFilenames(true)
.build() .build()
try { try {
def outputConsumer = new OutputConsumerPath(output.toPath()) def outputConsumer = new OutputConsumerPath(output.toPath())
outputConsumer.addNonClassFiles(input.toPath()) outputConsumer.addNonClassFiles(input.toPath())
remapper.readInputs(input.toPath()) remapper.readInputs(input.toPath())
libraries.eachFileRecurse(FileType.FILES) {file -> libraries.eachFileRecurse(FileType.FILES) { file ->
remapper.readClassPath(file.toPath()) remapper.readClassPath(file.toPath())
} }
remapper.apply(outputConsumer) remapper.apply(outputConsumer)
@ -596,5 +658,13 @@ void mapJar(File output, File input, File mappings, File libraries, String from,
} }
class FileOutput extends DefaultTask { class FileOutput extends DefaultTask {
@OutputFile File fileOutput @OutputFile
File output
} }
class WithV2FileOutput extends DefaultTask {
@OutputFile
File v1Output
@OutputFile
File v2Output
}

View File

@ -1,5 +1,6 @@
#Wed Oct 16 22:10:09 IDT 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME