Skip to content

Commit e63f056

Browse files
committed
new gradle task to generate PATCHED.md from simplified file to reduce git conflicts
1 parent 5099607 commit e63f056

File tree

3 files changed

+276
-0
lines changed

3 files changed

+276
-0
lines changed

.bugs

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# This file is used to generate PATCHED.md
2+
# Please run `./gradlew generatePatchedTable` to update PATCHED.md based on this file
3+
# Try not to re-order this file (it sorts itself!), put additions at the end of each section - this helps with git conflicts
4+
5+
patched 577 client basic
6+
patched 4490 client basic
7+
patched 12062 client basic
8+
patched 22882 client basic
9+
patched 35361 client basic
10+
patched 46737 client basic
11+
patched 46766 client basic
12+
patched 57057 client basic
13+
patched 59810 client basic
14+
patched 61489 client basic
15+
patched 79545 client basic
16+
patched 80859 client basic
17+
patched 90683 client basic
18+
patched 93384 client basic
19+
patched 105068 client basic
20+
patched 115092 client basic
21+
patched 116379 client basic
22+
patched 116510 client basic
23+
patched 118740 client basic
24+
patched 122627 client basic
25+
patched 122477 client basic
26+
patched 127970 client basic
27+
patched 143474 client basic
28+
patched 159163 client gameplay
29+
patched 165306 client basic
30+
patched 165381 client basic
31+
patched 168573 client basic
32+
patched 176559 client basic
33+
patched 188359 client basic
34+
patched 197260 client basic
35+
patched 201723 client basic
36+
patched 206540 client basic
37+
patched 210318 client basic
38+
patched 211561 client basic
39+
patched 215531 client basic
40+
patched 217716 client basic
41+
patched 231097 client basic
42+
patched 237493 client basic
43+
patched 242809 client basic
44+
patched 259512 client basic
45+
patched 267376 client basic
46+
patched 268420 client basic
47+
patched 280220 client basic
48+
patched 298225 client basic
49+
patched 298558 client basic
50+
51+
patched 2025 server basic
52+
patched 7569 server basic
53+
patched 8187 server gameplay
54+
patched 30391 server basic
55+
patched 81773 server basic
56+
patched 82263 server basic
57+
patched 84661 server basic
58+
patched 88371 server basic
59+
patched 89146 server basic
60+
patched 93018 server basic
61+
patched 94054 server basic
62+
patched 100991 server basic
63+
patched 119754 server basic
64+
patched 121706 server basic
65+
patched 121903 server basic
66+
patched 123450 server basic
67+
patched 123605 server basic
68+
patched 129909 server basic
69+
patched 132878 server basic
70+
patched 134110 server basic
71+
patched 136249 server basic
72+
patched 139041 server basic
73+
patched 147659 server basic
74+
patched 155509 server basic
75+
patched 159283 server basic
76+
patched 160095 server basic
77+
patched 170462 server basic
78+
patched 176806 server basic
79+
patched 177381 server basic
80+
patched 179072 server basic
81+
patched 183990 server basic
82+
patched 187100 server basic
83+
patched 199467 server basic
84+
patched 200418 server basic
85+
patched 201374 server basic
86+
patched 202637 server basic
87+
patched 206705 server basic
88+
patched 206922 server basic
89+
patched 214147 server basic
90+
patched 215530 server basic
91+
patched 219981 server basic
92+
patched 221257 server basic
93+
patched 223153 server basic
94+
patched 224729 server basic
95+
patched 226961 server basic
96+
patched 227008 server basic
97+
patched 227337 server basic
98+
patched 231743 server basic
99+
patched 232869 server basic
100+
patched 245394 server basic
101+
patched 251068 server basic
102+
patched 267125 server basic
103+
patched 268617 server basic
104+
patched 271899 server basic
105+
patched 272431 server basic
106+
patched 298066 server basic
107+
108+
previous 2025 17w47a
109+
previous 53312 22w17a
110+
previous 72687 22w24a
111+
previous 148149 1.19.1-pre6
112+
previous 235035 22w15a
113+
previous 26757 22w42a
114+
previous 135973 22w42a
115+
previous 145748 22w42a
116+
previous 84873 22w43a
117+
previous 147605 22w46a
118+
previous 151412 22w46a
119+
previous 233042 22w46a
120+
previous 249059 22w46a
121+
previous 228976 1.19.3-pre3
122+
previous 165595 23w03a
123+
previous 162253 23w16a
124+
previous 121772 23w31a
125+
previous 140646 23w31a
126+
previous 90084 23w31a
127+
previous 72151 24w06a
128+
previous 193343 24w18a
129+
previous 14923 24w19a
130+
previous 124177 24w20a
131+
previous 31819 24w21a
132+
previous 227169 24w33a
133+
previous 135971 24w33a
134+
previous 12829 24w44a
135+
previous 55347 24w44a
136+
previous 111516 24w44a
137+
previous 112730 25w21a
138+
previous 183776 25w31a
139+
previous 46503 25w33a
140+
previous 69216 25w33a
141+
previous 119417 25w33a
142+
previous 147784 25w34a
143+
previous 299115 25w34a
144+
previous 267469 1.21.9
145+

PATCHED.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<!--
2+
!!!! DO NOT UPDATE THIS FILE MANUALLY !!!!
3+
Generated by `./gradlew generatePatchedTable`
4+
Sourced from `.bugs`
5+
Generated 11-11-2025 20:23
6+
-->
7+
18
# List of Patched Bugs
29
## Unpatched in vanilla
310
### Client Side

