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 c7c03874c0
commit 24ad8c4557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -55,6 +55,8 @@ def main():
parser.add_argument('-b', '--binary', help='path to google-java-format binary')
parser.add_argument('--google-java-format-jar', metavar='ABSOLUTE_PATH', default=None,
help='use a custom google-java-format jar')
parser.add_argument('-j', '--java-binary', default='java',
help='path to the java binary')
args = parser.parse_args()
@ -91,7 +93,7 @@ def main():
if args.binary:
base_command = [args.binary]
elif args.google_java_format_jar:
base_command = ['java', '-jar', args.google_java_format_jar]
base_command = [args.java_binary, '-jar', args.google_java_format_jar]
else:
binary = find_executable('google-java-format') or '/usr/bin/google-java-format'
base_command = [binary]