Merge branch 'stable-3.3'

Update API version to 3.4.0.

* stable-3.3:
  Batch plugin: refactor BatchSubmitter
  Fix errors against latest Gerrit core
  Update WORKSPACE to use released api version
  Upgrade bazlets to latest stable-3.2 to build with 3.2.6 API
  Upgrade bazlets to latest stable-3.1 to build with 3.1.11 API
  Upgrade bazlets to latest stable-3.2 to build with 3.2.5.1 API
  Upgrade bazlets to latest stable-3.1 to build with 3.1.10 API

Change-Id: Ic1f43562a45f6e4b355bae046d6925c6a465fa5a
diff --git a/BUILD b/BUILD
index 61e1f54..1ad5f3a 100644
--- a/BUILD
+++ b/BUILD
@@ -50,7 +50,7 @@
     srcs = glob(["src/main/java/**/*.java"]),
     manifest_entries = [
         "Gerrit-PluginName: batch",
-        "Gerrit-ApiVersion: 3.3.0-SNAPSHOT",
+        "Gerrit-ApiVersion: 3.4.0",
         "Implementation-Title: Batch Plugin",
         "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/batch",
         "Gerrit-Module: com.googlesource.gerrit.plugins.batch.Module",
diff --git a/WORKSPACE b/WORKSPACE
index 28d8aaa..e90a918 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "5703ec25181046b60913d3510a0a5c2f0afa46f8",
+    commit = "7ff4605f48db148197675a0d2ea41ee07cb72fd3",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
@@ -15,9 +15,6 @@
 # Load release Plugin API
 gerrit_api()
 
-# Load snapshot Plugin API
-#gerrit_api(version = "3.3.0-SNAPSHOT")
-
 load("//:external_plugin_deps.bzl", "external_plugin_deps")
 
 external_plugin_deps()
diff --git a/pom.xml b/pom.xml
index a59e586..13ab7db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
   <groupId>com.googlesource.gerrit.plugins.batch</groupId>
   <artifactId>batch</artifactId>
   <packaging>jar</packaging>
-  <version>3.3.1</version>
+  <version>3.4.0</version>
   <name>batch</name>
 
   <properties>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java
index 6f78ecb..2ffaa5b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java
@@ -15,6 +15,7 @@
 package com.googlesource.gerrit.plugins.batch.ssh;
 
 import com.google.gerrit.server.AccessPath;
+import com.google.gerrit.server.DynamicOptions;
 import com.google.gerrit.sshd.BaseCommand;
 import com.google.gerrit.sshd.CommandMetaData;
 import com.google.inject.Inject;
@@ -37,8 +38,10 @@
         new CommandRunnable() {
           @Override
           public void run() throws Exception {
-            parseCommandLine(impl);
-            impl.display(out);
+            try (DynamicOptions pluginOptions = new DynamicOptions(injector, dynamicBeans)) {
+              parseCommandLine(impl, pluginOptions);
+              impl.display(out);
+            }
           }
         },
         AccessPath.SSH_COMMAND);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/MergeChangeCommand.java b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/MergeChangeCommand.java
index 10d8b65..fd982af 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/MergeChangeCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/MergeChangeCommand.java
@@ -88,7 +88,6 @@
 
   @Override
   public void run() throws Exception {
-    parseCommandLine();
     Batch batch = new Batch(user.getAccountId());
     String err = null;
     try {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/SubmitCommand.java b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/SubmitCommand.java
index a753c36..e9a477b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/SubmitCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/SubmitCommand.java
@@ -39,7 +39,6 @@
 
   @Override
   public void run() throws Exception {
-    parseCommandLine();
     try {
       Batch batch = impl.submit(batchId);
       out.write((OutputFormat.JSON.newGson().toJson(batch) + "\n").getBytes(ENC));