[infer][java] Fall back to the system compiler in case of compilation failures

Reviewed By: sblackshear

Differential Revision: D4218310

fbshipit-source-id: 3bf133a
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent 7b884144b5
commit 0b8a117b5e

@ -213,19 +213,26 @@ class CompilerCall(object):
try:
subprocess.check_call(command, stderr=file_out)
except subprocess.CalledProcessError:
error_msg = 'ERROR: failure during compilation command.' \
+ '\nYou can run the failing compilation ' \
+ 'command again by copy-pasting the\nlines ' \
+ 'below in your terminal:\n\n"""\n' \
+ 'python <<EOF\n' \
+ 'import subprocess\n' \
+ 'cmd = {}\n' \
+ 'subprocess.check_call(cmd)\n' \
+ 'EOF\n"""\n'
failing_cmd = filter(lambda arg: arg != '-verbose',
command)
utils.stderr(error_msg.format(failing_cmd))
subprocess.check_call(failing_cmd)
try:
fallback_command = ['javac'] + cli_args + \
['@' + str(self.command_line_file)]
subprocess.check_call(
fallback_command, stderr=file_out)
except subprocess.CalledProcessError:
error_msg = 'ERROR: failure during compilation ' \
+ 'command.\nYou can run the failing ' \
+ 'compilation command again by ' \
+ 'copy-pasting the\nlines below in ' \
+ 'your terminal:\n\n"""\n' \
+ 'python <<EOF\n' \
+ 'import subprocess\n' \
+ 'cmd = {}\n' \
+ 'subprocess.check_call(cmd)\n' \
+ 'EOF\n"""\n'
failing_cmd = filter(lambda arg: arg != '-verbose',
command)
utils.stderr(error_msg.format(failing_cmd))
subprocess.check_call(failing_cmd)
return os.EX_OK

Loading…
Cancel
Save