From 82f7104ff7ccffce817b11b5d62db8ff76d15f23 Mon Sep 17 00:00:00 2001 From: Pavel Grafov Date: Wed, 12 Jul 2017 06:10:38 -0700 Subject: [PATCH] [infer][PR] Fix javac wrapper Summary: 1. Allow it to forward -version calls to javac (so that if the build system wants to check the compiler version it doesn't end up with Infer's version) 2. Preserve empty arguments: javac -bootclasspath "" -classpath a.jar ... currently gives: javac: invalid flag: a.jar Closes https://github.com/facebook/infer/pull/688 Differential Revision: D5406058 Pulled By: jvillard fbshipit-source-id: 7fa1bcf --- infer/lib/wrappers/javac | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/infer/lib/wrappers/javac b/infer/lib/wrappers/javac index 4b2485ca9..6eb05358f 100755 --- a/infer/lib/wrappers/javac +++ b/infer/lib/wrappers/javac @@ -11,11 +11,13 @@ elif [ -z "$INFER_OLD_PATH" ]; then fi HOST_COMPILER=(`PATH=$INFER_OLD_PATH which javac`) -COMPILER_ARGS="$@" -HOST_COMPILER_COMMAND=("$HOST_COMPILER" $COMPILER_ARGS) -FRONTEND_COMMAND=("infer" "-a" "capture" "-o" "$INFER_RESULTS_DIR" "--" "javac" $COMPILER_ARGS) +COMPILER_ARGS=("$@") +HOST_COMPILER_COMMAND=("$HOST_COMPILER" "${COMPILER_ARGS[@]}") +FRONTEND_COMMAND=("infer" "-a" "capture" "-o" "$INFER_RESULTS_DIR" "--" "javac" "${COMPILER_ARGS[@]}") -if [ -n "$INFER_COMPILER_WRAPPER_IN_RECURSION" ]; then +if [[ "$*" == *-version* ]]; then + "${HOST_COMPILER_COMMAND[@]}" +elif [ -n "$INFER_COMPILER_WRAPPER_IN_RECURSION" ]; then if [ -z "$INFER_LISTENER" ]; then "${HOST_COMPILER_COMMAND[@]}" fi