Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Remove plugin-manager from the list of core plugins
  Remove BUCK build
  Remove check with hardcoded GERRIT_NEXT_VERSION
  Fix core plugin name extractions without MANIFEST.MF
  Backport tests from master to stable-2.16
  Set next version to 3.1

Change-Id: I4c4cab0cec3fc9db56e2e5d01482d826e642ee80
diff --git a/BUCK b/BUCK
deleted file mode 100644
index cb7c8ca..0000000
--- a/BUCK
+++ /dev/null
@@ -1,21 +0,0 @@
-include_defs('//bucklets/gerrit_plugin.bucklet')
-
-gerrit_plugin(
-  name = 'plugin-manager',
-  srcs = glob(['src/main/java/**/*.java']),
-  resources = glob(['src/main/**/*']),
-  manifest_entries = [
-    'Gerrit-PluginName: plugin-manager',
-    'Gerrit-ApiType: plugin',
-    'Gerrit-HttpModule: com.googlesource.gerrit.plugins.manager.WebModule',
-    'Gerrit-Module: com.googlesource.gerrit.plugins.manager.Module',
-    'Gerrit-ReloadMode: restart',
-    'Implementation-Title: Plugin manager',
-    'Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/plugin-manager',
-  ],
-  provided_deps = [
-    '//lib:gson',
-    '//lib/log:log4j'
-  ],
-)
-
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java b/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
index 11a13bf..ab75730 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
@@ -15,13 +15,11 @@
 package com.googlesource.gerrit.plugins.manager;
 
 public class GerritVersionBranch {
-  private static final String GERRIT_NEXT_VERSION = "3.1";
 
   public static String getBranch(String gerritVersion) {
     if (gerritVersion == null
         || gerritVersion.trim().isEmpty()
-        || !Character.isDigit(gerritVersion.trim().charAt(0))
-        || gerritVersion.startsWith(GERRIT_NEXT_VERSION)) {
+        || !Character.isDigit(gerritVersion.trim().charAt(0))) {
       return "master";
     }
     String[] versionNumbers = gerritVersion.split("\\.");
@@ -34,12 +32,8 @@
 
     if (versionNumbers.length > 2) {
       String fixVersionNumber = versionNumbers[2];
-      if (fixVersionNumber.contains("-g")) {
-        String nextVersion =
-            String.format("%s.%d", versionNumbers[0], Integer.parseInt(versionNumbers[1]) + 1);
-        if (nextVersion.equals(GERRIT_NEXT_VERSION)) {
-          return "master";
-        }
+      if (fixVersionNumber.contains("-") && !fixVersionNumber.contains("-rc")) {
+        return "master";
       }
     }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranchTest.java b/src/test/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranchTest.java
index 8ab2fd4..be2d9e4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranchTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranchTest.java
@@ -50,12 +50,13 @@
 
   @Test
   public void getBranchReturnsCorrectBranchForDevelopmentOnStableBranches() throws Exception {
-    assertBranch("2.16.8-17-gc8b633d5ce", "stable-2.16");
+    assertBranch("2.16.8", "stable-2.16");
+    assertBranch("3.0.0-rc2", "stable-3.0");
   }
 
   @Test
   public void getBranchReturnsCorrectBranchForDevelopmentOnMaster() throws Exception {
-    assertBranch("3.0.0-rc2-237-gae0124c68e", "master");
+    assertBranch("3.0.0-237-gae0124c68e", "master");
   }
 
   @Test