google-nomulus/java-format
Michael Muller 60540fd4bf Allow java-format to use java from the PATH (#1014)
* Allow java-format to use java from the PATH

When invoking java from the google-java-format-git-diff.sh script, if there is
no JAVA_HOME environment variable, attempt to instead run the java binary that
is on the PATH.

This also adds a few checks to verify that a java binary is available in one
of those locations and that the version discovered is Java 11 (which we know
to be compatible with the google-java-format jar).

Tested:
- unset JAVA_HOME, verified that we get the version on the PATH
- Set JAVA_HOME to an invalid directory, verified that we get an error.
- Changed the "which" command to lookup an nonexistent binary, unset JAVA_HOME
  and verified that we get a "java not found" error.
- Changed the path to point to an old version of java, verified that we get a
  "bad java version" error.
- Verified that the script still runs normally.
2021-03-17 10:29:32 -04:00
..
google-java-format-1.8-all-deps.jar Enable Java 11 features (#737) 2020-08-03 16:08:29 -04:00
google-java-format-diff.py Print out env variables in java format (#998) 2021-03-10 08:55:14 -05:00
google-java-format-git-diff.sh Allow java-format to use java from the PATH (#1014) 2021-03-17 10:29:32 -04:00