Validate plugin changes with Java 8

Make sure all plugins are compatible at build time with Java 8
so that can be used with Gerrit v3.3 and master if needed.

Change-Id: Id926f36e88f91ba3fa4b4f2ad7a058d869e305cb
diff --git a/vars/pluginPipeline.groovy b/vars/pluginPipeline.groovy
index c663426..36dcbc9 100644
--- a/vars/pluginPipeline.groovy
+++ b/vars/pluginPipeline.groovy
@@ -36,6 +36,7 @@
     def buildCheck = parm.buildCheckId
     def pluginScmUrl = "https://gerrit.googlesource.com/a/${env.GERRIT_PROJECT}"
     def gjfVersion = '1.7'
+    def bazelOpts = '--java_toolchain=//tools:error_prone_warnings_toolchain'
 
     echo "Starting pipeline for plugin '${pluginName}'" + (formatCheck ? " formatCheckId=${formatCheck}" : '') + (buildCheck ? " buildCheckId=${buildCheck}" : '')
     echo "Change : ${env.GERRIT_CHANGE_NUMBER}/${GERRIT_PATCHSET_NUMBER} '${env.GERRIT_CHANGE_SUBJECT}'"
@@ -88,8 +89,8 @@
                         sh "cd plugins && ln -s ../../${pluginName} ."
                         sh "if [ -f ../${pluginName}/external_plugin_deps.bzl ]; then cd plugins && ln -sf ../../${pluginName}/external_plugin_deps.bzl .; fi"
                         sh "if [ -f ../${pluginName}/package.json ]; then cd plugins && ln -sf ../../${pluginName}/package.json .; fi"
-                        sh "bazelisk build plugins/${pluginName}"
-                        sh 'bazelisk test --test_env DOCKER_HOST=$DOCKER_HOST ' + "plugins/${pluginName}/..."
+                        sh "bazelisk build ${bazelOpts} plugins/${pluginName}"
+                        sh "bazelisk test ${bazelOpts} --test_env DOCKER_HOST=" + '$DOCKER_HOST' + " plugins/${pluginName}/..."
                     }
                 }
         }