[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
master
Pavel Grafov 7 years ago committed by Facebook Github Bot
parent 70b56068ee
commit 82f7104ff7

@ -11,11 +11,13 @@ elif [ -z "$INFER_OLD_PATH" ]; then
fi fi
HOST_COMPILER=(`PATH=$INFER_OLD_PATH which javac`) HOST_COMPILER=(`PATH=$INFER_OLD_PATH which javac`)
COMPILER_ARGS="$@" COMPILER_ARGS=("$@")
HOST_COMPILER_COMMAND=("$HOST_COMPILER" $COMPILER_ARGS) HOST_COMPILER_COMMAND=("$HOST_COMPILER" "${COMPILER_ARGS[@]}")
FRONTEND_COMMAND=("infer" "-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 [[ "$*" == *-version* ]]; then
"${HOST_COMPILER_COMMAND[@]}"
elif [ -n "$INFER_COMPILER_WRAPPER_IN_RECURSION" ]; then
if [ -z "$INFER_LISTENER" ]; then if [ -z "$INFER_LISTENER" ]; then
"${HOST_COMPILER_COMMAND[@]}" "${HOST_COMPILER_COMMAND[@]}"
fi fi

Loading…
Cancel
Save