Skip to content

Commit

Permalink
fix issues relating to some root structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Sep 2, 2024
1 parent 59e2618 commit 8722086
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>").execute()

val deletionsArr = deletions.get().toTypedArray()
if (deletionsArr.isNotEmpty()) {
git("rm", "-r", *deletionsArr).execute()
git("commit", "-m", "OWW! That fork is HARD!", "--author=Automated <[email protected]>").execute()
}
git("rm", "-r", *deletionsArr).execute()
git("commit", "-m", "OWW! That fork is HARD!", "--author=Automated <[email protected]>").execute()
}
}
}

0 comments on commit 8722086

Please sign in to comment.