fix issues relating to some root structure changes

This commit is contained in:
Jake Potrebic 2024-09-01 20:22:13 -07:00
parent 59e26185ee
commit 87220867d9
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
2 changed files with 12 additions and 13 deletions

View file

@ -59,6 +59,10 @@ abstract class ApplyServerSourceAndNmsPatches : BaseTask() {
if (paperDecompiledSource.isPresent && Files.notExists(nmsFile)) {
nmsFile = paperDecompiledSource.file(fileName).get().path
}
if (Files.notExists(nmsFile)) {
// we add new files within src/main/resources/data/minecraft/ but they don't exist in the nms source
return@forEach
}
val patchFile = patchDir.resolve(fileName).resolveSibling((patchedFile.name + ".patch")) // keep extension
val commandText =
@ -85,9 +89,9 @@ abstract class ApplyServerSourceAndNmsPatches : BaseTask() {
val patchName = patch.name.split("-", limit = 2)[1]
println("Applying Patch: $patchName")
val excludeArray = directoriesToPatch.get().map { "--exclude=$it/**" }.toTypedArray()
git("am", "--ignore-whitespace", *excludeArray, patch.toPath().absolutePathString()).execute()
git("am", "--ignore-whitespace", "--include=src/main/resources/data/minecraft/datapacks/paper/**", *excludeArray, "--include=**", patch.toPath().absolutePathString()).execute()
val includeArray = directoriesToPatch.get().map { "--include=$it/**" }.toTypedArray()
git("apply", "--ignore-whitespace", *includeArray, patch.toPath().absolutePathString()).execute()
git("apply", "--ignore-whitespace", "--exclude=src/main/resources/data/minecraft/datapacks/paper/**", *includeArray, patch.toPath().absolutePathString()).execute()
val (sourceFiles, dataFiles) = McDev.readPatchLines(listOf(patch.toPath()))
createPerFileDiff(sourcePatchesDir, sourceFiles, "src/main/java/")

View file

@ -32,18 +32,13 @@ abstract class FinalizePaperHistory : BaseTask() {
@TaskAction
fun run() {
Git.checkForGit()
val deletionsArr = deletions.get().toTypedArray()
if (deletionsArr.isEmpty()) {
return
}
Git(paperDir).let { git ->
val paperMojangApi = outputDir.path.resolve("Paper-MojangAPI/src/main/java")
paperMojangApi.copyRecursivelyTo(outputDir.path.resolve("paper-api/src/main/java"))
paperMojangApi.deleteRecursive()
git("add", "paper-api/src/main/java", "Paper-MojangAPI").execute()
git("commit", "--message", "Merge Paper-MojangAPI into Paper API", "--author=Automated <auto@mated.null>").execute()
val deletionsArr = deletions.get().toTypedArray()
if (deletionsArr.isNotEmpty()) {
git("rm", "-r", *deletionsArr).execute()
git("commit", "-m", "OWW! That fork is HARD!", "--author=Automated <auto@mated.null>").execute()
}
git("rm", "-r", *deletionsArr).execute()
git("commit", "-m", "OWW! That fork is HARD!", "--author=Automated <auto@mated.null>").execute()
}
}
}