Use a temporary file for recompile's command line to combat command length to long issues.

This commit is contained in:
LexManos 2013-07-16 13:08:26 -07:00
parent 9de739723f
commit f40e4cf3a8

View file

@ -29,7 +29,7 @@
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
return False
return True
@@ -1281,6 +1285,9 @@
@@ -1281,23 +1285,31 @@
pathbinlk = {CLIENT: self.binclient, SERVER: self.binserver}
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
@ -39,7 +39,45 @@
if not os.path.exists(pathbinlk[side]):
os.makedirs(pathbinlk[side])
@@ -1338,7 +1345,7 @@
# HINT: We create the list of source directories based on the list of packages
# on windows we just pass wildcards, otherwise we pass the full file list
- if self.osname == 'win':
+ if self.osname == 'win' and False == True: #FML: Disable for windows we write to file now
all_files = False
append_pattern = True
else:
all_files = True
append_pattern = False
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
+ from tempfile import NamedTemporaryFile
if self.cmdrecompscala: # Compile scala before java as scala scans java files, but not vice-versa
pkglistscala = pkglist[:]
pkglistscala.extend(filterdirs(pathsrclk[side], '*.scala', append_pattern=append_pattern, all_files=all_files))
- dirs = ' '.join(pkglistscala)
+ f = NamedTemporaryFile(mode='wb', suffix='.txt', prefix ='scala_src_path_', delete=False) #FML: We write to a temporary file just in case the command is to long
+ for line in pkglistscala:
+ f.write('%s\n' % os.path.abspath(line))
+ f.close()
+ dirs = '@"%s"' % f.name
classpath = os.pathsep.join(cplk[side])
forkcmd = self.cmdrecompscala.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side], pkgs=dirs)
try:
@@ -1317,7 +1329,12 @@
self.logger.error('================================')
self.logger.error('')
raise
- dirs = ' '.join(pkglist)
+ os.unlink(f.name)
+ f = NamedTemporaryFile(mode='wb', suffix='.txt', prefix ='java_src_path_', delete=False) #FML: We write to a temporary file just in case the command is to long
+ for line in pkglist:
+ f.write('%s\n' % os.path.abspath(line))
+ f.close()
+ dirs = '@"%s"' % f.name
classpath = os.pathsep.join(cplk[side])
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
pkgs=dirs)
@@ -1338,7 +1355,7 @@
raise
def startserver(self, mainclass, extraargs):
@ -48,7 +86,7 @@
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
os.chdir(self.dirjars)
@@ -1703,7 +1710,7 @@
@@ -1703,7 +1720,7 @@
self.runcmd(forkcmd)
return True
@ -57,7 +95,7 @@
if not reobf:
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
else:
@@ -1718,6 +1725,9 @@
@@ -1718,6 +1735,9 @@
class_path = ''
else:
class_path += '/'
@ -67,7 +105,7 @@
for class_file in fnmatch.filter(filelist, '*.class'):
class_name = class_path + os.path.splitext(class_file)[0]
bin_file = os.path.normpath(os.path.join(path, class_file))
@@ -1890,6 +1900,9 @@
@@ -1890,6 +1910,9 @@
sys.exit(1)
for entry in newfiles:
@ -77,7 +115,7 @@
if entry[3] == 'U':
self.logger.info('Retrieving file from server : %s', entry[0])
cur_file = os.path.normpath(entry[0])
@@ -1910,6 +1923,9 @@
@@ -1910,6 +1933,9 @@
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
src = {CLIENT: self.srcclient, SERVER: self.srcserver}