Fix scalac detection to actually use the located command instead of defaulting to 'scalac'
This commit is contained in:
parent
bff831ce8d
commit
42564b3988
2 changed files with 58 additions and 45 deletions
|
@ -26,62 +26,75 @@
|
|||
self.readcommands(verify, no_patch=no_patch)
|
||||
|
||||
def checkcommand(self, name, command, java=False, single_line=False, check_return=True, error=True):
|
||||
@@ -230,6 +235,8 @@
|
||||
@@ -230,6 +235,9 @@
|
||||
self.checkcommand('java', '%s -version' % self.cmdjava)
|
||||
self.checkcommand('javac', '%s -version' % self.cmdjavac)
|
||||
self.checkcommand('javac runtime', '%s -J-version' % self.cmdjavac)
|
||||
+ if self.cmdscalac: self.checkcommand('scalac', '%s -version' % self.cmdscalac)
|
||||
+ if self.cmdscalac: self.checkcommand('scalac runtime', '%s -J-version' % self.cmdscalac)
|
||||
+ if self.cmdscalac:
|
||||
+ self.checkcommand('scalac', '%s -version' % self.cmdscalac)
|
||||
+ self.checkcommand('scalac runtime', '%s -J-version' % self.cmdscalac)
|
||||
self.checkcommand('retroguard', '%s --version' % self.retroguard, java=True)
|
||||
|
||||
self.exceptor = os.path.normpath(self.config.get('COMMANDS', 'Exceptor'))
|
||||
@@ -350,6 +357,8 @@
|
||||
@@ -324,6 +332,8 @@
|
||||
reqs.append('astyle')
|
||||
if self.has_astyle_cfg:
|
||||
reqs.append('astyle config')
|
||||
+ if self.cmdscalac:
|
||||
+ reqs.append('scalac')
|
||||
self.logger.info('# found %s', ', '.join(reqs))
|
||||
if not self.has_jad_patch and not no_patch:
|
||||
self.has_jad = False
|
||||
@@ -350,6 +360,13 @@
|
||||
self.cmdfernflower = self.config.get('COMMANDS', 'CmdFernflower', raw=1) % (self.cmdjava, self.fernflower)
|
||||
self.cmdexceptor = self.config.get('COMMANDS', 'CmdExceptor', raw=1) % (self.cmdjava, self.exceptor)
|
||||
self.cmdrecomp = self.config.get('COMMANDS', 'CmdRecomp', raw=1) % self.cmdjavac
|
||||
+ if self.cmdscalac: self.cmdrecompscalac = self.config.get('COMMANDS', 'CmdRecompScalac', raw=1) % self.cmdscalac
|
||||
+ else: self.cmdrecompscalac = None
|
||||
+ try:
|
||||
+ if self.cmdscalac:
|
||||
+ self.cmdrecompscalac = self.config.get('COMMANDS', 'CmdRecompScalac', raw=1) % self.cmdscalac
|
||||
+ else:
|
||||
+ self.cmdrecompscalac = None
|
||||
+ except ConfigParser.NoOptionError:
|
||||
+ pass
|
||||
self.cmdstartsrv = self.config.get('COMMANDS', 'CmdStartSrv', raw=1) % self.cmdjava
|
||||
self.cmdstartclt = self.config.get('COMMANDS', 'CmdStartClt', raw=1) % self.cmdjava
|
||||
|
||||
@@ -753,6 +762,36 @@
|
||||
@@ -753,6 +770,34 @@
|
||||
self.cmdjavac = '"%s"' % os.path.join(results[0], 'javac')
|
||||
self.cmdjava = '"%s"' % os.path.join(results[0], 'java')
|
||||
|
||||
+ def checkscala(self):
|
||||
+ results = []
|
||||
+ if not results:
|
||||
+ try:
|
||||
+ # TODO: Verify at least version 2.10
|
||||
+ self.runcmd('scalac -version', quiet=True)
|
||||
+ results.append('')
|
||||
+ except (CalledProcessError, OSError):
|
||||
+ pass
|
||||
+ if not results: # Stupid windows...
|
||||
+ cmd = None
|
||||
+ try:
|
||||
+ # TODO: Verify at least version 2.10
|
||||
+ self.runcmd('scalac -version', quiet=True)
|
||||
+ cmd = 'scalac'
|
||||
+ except (CalledProcessError, OSError):
|
||||
+ pass
|
||||
+ if cmd is None: # Stupid windows...
|
||||
+ try:
|
||||
+ # TODO: Verify at least version 2.10
|
||||
+ self.runcmd('scalac.bat -version', quiet=True)
|
||||
+ results.append('')
|
||||
+ cmd = 'scalac.bat'
|
||||
+ except (CalledProcessError, OSError):
|
||||
+ pass
|
||||
+ try:
|
||||
+ self.runcmd('scala -target:jvm-1.6 -version', quiet=True)
|
||||
+ results.append('')
|
||||
+ except (CalledProcessError, OSError):
|
||||
+ self.logger.info('"scala" does not support jvm-1.6 target, it is out of date. Ignoring')
|
||||
+ results = []
|
||||
+ self.cmdscalac = None
|
||||
+
|
||||
+ if cmd is None:
|
||||
+ self.logger.warning('"scalac" is not found on the PATH. Scala files will not be recompiled')
|
||||
+ self.cmdscalac = None
|
||||
+ else:
|
||||
+ if not results:
|
||||
+ self.logger.warning('"scalac" is not found on the PATH. Scala files will not be recompiled')
|
||||
+ self.cmdscalac = None
|
||||
+ else:
|
||||
+ self.cmdscalac = '"%s"' % os.path.join(results[0], 'scalac')
|
||||
+ self.cmdscalac = '"%s"' % cmd
|
||||
+
|
||||
+ try:
|
||||
+ self.runcmd('%s -target:jvm-1.6 -version' % self.cmdscalac, quiet=True)
|
||||
+ except (CalledProcessError, OSError):
|
||||
+ self.logger.info('%s does not support jvm-1.6 target, it is out of date. Ignoring' % self.cmdscalac)
|
||||
+ self.cmdscalac = None
|
||||
+
|
||||
def checkjars(self, side):
|
||||
jarlk = {CLIENT: self.jarclient, SERVER: self.jarserver}
|
||||
md5jarlk = {CLIENT: self.md5jarclt, SERVER: self.md5jarsrv}
|
||||
@@ -798,6 +837,8 @@
|
||||
@@ -798,6 +843,8 @@
|
||||
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
||||
|
||||
|
@ -90,7 +103,7 @@
|
|||
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
||||
return False
|
||||
return True
|
||||
@@ -1038,6 +1079,9 @@
|
||||
@@ -1038,6 +1085,9 @@
|
||||
pathbinlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
||||
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
|
||||
|
@ -100,7 +113,7 @@
|
|||
|
||||
if not os.path.exists(pathbinlk[side]):
|
||||
os.makedirs(pathbinlk[side])
|
||||
@@ -1051,6 +1095,29 @@
|
||||
@@ -1051,6 +1101,29 @@
|
||||
all_files = True
|
||||
append_pattern = False
|
||||
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
|
||||
|
@ -130,7 +143,7 @@
|
|||
dirs = ' '.join(pkglist)
|
||||
classpath = os.pathsep.join(cplk[side])
|
||||
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
|
||||
@@ -1059,7 +1126,7 @@
|
||||
@@ -1059,7 +1132,7 @@
|
||||
self.runcmd(forkcmd, log_file=pathlog[side])
|
||||
except CalledProcessError as ex:
|
||||
self.logger.error('')
|
||||
|
@ -139,7 +152,7 @@
|
|||
self.logger.error('')
|
||||
for line in ex.output.splitlines():
|
||||
if line.strip():
|
||||
@@ -1072,7 +1139,7 @@
|
||||
@@ -1072,7 +1145,7 @@
|
||||
raise
|
||||
|
||||
def startserver(self):
|
||||
|
@ -148,7 +161,7 @@
|
|||
classpath = [os.path.join('..', p) for p in classpath]
|
||||
classpath = os.pathsep.join(classpath)
|
||||
os.chdir(self.dirjars)
|
||||
@@ -1080,7 +1147,7 @@
|
||||
@@ -1080,7 +1153,7 @@
|
||||
self.runmc(forkcmd)
|
||||
|
||||
def startclient(self):
|
||||
|
@ -157,7 +170,7 @@
|
|||
classpath = [os.path.join('..', p) for p in classpath]
|
||||
classpath = os.pathsep.join(classpath)
|
||||
natives = os.path.join('..', self.dirnatives)
|
||||
@@ -1207,20 +1274,20 @@
|
||||
@@ -1207,20 +1280,20 @@
|
||||
with open(self.csvmethods, 'rb') as fh:
|
||||
methodsreader = csv.DictReader(fh)
|
||||
for row in methodsreader:
|
||||
|
@ -181,7 +194,7 @@
|
|||
names['params'][row['param']] = row['name']
|
||||
|
||||
regexps = {
|
||||
@@ -1354,13 +1421,13 @@
|
||||
@@ -1354,13 +1427,13 @@
|
||||
methods = {}
|
||||
for row in methodsreader:
|
||||
#HINT: Only include methods that have a non-empty description
|
||||
|
@ -197,7 +210,7 @@
|
|||
fields[row['searge']] = row['desc'].replace('*/', '* /')
|
||||
|
||||
regexps = {
|
||||
@@ -1437,7 +1504,7 @@
|
||||
@@ -1437,7 +1510,7 @@
|
||||
self.runcmd(forkcmd)
|
||||
return True
|
||||
|
||||
|
@ -206,7 +219,7 @@
|
|||
if not reobf:
|
||||
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
|
||||
else:
|
||||
@@ -1452,6 +1519,9 @@
|
||||
@@ -1452,6 +1525,9 @@
|
||||
class_path = ''
|
||||
else:
|
||||
class_path += '/'
|
||||
|
@ -216,7 +229,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))
|
||||
@@ -1548,6 +1618,8 @@
|
||||
@@ -1548,6 +1624,8 @@
|
||||
if not os.path.exists(outpathlk[side]):
|
||||
os.makedirs(outpathlk[side])
|
||||
|
||||
|
@ -225,7 +238,7 @@
|
|||
# HINT: We extract the modified class files
|
||||
with closing(zipfile.ZipFile(jarlk[side])) as zipjar:
|
||||
for in_class in trgclasses:
|
||||
@@ -1561,6 +1633,23 @@
|
||||
@@ -1561,6 +1639,23 @@
|
||||
out_class = out_class.replace(self.nullpkg, '')
|
||||
if out_class[0] == '/':
|
||||
out_class = out_class[1:]
|
||||
|
@ -249,7 +262,7 @@
|
|||
try:
|
||||
zipjar.extract(out_class, outpathlk[side])
|
||||
self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], out_class)
|
||||
@@ -1607,6 +1696,9 @@
|
||||
@@ -1607,6 +1702,9 @@
|
||||
sys.exit(1)
|
||||
|
||||
for entry in newfiles:
|
||||
|
@ -259,7 +272,7 @@
|
|||
if entry[3] == 'U':
|
||||
self.logger.info('Retrieving file from server : %s', entry[0])
|
||||
cur_file = os.path.normpath(entry[0])
|
||||
@@ -1627,6 +1719,9 @@
|
||||
@@ -1627,6 +1725,9 @@
|
||||
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
|
||||
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
|
||||
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
class,package
|
||||
GuiScreenOnlineServersSubscreen,net/minecraft/client/gui
|
||||
RunnableTitleScreen,net/minecraft/client/gui
|
||||
Block,net/minecraft/block
|
||||
BlockAnvil,net/minecraft/block
|
||||
BlockBasePressurePlate,net/minecraft/block
|
||||
|
@ -220,6 +218,7 @@ GuiScreenEditOnlineWorld,net/minecraft/client/gui
|
|||
GuiScreenInvite,net/minecraft/client/gui
|
||||
GuiScreenLongRunningTask,net/minecraft/client/gui
|
||||
GuiScreenOnlineServers,net/minecraft/client/gui
|
||||
GuiScreenOnlineServersSubscreen,net/minecraft/client/gui
|
||||
GuiScreenResetWorld,net/minecraft/client/gui
|
||||
GuiScreenSelectLocation,net/minecraft/client/gui
|
||||
GuiScreenServerList,net/minecraft/client/gui
|
||||
|
@ -243,6 +242,7 @@ GuiYesNo,net/minecraft/client/gui
|
|||
LoadingScreenRenderer,net/minecraft/client/gui
|
||||
MapItemRenderer,net/minecraft/client/gui
|
||||
Particle,net/minecraft/client/gui
|
||||
RunnableTitleScreen,net/minecraft/client/gui
|
||||
ScaledResolution,net/minecraft/client/gui
|
||||
ScreenChatOptions,net/minecraft/client/gui
|
||||
SelectionListBase,net/minecraft/client/gui
|
||||
|
|
|
Loading…
Reference in a new issue