Use setup-gjf.sh script to get required gjf version
The Gerrit-codestyle-job had the Google-Java-Formatter version
hard-coded in the script. Thus, if the version was changed in Gerrit, it
had to be changed simultaneously in the CI and for all Gerrit-branches.
This change changes the Gerrit-codestyle job to use the
./tools/setup-gjf.sh-script to get the version of GJF configured for
Gerrit in the current commit. This allows to have different GJF-versions
between Gerrit-branches and removes the requirement to change the
GJF-version in the CI.
Change-Id: Ie5b5cf8226cb8461b6639b076a0ef57ae8b8afd9
diff --git a/jenkins/gerrit-verifier.yaml b/jenkins/gerrit-verifier.yaml
index 366e5f8..06596a3 100644
--- a/jenkins/gerrit-verifier.yaml
+++ b/jenkins/gerrit-verifier.yaml
@@ -161,8 +161,10 @@
- shell: |
#!/bin/bash -xe
cd gerrit
+ ./tools/setup_gjf.sh
echo 'Running google-java-format check...'
- git show --diff-filter=AM --name-only --pretty="" HEAD | grep java$ | xargs -r ~/format/google-java-format-1.6 -n --set-exit-if-changed
+ 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
cd gerrit