-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathexpandmcpb.py
48 lines (38 loc) · 1.32 KB
/
expandmcpb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python
# "Expand" MCPBukkit source on top of MCP source, applying patches, renaming to csv, etc.
#
# https://github.com/MinecraftForge/MCPBukkit
import shutil, difflib, os, sys
SPIGOT = len(sys.argv) > 1
print "Spigot?",SPIGOT
outDir = "/tmp/out"
fmlDir = "../Srg2Source/python/fml"
mcpDir = os.path.join(fmlDir, "mcp")
vanillaSrc = os.path.join(mcpDir, "src/minecraft_server") # decompiled server with srgnames
cbPatches = "../MCPBukkit/patches"
obc = "../MCPBukkit/src"
spigot = "../CraftBukkit/src/main/java" # Spigot-Server (patches applied)
print "Copying vanilla source"
if os.path.exists(outDir):
shutil.rmtree(outDir)
if SPIGOT:
shutil.copytree("../CraftBukkit/src/main/java", outDir)
else:
shutil.copytree(vanillaSrc, outDir)
shutil.copytree(os.path.join(obc, "org"), os.path.join(outDir, "org"))
if not SPIGOT:
print "Applying CraftBukkit NMS patches"
sys.path.append(os.path.join(fmlDir))
import fml
fml.apply_patches(mcpDir, cbPatches, os.path.join(outDir, "net")) # .../
sys.path.append(mcpDir)
import runtime.commands
pushd = os.getcwd()
os.chdir(mcpDir)
commands = runtime.commands.Commands()
commands.srcserver = outDir
print "Adding javadoc"
commands.process_javadoc(runtime.commands.SERVER)
print "Renaming srg->csv"
commands.process_rename(runtime.commands.SERVER)
os.chdir(pushd)