Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Oct 15, 2023
1 parent bbac3fb commit 9c9eaa7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class SoftSpoonTasks(
remapperClasspath.from(macheRemapper)
paramMappings.from(macheParamMappings)

outputJar.set(layout.cache.resolve(FINAL_REMAPPED_JAR))
outputJar.set(layout.cache.resolve(FINAL_REMAPPED_CODEBOOK_JAR))
}

val macheDecompileJar by tasks.registering(DecompileJar::class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ abstract class RemapCBPatches : BaseTask() {
Path.of("C:\\Users\\Martin\\.m2\\repository\\org\\jetbrains\\annotations\\24.0.1\\annotations-24.0.1.jar")
)

println("dum $classpath")

val merc = Mercury()
merc.classPath.addAll(classpath)
merc.processors.addAll(
Expand All @@ -73,7 +71,7 @@ abstract class RemapCBPatches : BaseTask() {
val source = sourceRoot.resolve(relativePath)
val decomp = decompRoot.resolve(relativePath)

if (!source.exists() || !decomp.exists()) return 0
if (!source.exists() || !decomp.exists()) return 0

val sourceLines = source.readLines(Charsets.UTF_8)
val decompLines = decomp.readLines(Charsets.UTF_8)
Expand All @@ -84,9 +82,9 @@ abstract class RemapCBPatches : BaseTask() {
}

// remove all non craftbukkit chunks
patch.deltas.removeIf {
!it.target.lines.any { l -> l.contains("CraftBukkit") }
}
//patch.deltas.removeIf {
// !it.target.lines.any { line -> line.contains("CraftBukkit") && !line.contains("decompile error") }
//}

val unifiedPatch = UnifiedDiffUtils.generateUnifiedDiff(
"a/$relativePath",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ abstract class ApplyPatches: DefaultTask() {

val result = createPatcher().applyPatches(input.get().path, patches.get().path, output.get().path, output.get().path)

if (result is PatchFailure) {
result.failures
.map { "Patch failed: ${it.patch.relativeTo(patches.get().path)}: ${it.details}" }
.forEach { logger.error(it) }
throw Exception("Failed to apply ${result.failures.size} patches")
}

// TODO ideally we manage to make a commit with just the patch changes
val git = Git.init()
.setDirectory(output.convertToPath().toFile())
Expand All @@ -73,6 +66,13 @@ abstract class ApplyPatches: DefaultTask() {
.setSign(false)
.call()
git.tag().setName(PATCHED_TAG).setTagger(macheIdent).setSigned(false).call()

if (result is PatchFailure) {
result.failures
.map { "Patch failed: ${it.patch.relativeTo(patches.get().path)}: ${it.details}" }
.forEach { logger.error(it) }
throw Exception("Failed to apply ${result.failures.size} patches")
}
}

internal open fun createPatcher(): Patcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private const val SETUP_CACHE = "$PAPER_PATH/setupCache"
private const val TASK_CACHE = "$PAPER_PATH/taskCache"

const val FINAL_REMAPPED_JAR = "$TASK_CACHE/minecraft.jar"
const val FINAL_REMAPPED_CODEBOOK_JAR = "$TASK_CACHE/codebook-minecraft.jar"
const val FINAL_FILTERED_REMAPPED_JAR = "$TASK_CACHE/filteredMinecraft.jar"
const val FINAL_DECOMPILE_JAR = "$TASK_CACHE/decompileJar.jar"
const val SPIGOT_MACHE_DECOMPILE_JAR = "$TASK_CACHE/macheSpigotDecompileJar.jar"
Expand Down

0 comments on commit 9c9eaa7

Please sign in to comment.