|
8 | 8 |
|
9 | 9 | plugins { |
10 | 10 | `java-library` |
11 | | -@@ -20,13 +_,65 @@ |
12 | | - testRuntimeOnly("org.junit.platform:junit-platform-launcher") |
13 | | - } |
14 | | - |
15 | | -+tasks.register("rebuildMinecraftSourcesWithGit") { |
16 | | -+ group = "temp" |
17 | | -+ |
18 | | -+ val patchDir = project.rootDir.resolve("purpur-server/minecraft-patches/sources").convertToPath().cleanDir() |
19 | | -+ val inputDir = this.project.rootDir.resolve("purpur-server/src/minecraft/java").convertToPath() |
20 | | -+ |
21 | | -+ val git = Git(inputDir) |
22 | | -+ git("stash", "push").executeSilently(silenceErr = true) |
23 | | -+ git("checkout", "file").executeSilently(silenceErr = true) |
24 | | -+ |
25 | | -+ rebuildWithGit(git, patchDir) |
26 | | -+} |
27 | | -+ |
28 | | -+private fun rebuildWithGit( |
29 | | -+ git: Git, |
30 | | -+ patchDir: java.nio.file.Path |
31 | | -+): Int { |
32 | | -+ val files = git("diff-tree", "--name-only", "--no-commit-id", "-r", "HEAD").getText().split("\n") |
33 | | -+ files.parallelStream().forEach { filename -> |
34 | | -+ if (filename.isBlank()) return@forEach |
35 | | -+ val patch = git( |
36 | | -+ "format-patch", |
37 | | -+ "--diff-algorithm=myers", |
38 | | -+ "--full-index", |
39 | | -+ "--no-signature", |
40 | | -+ "--no-stat", |
41 | | -+ "--no-numbered", |
42 | | -+ "-1", |
43 | | -+ "HEAD", |
44 | | -+ "--stdout", |
45 | | -+ filename |
46 | | -+ ).getText() |
47 | | -+ val patchFile = patchDir.resolve("$filename.patch") |
48 | | -+ patchFile.createParentDirectories() |
49 | | -+ patchFile.writeText(patch) |
50 | | -+ } |
51 | | -+ |
52 | | -+ return files.size |
53 | | -+} |
54 | | -+ |
55 | | - paperweight { |
| 11 | +@@ -24,9 +_,21 @@ |
56 | 12 | minecraftVersion = providers.gradleProperty("mcVersion") |
57 | 13 | gitFilePatches = false |
58 | 14 |
|
|
75 | 31 | + // Purpur end - Rebrand |
76 | 32 |
|
77 | 33 | spigot { |
78 | | - buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc" |
79 | | -@@ -108,7 +_,21 @@ |
| 34 | + enabled = false |
| 35 | +@@ -109,7 +_,21 @@ |
80 | 36 | } |
81 | 37 | } |
82 | 38 |
|
|
99 | 55 | configurations.named(log4jPlugins.compileClasspathConfigurationName) { |
100 | 56 | extendsFrom(configurations.compileClasspath.get()) |
101 | 57 | } |
102 | | -@@ -130,7 +_,7 @@ |
| 58 | +@@ -131,7 +_,7 @@ |
103 | 59 | } |
104 | 60 |
|
105 | 61 | dependencies { |
|
108 | 64 | implementation("ca.spottedleaf:concurrentutil:0.0.3") |
109 | 65 | implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ |
110 | 66 | implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 |
111 | | -@@ -158,6 +_,10 @@ |
| 67 | +@@ -159,6 +_,10 @@ |
112 | 68 | implementation("org.spongepowered:configurate-yaml:4.2.0-20250225.064233-199") |
113 | 69 | implementation("org.spongepowered:configurate-core:4.2.0-20250225.064233-204") // Pinned dependency of above pinned yaml snapshot. |
114 | 70 |
|
|
119 | 75 | // Deps that were previously in the API but have now been moved here for backwards compat, eventually to be removed |
120 | 76 | runtimeOnly("commons-lang:commons-lang:2.6") |
121 | 77 | runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0") |
122 | | -@@ -206,14 +_,14 @@ |
| 78 | +@@ -207,14 +_,14 @@ |
123 | 79 | val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() |
124 | 80 | attributes( |
125 | 81 | "Main-Class" to "org.bukkit.craftbukkit.Main", |
|
139 | 95 | "Build-Number" to (build ?: ""), |
140 | 96 | "Build-Time" to buildTime.toString(), |
141 | 97 | "Git-Branch" to gitBranch, |
142 | | -@@ -267,7 +_,7 @@ |
| 98 | +@@ -273,7 +_,7 @@ |
143 | 99 | jvmArgumentProviders.add(provider) |
144 | 100 | } |
145 | 101 |
|
146 | 102 | -val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() |
147 | | -+val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("../paper-server/src/generated/java").asFile.toPath() |
| 103 | ++val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("../paper-server/src/generated/java").asFile.toPath() // Purpur |
148 | 104 | idea { |
149 | 105 | module { |
150 | 106 | generatedSourceDirs.add(generatedDir.toFile()) |
| 107 | +@@ -375,4 +_,44 @@ |
| 108 | + description = "Spin up a test server from the reobf Paperclip jar" |
| 109 | + classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip }) |
| 110 | + 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 |
| 151 | + } |
0 commit comments