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

Loading…
Cancel
Save