cache mercury instance, checkout remapped before generating patches

This commit is contained in:
MiniDigger 2020-11-16 23:43:46 +01:00
parent 0625c87c9a
commit 8f16482d64
2 changed files with 17 additions and 35 deletions

View file

@ -102,6 +102,7 @@ class PatchApplier(
fun generatePatches(target: File) {
target.deleteRecursively()
target.mkdirs()
git("checkout", "-b", remappedBranch).executeSilently()
git(
"format-patch", "--zero-commit", "--full-index", "--no-signature", "--no-stat", "-N", "-o",
target.absolutePath, remappedBaseTag

View file

@ -32,52 +32,33 @@ import org.cadixdev.mercury.Mercury
import org.cadixdev.mercury.remapper.MercuryRemapper
class PatchSourceRemapWorker(
private val mappings: MappingSet,
private val classpath: Collection<Path>,
private val paramNames: ParamNames,
private val constructorsData: ConstructorsData,
mappings: MappingSet,
classpath: Collection<Path>,
paramNames: ParamNames,
constructorsData: ConstructorsData,
private val inputDir: Path,
private val outputDir: Path
) {
// private val reverseMappings: MappingSet = mappings.reverse()
private val merc : Mercury = Mercury()
// fun remap() {
// setup()
//
// println("remapping to spigot")
// Mercury().let { merc ->
// merc.classPath.addAll(classpath)
//
// merc.processors.addAll(listOf(
// MercuryRemapper.create(reverseMappings),
// PatchParameterRemapper(paramNames, constructorsData)
// ))
//
// merc.isGracefulClasspathChecks = true
//
// merc.rewrite(inputDir, outputDir)
// }
//
// cleanup()
// }
init {
merc.classPath.addAll(classpath)
merc.processors.addAll(listOf(
MercuryRemapper.create(mappings),
SrgParameterRemapper(mappings, constructorsData, paramNames)
))
merc.isGracefulClasspathChecks = true
}
fun remap() {
setup()
println("mapping back to srg")
Mercury().let { merc ->
merc.classPath.addAll(classpath)
merc.processors.addAll(listOf(
MercuryRemapper.create(mappings),
SrgParameterRemapper(mappings, constructorsData, paramNames)
))
merc.isGracefulClasspathChecks = true
merc.rewrite(inputDir, outputDir)
}
merc.rewrite(inputDir, outputDir)
cleanup()
}