Avoid downloading existing versions of Google-Java-Format

The setup_gjf.sh-script downloads Google-Java-Format (gjf) each time it
is run. This caused a download each time a codestyle test was executed.

This change adds a test, whether the gjf-version set as default in
setup_gjf.sh is already present in the build slave container. If it is
present, the executable built into the container will be used, else the
setup_gjf.sh will be run to install the required version of gjf.

Change-Id: If4eb9e3e2a3ed2f7062c18db7a974c903d71c27e
diff --git a/jenkins/gerrit-verifier.yaml b/jenkins/gerrit-verifier.yaml
index 06596a3..71fa98f 100644
--- a/jenkins/gerrit-verifier.yaml
+++ b/jenkins/gerrit-verifier.yaml
@@ -161,9 +161,13 @@
       - shell: |
          #!/bin/bash -xe
          cd gerrit
-         ./tools/setup_gjf.sh
+         GJF_VERSION=$(grep -o "^VERSION=.*$" tools/setup_gjf.sh | grep -o "[0-9][0-9]*\.[0-9][0-9]*")
+         GJF="/home/jenkins/format/google-java-format-$GJF_VERSION"
+         if [ ! -f "$GJF" ]; then
+           ./tools/setup_gjf.sh
+           GJF=$(find 'tools/format' -regex '.*/google-java-format-[0-9][0-9]*\.[0-9][0-9]*')
+         fi
          echo 'Running google-java-format check...'
-         GJF=$(find 'tools/format' -regex '.*/google-java-format-[0-9][0-9]*\.[0-9][0-9]*')
          git show --diff-filter=AM --name-only --pretty="" HEAD | grep java$ | xargs -r $GJF -n --set-exit-if-changed
       - shell: |
          #!/bin/bash -xe