Skip to content

Commit 8dfb6bd

Browse files
committed
comment out the custom task for now
1 parent 5471cee commit 8dfb6bd

1 file changed

Lines changed: 41 additions & 42 deletions

File tree

purpur-server/build.gradle.kts.patch

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -104,48 +104,47 @@
104104
idea {
105105
module {
106106
generatedSourceDirs.add(generatedDir.toFile())
107-
@@ -375,4 +_,44 @@
108-
description = "Spin up a test server from the reobf Paperclip jar"
107+
@@ -376,3 +_,43 @@
109108
classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip })
110109
mainClass.set(null as String?)
111-
+}
112-
+
113-
+tasks.register("rebuildMinecraftSourcesWithGit") {
114-
+ group = "temp"
115-
+
116-
+ val patchDir = project.rootDir.resolve("purpur-server/minecraft-patches/sources").convertToPath().cleanDir()
117-
+ val inputDir = this.project.rootDir.resolve("purpur-server/src/minecraft/java").convertToPath()
118-
+
119-
+ val git = Git(inputDir)
120-
+ git("stash", "push").executeSilently(silenceErr = true)
121-
+ git("checkout", "file").executeSilently(silenceErr = true)
122-
+
123-
+ rebuildWithGit(git, patchDir)
124-
+}
125-
+
126-
+private fun rebuildWithGit(
127-
+ git: Git,
128-
+ patchDir: java.nio.file.Path
129-
+): Int {
130-
+ val files = git("diff-tree", "--name-only", "--no-commit-id", "-r", "HEAD").getText().split("\n")
131-
+ files.parallelStream().forEach { filename ->
132-
+ if (filename.isBlank()) return@forEach
133-
+ val patch = git(
134-
+ "format-patch",
135-
+ "--diff-algorithm=myers",
136-
+ "--full-index",
137-
+ "--no-signature",
138-
+ "--no-stat",
139-
+ "--no-numbered",
140-
+ "-1",
141-
+ "HEAD",
142-
+ "--stdout",
143-
+ filename
144-
+ ).getText()
145-
+ val patchFile = patchDir.resolve("$filename.patch")
146-
+ patchFile.createParentDirectories()
147-
+ patchFile.writeText(patch)
148-
+ }
149-
+
150-
+ return files.size
151110
}
111+
+
112+
+// tasks.register("rebuildMinecraftSourcesWithGit") {
113+
+// group = "temp"
114+
+//
115+
+// val patchDir = project.rootDir.resolve("purpur-server/minecraft-patches/sources").convertToPath().cleanDir()
116+
+// val inputDir = this.project.rootDir.resolve("purpur-server/src/minecraft/java").convertToPath()
117+
+//
118+
+// val git = Git(inputDir)
119+
+// git("stash", "push").executeSilently(silenceErr = true)
120+
+// git("checkout", "file").executeSilently(silenceErr = true)
121+
+//
122+
+// rebuildWithGit(git, patchDir)
123+
+// }
124+
+//
125+
+// private fun rebuildWithGit(
126+
+// git: Git,
127+
+// patchDir: java.nio.file.Path
128+
+// ): Int {
129+
+// val files = git("diff-tree", "--name-only", "--no-commit-id", "-r", "HEAD").getText().split("\n")
130+
+// files.parallelStream().forEach { filename ->
131+
+// if (filename.isBlank()) return@forEach
132+
+// val patch = git(
133+
+// "format-patch",
134+
+// "--diff-algorithm=myers",
135+
+// "--full-index",
136+
+// "--no-signature",
137+
+// "--no-stat",
138+
+// "--no-numbered",
139+
+// "-1",
140+
+// "HEAD",
141+
+// "--stdout",
142+
+// filename
143+
+// ).getText()
144+
+// val patchFile = patchDir.resolve("$filename.patch")
145+
+// patchFile.createParentDirectories()
146+
+// patchFile.writeText(patch)
147+
+// }
148+
+//
149+
+// return files.size
150+
+// }

0 commit comments

Comments
 (0)