Merge branch 'stable-2.11' into stable-2.12

* stable-2.11:
  Build against API version 2.11.10
  Build against API version 2.10.7
  Build with API version 2.9.3

Change-Id: I4a40185023908044c1c380da970234f46a500e7e
diff --git a/BUCK b/BUCK
new file mode 100644
index 0000000..34e5f63
--- /dev/null
+++ b/BUCK
@@ -0,0 +1,19 @@
+include_defs('//bucklets/gerrit_plugin.bucklet')
+
+gerrit_plugin(
+  name = 'project-download-commands',
+  srcs = glob(['src/main/java/**/*.java']),
+  resources = glob(['src/main/resources/**/*']),
+  manifest_entries = [
+    'Gerrit-PluginName: project-download-commands',
+    'Gerrit-Module: com.googlesource.gerrit.plugins.download.command.project.Module',
+    'Implementation-Title: Project download command plugin',
+    'Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/project-download-commands',
+  ]
+)
+# this is required for bucklets/tools/eclipse/project.py to work
+java_library(
+  name = 'classpath',
+  deps = [':project-download-commands__plugin'],
+)
+
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
new file mode 100644
index 0000000..04406f8
--- /dev/null
+++ b/lib/gerrit/BUCK
@@ -0,0 +1,13 @@
+include_defs('//bucklets/maven_jar.bucklet')
+
+VER = '2.12.5'
+REPO = MAVEN_CENTRAL
+
+maven_jar(
+  name = 'plugin-api',
+  id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
+  sha1 = '456b8ed836cdcba672f94f397f09a67bcfbe54a7',
+  license = 'Apache2.0',
+  attach_source = False,
+  repository = REPO,
+)
diff --git a/pom.xml b/pom.xml
index f903fe0..5565b6a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
   <groupId>com.google.gerrit</groupId>
   <artifactId>project-download-commands</artifactId>
   <packaging>jar</packaging>
-  <version>2.11.10</version>
+  <version>2.12.5</version>
   <name>project-download-commands</name>
 
   <properties>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/project/DownloadCommandUpdater.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/project/DownloadCommandUpdater.java
index 125426e..ce0f857 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/project/DownloadCommandUpdater.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/project/DownloadCommandUpdater.java
@@ -73,12 +73,22 @@
 
   @Override
   public void start() {
-    for (Project.NameKey p : projectCache.all()) {
-      ProjectState projectState = projectCache.get(p);
-      if (projectState != null) {
-        installCommandAsync(projectState);
+    executor.submit(new Runnable() {
+      @Override
+      public void run() {
+        for (Project.NameKey p : projectCache.all()) {
+          ProjectState projectState = projectCache.get(p);
+          if (projectState != null) {
+            PluginConfig cfg =
+                projectState.getConfig().getPluginConfig(pluginName);
+            for (String name : cfg.getNames()) {
+              installCommand(projectState.getProject().getNameKey(), name,
+                  cfg.getString(name));
+            }
+          }
+        }
       }
-    }
+    });
   }
 
   @Override
@@ -117,18 +127,6 @@
     }
   }
 
-  private void installCommandAsync(final ProjectState p) {
-    executor.submit(new Runnable() {
-      @Override
-      public void run() {
-        PluginConfig cfg = p.getConfig().getPluginConfig(pluginName);
-        for (String name : cfg.getNames()) {
-          installCommand(p.getProject().getNameKey(), name, cfg.getString(name));
-        }
-      }
-    });
-  }
-
   private void installCommand(final Project.NameKey p, String name,
       final String command) {
     ProjectDownloadCommand dc = projectDownloadCommands.get(name);