Add presubmit linter hook for failures.txt expectation files

This change is primarily targeted to reduce the number of failures that
can happen when failure expectation files for art buildbot are
modified, by adding a linter hook to check files ending with
'_failures.txt'. The example of the failure can be found here:
https://ci.chromium.org/ui/p/art/builders/ci/fugu-ndebug/2433/overview

Linter is written in java because vogar uses gson library with lenient
mode enabled to parse JSON expectations. This mode allows C-style
comments, unquoted keys and values, top level values of any type and
some other differences which make use of default jsonlint hook or a
simpler python script impossible.

This hook is filtering all changed files ending with '_failures.txt',
and passes them to a linter that parses those files with lenient mode;
and fails if JSON is malformed. Linter is compiled from source in a
temporary directory which is removed after checks.

Bug: 235103837
Test: art/tools/check_presubmit_json_expectations.sh \
      $ANDROID_BUILD_TOP art/tools/*_failures.txt
Test: $ANDROID_BUILD_TOP/tools/repohooks/pre-upload.py
Change-Id: I8fc10bf39d1b8ced0ae88152a8e3a0dbf8e44035
3 files changed