build.gradle.kts

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,127 @@ publishing {
187187
}
188188
}
189189
}
190+
191+
192+
193+
sealed class PatchedFileEntry(val bugNumber: Int) {
194+
val bugId = "MC-$bugNumber"
195+
196+
class Patched(bugNumber: Int, val env: Environment, val type: Type) : PatchedFileEntry(bugNumber) {
197+
enum class Environment(val friendlyName: String) {
198+
Client("Client"), Server("Server");
199+
200+
companion object {
201+
fun from(string: String): Environment? =
202+
when (string) {
203+
"client" -> Client
204+
"server" -> Server
205+
else -> null
206+
}
207+
}
208+
}
209+
enum class Type(val friendlyName: String) {
210+
Basic("Basic"), Gameplay("Gameplay");
211+
212+
companion object {
213+
fun from(string: String): Type? =
214+
when (string) {
215+
"basic" -> Basic
216+
"gameplay" -> Gameplay
217+
else -> null
218+
}
219+
}
220+
}
221+
}
222+
223+
class Previous(bugNumber: Int, val patchVersion: String) : PatchedFileEntry(bugNumber)
224+
}
225+
226+
fun parsePatchedFile(contents: String): List<PatchedFileEntry> {
227+
return contents.lineSequence()
228+
.map { it.trim() }
229+
.filter { it.isNotBlank() && !it.startsWith("#") }
230+
.map { it.lowercase() }
231+
.map { it.split(" ") }
232+
.filter { it.size >= 2 }
233+
.map { words ->
234+
val command = words[0]
235+
val bugNumber = words[1].toInt()
236+
return@map when (command) {
237+
"patched" -> {
238+
if (words.size != 4) throw IllegalArgumentException("patched command must have exactly 4 words: got ${words.joinToString(" ")}")
239+
val env = PatchedFileEntry.Patched.Environment.from(words[2])!!
240+
val type = PatchedFileEntry.Patched.Type.from(words[3])!!
241+
PatchedFileEntry.Patched(bugNumber, env, type)
242+
}
243+
"previous" -> {
244+
if (words.size != 3) throw IllegalArgumentException("previous command must have exactly 3 words: got ${words.joinToString(" ")}")
245+
val fixVersion = words[2]
246+
PatchedFileEntry.Previous(bugNumber, fixVersion)
247+
}
248+
else -> throw IllegalArgumentException("Unknown command: $command")
249+
}
250+
}
251+
.toList()
252+
.sortedBy { it.bugNumber }
253+
}
254+
fun getBugDescription(bugId: String): String {
255+
// TODO: waiting for mojira.dev public JSON API for this
256+
return "TODO"
257+
}
258+
259+
val generatePatchedTable by tasks.registering {
260+
val inputFile = rootProject.file(".bugs")
261+
inputs.file(inputFile)
262+
263+
val outputFile = rootProject.file("PATCHED.md")
264+
outputs.file(outputFile)
265+
266+
group = "debugify-utils"
267+
268+
doLast {
269+
val inputContents = inputFile.readText()
270+
val entries = parsePatchedFile(inputContents)
271+
272+
val patched = entries.filterIsInstance<PatchedFileEntry.Patched>()
273+
val clientPatched = patched.filter { it.env == PatchedFileEntry.Patched.Environment.Client }
274+
val serverPatched = patched.filter { it.env == PatchedFileEntry.Patched.Environment.Server }
275+
fun generatePatchedRows(entries: List<PatchedFileEntry.Patched>) =
276+
entries.joinToString("\n") { "- | ${it.type.friendlyName} | [${it.bugId}](https://mojira.dev/${it.bugId}) | ${getBugDescription(it.bugId)} |" }
277+
278+
val previous = entries.filterIsInstance<PatchedFileEntry.Previous>()
279+
280+
val timestamp = `java.time`.LocalDateTime.now().format(`java.time.format`.DateTimeFormatter.ISO_DATE_TIME)
281+
282+
val markdownTable = """
283+
- <!--
284+
- !!!! DO NOT UPDATE THIS FILE MANUALLY !!!!
285+
- Generated by `./gradlew generatePatchedTable`
286+
- Sourced from `${inputFile.name}`
287+
- Generated $timestamp
288+
- -->
289+
-
290+
- # List of Patched Bugs
291+
- ## Unpatched in vanilla
292+
- ### Client side
293+
- | Type | Bug ID | Name |
294+
- |------|--------|------|
295+
${generatePatchedRows(clientPatched)}
296+
297+
- ### Server side (both)
298+
- | Type | Bug ID | Name |
299+
- |------|--------|------|
300+
${generatePatchedRows(serverPatched)}
301+
302+
- ## Previously patched
303+
- Bugs that this mod has patched in the past, but has since been fixed by a vanilla update.
304+
305+
- | Bug ID | Name | Fixed Version |
306+
- |--------|------|---------------|
307+
${previous.joinToString("\n") { "- | [${it.bugId}](https://mojira.dev/${it.bugId}) | ${getBugDescription(it.bugId)} | ${it.patchVersion} |" }}
308+
""".trimMargin("-")
309+
310+
outputFile.parentFile.mkdirs()
311+
outputFile.writeText(markdownTable)
312+
}
313+
}

0 commit comments

Comments
 (0)