Skip to content

Commit b177aad

Browse files
committed
Stage 1 of merging the client and server for MCP.
Results: Client: 362 Server: 3 (Only due to issues of FF decompilation inconsistancies) Common: 910 Stage 2: Write runtime transformer to remove annotated fields/methods with invalid side annotation.
1 parent e050c78 commit b177aad

20 files changed

+47254
-27
lines changed

commands.patch

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,25 @@
1010

1111
def creatergcfg(self, reobf=False, keep_lvt=False, keep_generics=False, rg_update=False):
1212
"""Create the files necessary for RetroGuard"""
13-
@@ -1039,6 +1042,7 @@
13+
@@ -779,7 +782,8 @@
14+
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
15+
16+
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))):
17+
- return False
18+
+ if not os.path.exists(os.path.join(self.srcshared, os.path.normpath(testlk[side] + '.java'))):
19+
+ return False
20+
return True
21+
22+
def checkbins(self, side):
23+
@@ -1039,6 +1043,7 @@
1424
all_files = True
1525
append_pattern = False
1626
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
1727
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=append_pattern, all_files=all_files) #FML, Add Common folder
1828
dirs = ' '.join(pkglist)
1929
classpath = os.pathsep.join(cplk[side])
2030
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
21-
@@ -1195,20 +1199,20 @@
31+
@@ -1195,20 +1200,20 @@
2232
with open(self.csvmethods, 'rb') as fh:
2333
methodsreader = csv.DictReader(fh)
2434
for row in methodsreader:
@@ -42,7 +52,7 @@
4252
names['params'][row['param']] = row['name']
4353

4454
regexps = {
45-
@@ -1238,6 +1242,11 @@
55+
@@ -1238,6 +1243,11 @@
4656

4757
# HINT: We pathwalk the sources
4858
for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
@@ -54,7 +64,7 @@
5464
for cur_file in fnmatch.filter(filelist, '*.java'):
5565
updatefile(os.path.normpath(os.path.join(path, cur_file)))
5666
return True
57-
@@ -1320,12 +1329,14 @@
67+
@@ -1320,12 +1330,14 @@
5868
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
5969

6070
strip_comments(pathsrclk[side])
@@ -69,7 +79,7 @@
6979

7080
def process_javadoc(self, side):
7181
"""Add CSV descriptions to methods and fields as javadoc"""
72-
@@ -1334,6 +1345,21 @@
82+
@@ -1334,6 +1346,21 @@
7383
if not self.has_doc_csv:
7484
self.logger.warning('!! javadoc disabled due to no csvs !!')
7585
return False
@@ -91,7 +101,7 @@
91101

92102
#HINT: We read the relevant CSVs
93103
methodsreader = csv.DictReader(open(self.csvmethods, 'r'))
94-
@@ -1342,13 +1368,13 @@
104+
@@ -1342,13 +1369,13 @@
95105
methods = {}
96106
for row in methodsreader:
97107
#HINT: Only include methods that have a non-empty description
@@ -107,15 +117,15 @@
107117
fields[row['searge']] = row['desc'].replace('*/', '* /')
108118

109119
regexps = {
110-
@@ -1420,6 +1446,7 @@
120+
@@ -1420,6 +1447,7 @@
111121

112122
# HINT: We create the list of source directories based on the list of packages
113123
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=True)
114124
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=True) #FML, Add Common folder
115125
dirs = ' '.join(pkglist)
116126
forkcmd = self.cmdastyle.format(classes=dirs, conffile=self.astyleconf)
117127
self.runcmd(forkcmd)
118-
@@ -1592,6 +1619,9 @@
128+
@@ -1592,6 +1620,9 @@
119129
sys.exit(1)
120130

121131
for entry in newfiles:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package cpw.mods.fml.common.asm;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
import cpw.mods.fml.common.Side;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
11+
public @interface SideOnly
12+
{
13+
public Side side();
14+
}

common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,7 @@ public static void main(String[] args)
269269
System.out.println("Could not find target jar: " + orig);
270270
return;
271271
}
272-
/*
273-
if (temp.exists())
274-
{
275-
if (orig.exists() && !orig.renameTo(new File(args[0] + (new SimpleDateFormat(".yyyy.MM.dd.HHmmss")).format(new Date()))))
276-
{
277-
System.out.println("Could not backup existing file: " + orig);
278-
return;
279-
}
280-
if (!temp.renameTo(orig))
281-
{
282-
System.out.println("Could not restore backup from previous run: " + temp);
283-
return;
284-
}
285-
}
286-
*/
272+
287273
if (!orig.renameTo(temp))
288274
{
289275
System.out.println("Could not rename file: " + orig + " -> " + temp);

0 commit comments

Comments
 (0)