From 0282060808e4ca1db2421f687b735b29285ff4f8 Mon Sep 17 00:00:00 2001 From: jrm Date: Fri, 2 Oct 2015 09:58:11 -0700 Subject: [PATCH] delete the deprecated script inferJ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: @​public The script inferJ is no longer used. Reviewed By: @sblackshear Differential Revision: D2501379 --- FILES.md | 13 ++++----- infer.install | 1 - infer/bin/BuckAnalyze | 2 +- infer/bin/infer | 2 +- infer/bin/inferJ | 24 --------------- infer/bin/inferlib.py | 34 +++++++++++----------- infer/lib/capture/ant.py | 8 ++--- infer/lib/capture/gradle.py | 6 ++-- infer/lib/capture/mvn.py | 6 ++-- infer/lib/capture/util.py | 4 +-- infer/lib/wrappers/javac | 2 +- infer/models/Makefile | 2 +- infer/models/java/Makefile | 4 +-- infer/tests/Makefile | 58 ------------------------------------- 14 files changed, 40 insertions(+), 126 deletions(-) delete mode 100755 infer/bin/inferJ delete mode 100644 infer/tests/Makefile diff --git a/FILES.md b/FILES.md index 11422884c..2b89e08b5 100644 --- a/FILES.md +++ b/FILES.md @@ -2,7 +2,7 @@ ## Top-level commands -*infer* : Main command to run Infer. It's a python script. Check out the docs for instructions on how to use it. +*infer* : Main command to run Infer. It's a python script. Check out the docs for instructions on how to use it. *inferTest* : Shell script for running Infer's tests. Uses Buck for running the tests. Usage: inferTest {c, objc, java} for the tests about the analysis of C, Objective-C, or Java files. @@ -15,19 +15,16 @@ The rest of the commands in infer/bin/ are not meant to be called directly, but *InferJava* : Binary containing the Java frontend. -*InferClang* : Binary containing the clang frontend. +*InferClang* : Binary containing the clang frontend. -*InferAnalyze* : Binary containing the backend of Infer that performs the analysis. +*InferAnalyze* : Binary containing the backend of Infer that performs the analysis. *InferPrint* : Binary that prints reports about the analysis such as the specs of methods and a list of bugs found. - -*inferJ* : Command for running the analysis of Java files. *BuckAnalyze* : Command for running the analysis of Java projects compiled with Buck. *inferlib.py* : Python libraries for the other scripts. -*utils.py* : Python libraries for the other scripts. - -*jwlib.py* : Python libraries for the other scripts. +*utils.py* : Python libraries for the other scripts. +*jwlib.py* : Python libraries for the other scripts. diff --git a/infer.install b/infer.install index 5309a814a..5ed5cbf69 100644 --- a/infer.install +++ b/infer.install @@ -6,7 +6,6 @@ bin: [ "?infer/bin/InferClang" "infer/bin/InferAnalyze" "infer/bin/InferPrint" - "infer/bin/inferJ" "infer/bin/BuckAnalyze" "infer/bin/inferlib.py" "infer/bin/utils.py" diff --git a/infer/bin/BuckAnalyze b/infer/bin/BuckAnalyze index 299e998e2..e38e0f184 100755 --- a/infer/bin/BuckAnalyze +++ b/infer/bin/BuckAnalyze @@ -60,7 +60,7 @@ LOCAL_CONFIG = """\ def prepare_build(args): - """Creates script that redirects javac calls to inferJ and a local buck + """Creates script that redirects javac calls to infer and a local buck configuration that tells buck to use that script. """ diff --git a/infer/bin/infer b/infer/bin/infer index c54f8a749..abba52ada 100755 --- a/infer/bin/infer +++ b/infer/bin/infer @@ -74,7 +74,7 @@ def split_args_to_parse(): def create_argparser(parents=[]): parser = argparse.ArgumentParser( - parents=[inferlib.inferJ_parser] + parents, + parents=[inferlib.infer_parser] + parents, add_help=False, formatter_class=argparse.RawDescriptionHelpFormatter, ) diff --git a/infer/bin/inferJ b/infer/bin/inferJ deleted file mode 100755 index 9493b1225..000000000 --- a/infer/bin/inferJ +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python2.7 - -# Copyright (c) 2013 - present Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - -import sys - -import inferlib - -if __name__ == '__main__': - cmd_args = sys.argv[1:] - analysis = inferlib.Infer(inferlib.get_inferJ_args(cmd_args), - inferlib.get_javac_args(cmd_args)) - stats = analysis.start() - diff --git a/infer/bin/inferlib.py b/infer/bin/inferlib.py index afd891cdc..acdf23ab3 100644 --- a/infer/bin/inferlib.py +++ b/infer/bin/inferlib.py @@ -120,47 +120,47 @@ base_parser.add_argument('-v', '--version', action=VersionAction) -inferJ_parser = argparse.ArgumentParser(parents=[base_parser]) -inferJ_group = inferJ_parser.add_argument_group('backend arguments') -inferJ_group.add_argument('-j', '--multicore', metavar='n', type=int, +infer_parser = argparse.ArgumentParser(parents=[base_parser]) +infer_group = infer_parser.add_argument_group('backend arguments') +infer_group.add_argument('-j', '--multicore', metavar='n', type=int, default=multiprocessing.cpu_count(), dest='multicore', help='Set the number of cores to ' 'be used for the analysis (default uses all cores)') -inferJ_group.add_argument('-x', '--project', metavar='', +infer_group.add_argument('-x', '--project', metavar='', help='Project name, for recording purposes only') -inferJ_group.add_argument('-r', '--revision', metavar='', +infer_group.add_argument('-r', '--revision', metavar='', help='The githash, for recording purposes only') -inferJ_group.add_argument('--buck', action='store_true', dest='buck', +infer_group.add_argument('--buck', action='store_true', dest='buck', help='To use when run with buck') -inferJ_group.add_argument('--infer_cache', metavar='', +infer_group.add_argument('--infer_cache', metavar='', help='Select a directory to contain the infer cache') -inferJ_group.add_argument('-pr', '--project_root', +infer_group.add_argument('-pr', '--project_root', dest='project_root', default=os.getcwd(), help='Location of the project root ' '(default is current directory)') -inferJ_group.add_argument('--absolute-paths', +infer_group.add_argument('--absolute-paths', action='store_true', default=False, help='Report errors with absolute paths') -inferJ_group.add_argument('--objc_ml_buckets', +infer_group.add_argument('--objc_ml_buckets', dest='objc_ml_buckets', help='memory leak buckets to be checked, ' 'separated by commas. The possible ' 'buckets are cf (Core Foundation), ' 'arc, narc (No arc)') -inferJ_group.add_argument('-nt', '--notest', action='store_true', +infer_group.add_argument('-nt', '--notest', action='store_true', dest='notest', help='Prints output of symbolic execution') -inferJ_group.add_argument('--specs-dir', +infer_group.add_argument('--specs-dir', metavar='', action='append', dest='specs_dirs', @@ -174,13 +174,13 @@ def detect_javac(args): return index -def get_inferJ_args(args): +def get_infer_args(args): index = detect_javac(args) if index is None: cmd_args = args else: cmd_args = args[:index] - return inferJ_parser.parse_args(cmd_args) + return infer_parser.parse_args(cmd_args) def get_javac_args(args): @@ -235,7 +235,7 @@ def clean(infer_out, annotations_out): def help_exit(message): print(message) - inferJ_parser.print_usage() + infer_parser.print_usage() exit(1) @@ -376,8 +376,8 @@ def run_command(cmd, debug_mode, javac_arguments, step, analyzer): return subprocess.check_call(cmd) except subprocess.CalledProcessError as e: error_msg = 'Failure during {0}, original command was\n\n{1}\n\n' - inferJ_cmd = ['inferJ', '-g', '-a', analyzer] - failing_cmd = inferJ_cmd + ['javac'] + javac_arguments + infer_cmd = ['infer', '-g', '-a', analyzer] + failing_cmd = infer_cmd + ['--', 'javac'] + javac_arguments logging.error(error_msg.format( step, failing_cmd diff --git a/infer/lib/capture/ant.py b/infer/lib/capture/ant.py index 1ccd632aa..d9f223c85 100644 --- a/infer/lib/capture/ant.py +++ b/infer/lib/capture/ant.py @@ -47,7 +47,7 @@ class AntCapture: else: return argument - def get_inferJ_commands(self, verbose_output): + def get_infer_commands(self, verbose_output): javac_pattern = '[javac]' argument_start_pattern = 'Compilation arguments' calls = [] @@ -58,7 +58,7 @@ class AntCapture: if argument_start_pattern in line: collect = True if javac_arguments != []: - capture = util.create_inferJ_command(self.args, + capture = util.create_infer_command(self.args, javac_arguments) calls.append(capture) javac_arguments = [] @@ -69,11 +69,11 @@ class AntCapture: arg = self.remove_quotes(content) javac_arguments.append(arg) if javac_arguments != []: - capture = util.create_inferJ_command(self.args, javac_arguments) + capture = util.create_infer_command(self.args, javac_arguments) calls.append(capture) javac_arguments = [] return calls def capture(self): - cmds = self.get_inferJ_commands(util.get_build_output(self.build_cmd)) + cmds = self.get_infer_commands(util.get_build_output(self.build_cmd)) return util.run_commands(cmds) diff --git a/infer/lib/capture/gradle.py b/infer/lib/capture/gradle.py index 9f8bf8720..0b17078b9 100644 --- a/infer/lib/capture/gradle.py +++ b/infer/lib/capture/gradle.py @@ -42,7 +42,7 @@ class GradleCapture: os.mkdir(path) logging.info("Running with:\n" + version_str) - def get_inferJ_commands(self, verbose_output): + def get_infer_commands(self, verbose_output): argument_start_pattern = ' Compiler arguments: ' calls = [] seen_build_cmds = set([]) @@ -73,11 +73,11 @@ class GradleCapture: sources.write("\n".join(java_files)) sources.flush() java_args.append("@" + sources.name) - capture = util.create_inferJ_command(self.args, + capture = util.create_infer_command(self.args, java_args) calls.append(capture) return calls def capture(self): - cmds = self.get_inferJ_commands(util.get_build_output(self.build_cmd)) + cmds = self.get_infer_commands(util.get_build_output(self.build_cmd)) return util.run_commands(cmds) diff --git a/infer/lib/capture/mvn.py b/infer/lib/capture/mvn.py index 4780c6175..2f9482a28 100644 --- a/infer/lib/capture/mvn.py +++ b/infer/lib/capture/mvn.py @@ -32,7 +32,7 @@ class MavenCapture: # TODO: make the extraction of targets smarter self.build_cmd = ['mvn', '-X'] + cmd[1:] - def get_inferJ_commands(self, verbose_output): + def get_infer_commands(self, verbose_output): file_pattern = r'\[DEBUG\] Stale source detected: ([^ ]*\.java)' options_pattern = '[DEBUG] Command line options:' @@ -43,7 +43,7 @@ class MavenCapture: if options_next: # line has format [Debug] javac_args = line.split(' ')[1:] + files_to_compile - capture = util.create_inferJ_command(self.args, javac_args) + capture = util.create_infer_command(self.args, javac_args) calls.append(capture) options_next = False files_to_compile = [] @@ -60,5 +60,5 @@ class MavenCapture: return calls def capture(self): - cmds = self.get_inferJ_commands(util.get_build_output(self.build_cmd)) + cmds = self.get_infer_commands(util.get_build_output(self.build_cmd)) return util.run_commands(cmds) diff --git a/infer/lib/capture/util.py b/infer/lib/capture/util.py index af11c5bb4..a9bf70180 100644 --- a/infer/lib/capture/util.py +++ b/infer/lib/capture/util.py @@ -15,13 +15,13 @@ import inferlib import traceback -def create_inferJ_command(args, javac_arguments): +def create_infer_command(args, javac_arguments): infer_args = ['-o', args.infer_out] if args.debug: infer_args.append('--debug') infer_args += ['--analyzer', 'capture'] - return inferlib.Infer(inferlib.inferJ_parser.parse_args(infer_args), + return inferlib.Infer(inferlib.infer_parser.parse_args(infer_args), inferlib.get_javac_args(['javac'] + javac_arguments)) diff --git a/infer/lib/wrappers/javac b/infer/lib/wrappers/javac index 4ea1f1ff4..4b2485ca9 100755 --- a/infer/lib/wrappers/javac +++ b/infer/lib/wrappers/javac @@ -13,7 +13,7 @@ fi HOST_COMPILER=(`PATH=$INFER_OLD_PATH which javac`) COMPILER_ARGS="$@" HOST_COMPILER_COMMAND=("$HOST_COMPILER" $COMPILER_ARGS) -FRONTEND_COMMAND=("inferJ" "-a" "capture" "-o" "$INFER_RESULTS_DIR" "javac" $COMPILER_ARGS) +FRONTEND_COMMAND=("infer" "-a" "capture" "-o" "$INFER_RESULTS_DIR" "--" "javac" $COMPILER_ARGS) if [ -n "$INFER_COMPILER_WRAPPER_IN_RECURSION" ]; then if [ -z "$INFER_LISTENER" ]; then diff --git a/infer/models/Makefile b/infer/models/Makefile index 47cf4d493..a0216bca0 100644 --- a/infer/models/Makefile +++ b/infer/models/Makefile @@ -11,7 +11,7 @@ LIB_SPECS = $(LIBDIR)/specs INFERANALYZE = $(BINDIR)/InferAnalyze INFERCLANG = $(BINDIR)/InferClang INFERJAVA = $(BINDIR)/InferJava -JAVA_SCRIPTS = $(addprefix $(BINDIR)/, jwlib.py inferlib.py inferJ) +JAVA_SCRIPTS = $(addprefix $(BINDIR)/, jwlib.py inferlib.py infer) CLANG_SCRIPTS = $(addprefix $(BINDIR)/, inferiOS) # Add more once this part is stable PLATFORM = $(shell uname) diff --git a/infer/models/java/Makefile b/infer/models/java/Makefile index 565e3e74e..cdc877cf1 100644 --- a/infer/models/java/Makefile +++ b/infer/models/java/Makefile @@ -2,7 +2,7 @@ SHELL := /bin/bash CWD = $(shell pwd) BINDIR = $(CWD)/../../bin -INFERJ = INFER_ANALYZE_MODELS=1 $(BINDIR)/inferJ --buck --analyzer infer --multicore 1 +INFER = INFER_ANALYZE_MODELS=1 $(BINDIR)/infer --buck --analyzer infer --multicore 1 ANDROID_JAR = ../../lib/java/android/android-19.jar JACKSON_JAR = ../../../dependencies/java/jackson/jackson-2.2.3.jar @@ -29,7 +29,7 @@ clean: $(CSV_REPORT): $(JAVA_SOURCES) mkdir $(MODELS_OUT) - $(INFERJ) javac -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(JACKSON_JAR) $(JAVA_SOURCES) + $(INFER) -- javac -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(JACKSON_JAR) $(JAVA_SOURCES) $(MODELS_JAR): $(CSV_REPORT) cd $(MODELS_OUT); jar cf $(MODELS_JAR) * diff --git a/infer/tests/Makefile b/infer/tests/Makefile deleted file mode 100644 index b6d9fe536..000000000 --- a/infer/tests/Makefile +++ /dev/null @@ -1,58 +0,0 @@ - -ANNOTATIONS_JAR = ../annotations/annotations.jar -MODELS_JAR = ../lib/java/models.jar -JACKSON_JAR = ../../dependencies/java/jackson/jackson-2.2.3.jar -ANDROID_JAR = ../lib/java/android/android-19.jar -GUAVA_JAR = ../../dependencies/java/guava/guava-10.0.1-fork.jar -JSR_JAR = ../../dependencies/java/jsr-305/jsr305.jar - -INFERJ = inferJ - -TRACING_OUT = tracing_out -TRACING_REPORT = $(TRACING_OUT)/report.csv -TRACING_SOURCES = $(shell find codetoanalyze/java/tracing -name "*.java") -TRACING_JAVAC_CMD = javac -cp $(ANNOTATIONS_JAR) $(TRACING_SOURCES) -TRACING_CMD = $(INFERJ) -o $(TRACING_OUT) -a tracing $(TRACING_JAVAC_CMD) - -INFER_OUT = infer_out -INFER_REPORT = $(INFER_OUT)/report.csv -INFER_SOURCES = $(shell find codetoanalyze/java/infer -name "*.java") -INFER_JAVAC_CMD = javac -cp $(JACKSON_JAR):$(ANDROID_JAR):$(MODELS_JAR) $(INFER_SOURCES) -INFER_CMD = $(INFERJ) -o $(INFER_OUT) -a infer $(INFER_JAVAC_CMD) - -ERADICATE_OUT = eradicate_out -ERADICATE_REPORT = $(ERADICATE_OUT)/report.csv -ERADICATE_SOURCES = $(shell find codetoanalyze/java/eradicate -name "*.java") -ERADICATE_JAVAC_CMD = javac -cp $(JSR_JAR):$(ANNOTATIONS_JAR):$(GUAVA_JAR):$(ANDROID_JAR) $(ERADICATE_SOURCES) -ERADICATE_CMD = $(INFERJ) -o $(ERADICATE_OUT) -a eradicate $(ERADICATE_JAVAC_CMD) - -CHECKERS_OUT = checkers_out -CHECKERS_REPORT = $(CHECKERS_OUT)/report.csv -CHECKERS_SOURCES = $(shell find codetoanalyze/java/checkers -name "*.java") -CHECKERS_JAVAC_CMD = javac -cp $(ANNOTATIONS_JAR):$(GUAVA_JAR):$(ANDROID_JAR) $(CHECKERS_SOURCES) -CHECKERS_CMD = $(INFERJ) -o $(CHECKERS_OUT) -a checkers $(CHECKERS_JAVAC_CMD) - -.PHONY: tracing infer eradicate checkers - -all: tracing infer eradicate checkers - - -tracing: - $(TRACING_CMD) - -infer: - $(INFER_CMD) - -eradicate: - $(ERADICATE_CMD) - -checkers: - $(CHECKERS_CMD) - -clean: - rm -rf $(TRACING_OUT) - rm -rf $(INFER_OUT) - rm -rf $(CHECKERS_OUT) - rm -rf $(ERADICATE_OUT) - find . -name "*.o" | xargs rm - find . -name "*.class" | xargs rm