Merge branch 'stable-2.16'

* stable-2.16:
  Upgrade javamelody-core to 1.76.0
  Upgrade bazlets to latest stable-2.16 to build with 2.16.4 API
  Upgrade bazlets to latest stable-2.15 to build with 2.15.9 API
  Upgrade bazlets to latest stable-2.15 to build with 2.15.8 API
  Upgrade bazlets to latest stable-2.14 to build with 2.14.18 API
  Upgrade bazlets to latest stable-2.16 to build with 2.16.2 API
  MonitoringTopMenu: Prepend path to the top menu item

Change-Id: I4eafdb96bfe4645a3f9ba6c59f66c52e27bba533
diff --git a/BUILD b/BUILD
index a680446..e9640fb 100644
--- a/BUILD
+++ b/BUILD
@@ -2,17 +2,13 @@
 load(
     "//tools/bzl:plugin.bzl",
     "PLUGIN_DEPS",
-    "PLUGIN_DEPS_NEVERLINK",
     "PLUGIN_TEST_DEPS",
     "gerrit_plugin",
 )
 
 gerrit_plugin(
     name = "javamelody",
-    srcs = glob(
-        ["src/main/java/**/*.java"],
-        exclude = ["src/main/java/com/googlesource/gerrit/plugins/javamelody/MonitoringDataSourceInterceptor.java"],
-    ),
+    srcs = glob(["src/main/java/**/*.java"]),
     manifest_entries = [
         "Gerrit-PluginName: javamelody",
         "Gerrit-Module: com.googlesource.gerrit.plugins.javamelody.Module",
@@ -21,20 +17,7 @@
         "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/javamelody",
     ],
     resources = glob(["src/main/resources/**/*"]),
-    deps = ["@javamelody-core//jar:neverlink"],
-)
-
-java_binary(
-    name = "javamelody-deps",
-    main_class = "Dummy",
-    runtime_deps = [":javamelody-datasource-interceptor-lib"],
-)
-
-java_library(
-    name = "javamelody-datasource-interceptor-lib",
-    srcs = ["src/main/java/com/googlesource/gerrit/plugins/javamelody/MonitoringDataSourceInterceptor.java"],
-    visibility = ["//visibility:public"],
-    deps = PLUGIN_DEPS_NEVERLINK + [
+    deps = [
         "@javamelody-core//jar",
         "@jrobin//jar",
     ],
diff --git a/WORKSPACE b/WORKSPACE
index 26fac86..f19f009 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,27 +3,27 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "c15e64db2a87c0453427ff45f79d1ed3899b5d92",
+    commit = "60bb597a9b8b0700334f8845ca61a7abc604ffcc",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
 # Snapshot Plugin API
-#load(
-#    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-#    "gerrit_api_maven_local",
-#)
-
-# Load snapshot Plugin API
-#gerrit_api_maven_local()
-
-# Release Plugin API
 load(
-    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
-    "gerrit_api",
+    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
+    "gerrit_api_maven_local",
 )
 
+# Load snapshot Plugin API
+gerrit_api_maven_local()
+
+# Release Plugin API
+#load(
+#    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
+#    "gerrit_api",
+#)
+
 # Load release Plugin API
-gerrit_api()
+#gerrit_api()
 
 load("//:external_plugin_deps.bzl", "external_plugin_deps")
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/javamelody/MonitoringDataSourceInterceptor.java b/src/main/java/com/googlesource/gerrit/plugins/javamelody/MonitoringDataSourceInterceptor.java
deleted file mode 100644
index ab0edd2..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/javamelody/MonitoringDataSourceInterceptor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.javamelody;
-
-import com.google.gerrit.extensions.persistence.DataSourceInterceptor;
-import javax.sql.DataSource;
-import net.bull.javamelody.JdbcWrapper;
-
-public class MonitoringDataSourceInterceptor implements DataSourceInterceptor {
-
-  @Override
-  public DataSource intercept(String name, DataSource dataSource) {
-    return JdbcWrapper.SINGLETON.createDataSourceProxy(name, dataSource);
-  }
-}
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 3ca3dbd..59d9411 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -23,30 +23,6 @@
   bazel-genfiles/@PLUGIN@.jar
 ```
 
-Then to build the plugin dependencies execute:
-
-```
-bazel build @PLUGIN@-deps_deploy.jar
-```
-
-The output is created in
-
-```
-  bazel-bin/@PLUGIN@-deps_deploy.jar
-```
-
-Given the @PLUGIN@.jar does not contains the plugin dependencies, the @PLUGIN@.jar
-should be deployed to the `gerrit_site/plugins` folder as usual and the bazel-bin/@PLUGIN@-deps_deploy.jar should be deployed to the `gerrit_site/lib`
-folder:
-
-```
-cp bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar `$gerrit_site/plugins`
-cp bazel-bin/plugins/@PLUGIN@/@PLUGIN@-deps_deploy.jar `$gerrit_site/lib`
-```
-
-To enable the plugin database interception capabilities follow the instructions
-in [database monitoring](database-monitoring.md) page.
-
 To package the plugin sources run:
 
 ```
@@ -89,36 +65,12 @@
   bazel build plugins/javamelody:javamelody
 ```
 
-Note, that the plugin dependencies with [database interception](database-monitoring.md)
-are built separately. To do that, issue this command:
-
-```
-  bazel build plugins/javamelody:javamelody-deps_deploy.jar
-```
-
-The output from the former target is:
-
-```
-  bazel-genfiles/plugins/javamelody/javamelody.jar
-```
-
-The output from the latter targets are:
-
-```
-  bazel-bin/plugins/javamelody/javamelody-deps_deploy.jar
-```
-
 To execute the tests run:
 
 ```
   bazel test plugins/@PLUGIN@:@PLUGIN@_tests
 ```
 
-[IMPORTANT]
-Both targets above are required and must be deployed to the right
-locations: `javamelody.jar` to `<gerrit_site>/plugins` directory
-and `javamelody-deps_deploy.jar` to `<gerrit_site>/lib` directory.
-
 This project can be imported into the Eclipse IDE.
 Add the plugin name to the `CUSTOM_PLUGINS` and to the
 `CUSTOM_PLUGINS_TEST_DEPS` set in Gerrit core in
diff --git a/src/main/resources/Documentation/database-monitoring.md b/src/main/resources/Documentation/database-monitoring.md
deleted file mode 100644
index 94a67ef..0000000
--- a/src/main/resources/Documentation/database-monitoring.md
+++ /dev/null
@@ -1,40 +0,0 @@
-Database-Monitoring
-===================
-
-JavaMelody supports out of the box JNDI DataSource in Web container (Tomcat).
-Because Gerrit instantiates its data source on its own, JavaMelody can not
-intercept it and therefore no SQL statistic reports can be gathered.
-
-To overcome that problem a data source proxy must be installed.
-
-Datasource interceptor JAR (that creates the data source proxy) must be
-available in the bootstrap classpath for Gerrit core to load it. Moreover,
-because the interceptor depends on javamelody core library, it must be
-provided in the bootstrap classpath too. In this case the plugin must
-not contain the javamelody core library (shaded jar).
-
-Thus the javamelody dependencies must not be packaged in the plugin itself.
-
-Add the following line to `$gerrit_site/etc/gerrit.config` under `database` section:
-
-```
-dataSourceInterceptorClass = com.googlesource.gerrit.plugins.javamelody.MonitoringDataSourceInterceptor
-```
-
-Compile the plugin according to the instructions in the [build](build.md) page.
-
-Deploy the plugin dependencies with datasource-interceptor to `$gerrit_site/lib`:
-
-```
-cp bazel-bin/plugins/javamelody/javamelody-deps_deploy.jar `$gerrit_site/lib`
-```
-
-Deploy the plugin without dependencies:
-
-```
-cp bazel-genfiles/plugins/javamelody/javamelody.jar `$gerrit_site/plugins`
-```
-
-Run Gerrit@Jetty and enjoy SQL statistics, a lá:
-
-http://i.imgur.com/8EyAA9u.png
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
index 49f0b9c..54c3963 100644
--- a/tools/eclipse/BUILD
+++ b/tools/eclipse/BUILD
@@ -5,6 +5,6 @@
     name = "main_classpath_collect",
     testonly = 1,
     deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
-        "//:javamelody-datasource-interceptor-lib",
+        "//:javamelody__plugin",
     ],
 )