Modified merger to just consider all server classes as common. And moved the defnition of CodecMus to the config.

This commit is contained in:
LexManos 2012-11-19 17:45:53 -08:00
parent 745b697779
commit 397d36e900
4 changed files with 35 additions and 61 deletions

View file

@ -45,6 +45,7 @@ public class MCPMerger
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
private static HashSet<String> copyToServer = new HashSet<String>();
private static HashSet<String> copyToClient = new HashSet<String>();
private static HashSet<String> dontAnnotate = new HashSet<String>();
private static final boolean DEBUG = false;
public static void main(String[] args)
@ -134,11 +135,16 @@ public class MCPMerger
String line;
while ((line = br.readLine()) != null)
{
line = line.split("#")[0];
boolean toClient = line.charAt(0) == '<';
line = line.split("#")[0];
char cmd = line.charAt(0);
line = line.substring(1).trim();
if (toClient) copyToClient.add(line);
else copyToServer.add(line);
switch (cmd)
{
case '!': dontAnnotate.add(line); break;
case '<': copyToClient.add(line); break;
case '>': copyToServer.add(line); break;
}
}
in.close();
@ -225,20 +231,14 @@ public class MCPMerger
cAdded.add(name);
sAdded.add(name);
}
for (Entry<String, ZipEntry> entry : sClasses.entrySet())
{
if (!copyToClient.contains(entry.getKey()))
if (DEBUG)
{
copyClass(sInJar, entry.getValue(), null, sOutJar, false);
}
else
{
if (DEBUG)
{
System.out.println("Copy class s->c : " + entry.getKey());
}
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
System.out.println("Copy class s->c : " + entry.getKey());
}
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
}
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
@ -289,7 +289,7 @@ public class MCPMerger
reader.accept(classNode, 0);
if (!classNode.name.equals("beg")) //Special case CodecMus so I dont have to make a new patch, anyone who uses this in production code is.. bad.
if (!dontAnnotate.contains(classNode.name))
{
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));

View file

@ -401,38 +401,31 @@ def merge_client_server(mcp_dir):
if not os.path.isdir(shared):
os.makedirs(shared)
client_classes = []
server_classes = []
zip = ZipFile(client_jar)
for i in zip.filelist:
if i.filename.endswith('.class'):
client_classes.append(i.filename[:-6])
zip = ZipFile(server_jar)
for i in zip.filelist:
if i.filename.endswith('.class'):
server_classes.append(i.filename[:-6])
for cls in client_classes:
if cls in server_classes:
if cls in joined_srg.keys():
cls = joined_srg[cls]
cls += '.java'
for cls in server_classes:
if cls in joined_srg.keys():
cls = joined_srg[cls]
cls += '.java'
f_client = os.path.normpath(os.path.join(client, cls.replace('/', os.path.sep))).replace(os.path.sep, '/')
f_shared = os.path.normpath(os.path.join(shared, cls.replace('/', os.path.sep))).replace(os.path.sep, '/')
f_client = os.path.normpath(os.path.join(client, cls.replace('/', os.path.sep))).replace(os.path.sep, '/')
f_shared = os.path.normpath(os.path.join(shared, cls.replace('/', os.path.sep))).replace(os.path.sep, '/')
if not os.path.isfile(f_client):
print 'Issue Merging File Not Found: ' + cls
continue
if not os.path.isfile(f_client):
print 'Issue Merging File Not Found: ' + cls
continue
if not cls.rfind('/') == -1:
new_dir = os.path.join(shared, cls.rsplit('/', 1)[0])
if not os.path.isdir(new_dir):
os.makedirs(new_dir)
if not cls.rfind('/') == -1:
new_dir = os.path.join(shared, cls.rsplit('/', 1)[0])
if not os.path.isdir(new_dir):
os.makedirs(new_dir)
shutil.move(f_client, f_shared)
shutil.move(f_client, f_shared)
cleanDirs(client)
@ -728,7 +721,7 @@ def get_conf_copy(mcp_dir, fml_dir):
common_srg = gen_merged_srg(mcp_dir, fml_dir)
common_exc = gen_merged_exc(mcp_dir, fml_dir)
common_map = gen_shared_searge_names(common_srg, common_exc)
#ToDo use common_map to merge the remaining csvs, client taking precidense, setting the common items to side '2' and editing commands.py in FML to have 'if csv_side == side || csv_side == '2''
gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'fields.csv'), os.path.join(fml_dir, 'conf', 'fields.csv'))
gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'methods.csv'), os.path.join(fml_dir, 'conf', 'methods.csv'))
gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'params.csv'), os.path.join(fml_dir, 'conf', 'params.csv'), main_key='param')

View file

@ -1,20 +1 @@
>pl #net/minecraft/src/IBossDisplayData
>ji #net/minecraft/src/IStatStringFormat
>xu #net/minecraft/src/ColorizerGrass
>xr #net/minecraft/src/ColorizerFoliage
>aom #org/bouncycastle/crypto/CipherKeyGenerator
>aor #org/bouncycastle/crypto/KeyGenerationParameters
>jw #net/minecraft/src/HttpUtilRunnable
>uw #net/minecraft/src/EnumRarity
>aid #net/minecraft/src/SaveFormatComparator
>jx #net/minecraft/src/IDownloadSuccess
<fx #net/minecraft/src/ThreadDedicatedServer
<hv #net/minecraft/src/ServerGUI
<hw #net/minecraft/src/ServerWindowAdapter
<hx #net/minecraft/src/ServerGuiCommandListener
<hy #net/minecraft/src/ServerGuiFocusAdapter
<hz #net/minecraft/src/PlayerListBox
<ia #net/minecraft/src/GuiStatsComponent
<ib #net/minecraft/src/GuiStatsListener
<ic #net/minecraft/src/GuiLogOutputHandler
<id #net/minecraft/src/GuiLogFormatter
!beg #net/minecraft/src/CodecMus

View file

@ -1,5 +1,5 @@
--- ../src-base/common/net/minecraft/src/IBossDisplayData.java
+++ ../src-work/common/net/minecraft/src/IBossDisplayData.java
--- ../src-base/minecraft/net/minecraft/src/IBossDisplayData.java
+++ ../src-work/minecraft/net/minecraft/src/IBossDisplayData.java
@@ -1,9 +1,5 @@
package net.minecraft.src;