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 committed 2012-11-19 17:45:53 -08:00
1 parent edcc5ca554
commit 3b3600d44f
4 files changed
+35 -61

No files matched your search

@@ -45,6 +45,7 @@ public class MCPMerger
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>(); private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
private static HashSet<String> copyToServer = new HashSet<String>(); private static HashSet<String> copyToServer = new HashSet<String>();
private static HashSet<String> copyToClient = 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; private static final boolean DEBUG = false;
public static void main(String[] args) public static void main(String[] args)
@@ -134,11 +135,16 @@ public class MCPMerger
String line; String line;
while ((line = br.readLine()) != null) while ((line = br.readLine()) != null)
{ {
line = line.split("#")[0]; line = line.split("#")[0];
boolean toClient = line.charAt(0) == '<'; char cmd = line.charAt(0);
line = line.substring(1).trim(); 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(); in.close();
@@ -225,20 +231,14 @@ public class MCPMerger
cAdded.add(name); cAdded.add(name);
sAdded.add(name); sAdded.add(name);
} }
for (Entry<String, ZipEntry> entry : sClasses.entrySet()) for (Entry<String, ZipEntry> entry : sClasses.entrySet())
{ {
if (!copyToClient.contains(entry.getKey())) if (DEBUG)
{ {
copyClass(sInJar, entry.getValue(), null, sOutJar, false); System.out.println("Copy class s->c : " + entry.getKey());
}
else
{
if (DEBUG)
{
System.out.println("Copy class s->c : " + entry.getKey());
}
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
} }
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
} }
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()}) for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
@@ -289,7 +289,7 @@ public class MCPMerger
reader.accept(classNode, 0); 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>(); if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
classNode.visibleAnnotations.add(getSideAnn(isClientOnly)); classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
+17 -24
View File
@@ -401,38 +401,31 @@ def merge_client_server(mcp_dir):
if not os.path.isdir(shared): if not os.path.isdir(shared):
os.makedirs(shared) os.makedirs(shared)
client_classes = []
server_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) zip = ZipFile(server_jar)
for i in zip.filelist: for i in zip.filelist:
if i.filename.endswith('.class'): if i.filename.endswith('.class'):
server_classes.append(i.filename[:-6]) server_classes.append(i.filename[:-6])
for cls in client_classes: for cls in server_classes:
if cls in server_classes: if cls in joined_srg.keys():
if cls in joined_srg.keys(): cls = joined_srg[cls]
cls = joined_srg[cls] cls += '.java'
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, '/')
if not os.path.isfile(f_client):
print 'Issue Merging File Not Found: ' + cls
continue
f_client = os.path.normpath(os.path.join(client, cls.replace('/', os.path.sep))).replace(os.path.sep, '/') if not cls.rfind('/') == -1:
f_shared = os.path.normpath(os.path.join(shared, cls.replace('/', os.path.sep))).replace(os.path.sep, '/') new_dir = os.path.join(shared, cls.rsplit('/', 1)[0])
if not os.path.isdir(new_dir):
os.makedirs(new_dir)
if not os.path.isfile(f_client): shutil.move(f_client, f_shared)
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)
shutil.move(f_client, f_shared)
cleanDirs(client) cleanDirs(client)
@@ -728,7 +721,7 @@ def get_conf_copy(mcp_dir, fml_dir):
common_srg = gen_merged_srg(mcp_dir, fml_dir) common_srg = gen_merged_srg(mcp_dir, fml_dir)
common_exc = gen_merged_exc(mcp_dir, fml_dir) common_exc = gen_merged_exc(mcp_dir, fml_dir)
common_map = gen_shared_searge_names(common_srg, common_exc) 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', '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', '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') gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'params.csv'), os.path.join(fml_dir, 'conf', 'params.csv'), main_key='param')
+1 -20
View File
@@ -1,20 +1 @@
>pl #net/minecraft/src/IBossDisplayData !beg #net/minecraft/src/CodecMus
>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
@@ -1,5 +1,5 @@
--- ../src-base/common/net/minecraft/src/IBossDisplayData.java --- ../src-base/minecraft/net/minecraft/src/IBossDisplayData.java
+++ ../src-work/common/net/minecraft/src/IBossDisplayData.java +++ ../src-work/minecraft/net/minecraft/src/IBossDisplayData.java
@@ -1,9 +1,5 @@ @@ -1,9 +1,5 @@
package net.minecraft.src; package net.minecraft.src;