Print out env variables in java format (#998)

* Print out env variables in java format

Print out JAVA_HOME and PATH variable in the google-java-format-diff.py script
immediately prior to running the underlying java program that does the actual
format checking.

* Use the java binary from JAVA_HOME for java-format

Use "$JAVA_HOME/bin/java" for invoking the java format check instead of
whatever version of java happens to be on the path.

* Removed unused import
This commit is contained in:
Michael Muller 2021-03-10 08:55:14 -05:00 committed by GitHub
parent a5364a5bab
commit 103c87ed7d
2 changed files with 6 additions and 1 deletions

View file

@ -63,6 +63,7 @@ function callGoogleJavaFormatDiff() {
showNoncompliantFiles "$forkPoint" "\033[1mNeeds formatting: "
callResult=$(git diff -U0 ${forkPoint} | \
${SCRIPT_DIR}/google-java-format-diff.py \
--java-binary "$JAVA_HOME/bin/java" \
--google-java-format-jar "${SCRIPT_DIR}/${JAR_NAME}" \
-p1 | wc -l)
;;
@ -70,12 +71,14 @@ function callGoogleJavaFormatDiff() {
showNoncompliantFiles "$forkPoint" "\033[1mReformatting: "
callResult=$(git diff -U0 ${forkPoint} | \
${SCRIPT_DIR}/google-java-format-diff.py \
--java-binary "$JAVA_HOME/bin/java" \
--google-java-format-jar "${SCRIPT_DIR}/${JAR_NAME}" \
-p1 -i)
;;
"show")
callResult=$(git diff -U0 ${forkPoint} | \
${SCRIPT_DIR}/google-java-format-diff.py \
--java-binary "$JAVA_HOME/bin/java" \
--google-java-format-jar "${SCRIPT_DIR}/${JAR_NAME}" \
-p1)
;;