Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Upgrade bazlets to latest stable-2.16 Change-Id: Ibe1262b8e7c7e9cd9287b3cff0eba15db77bbfa4
diff --git a/BUILD b/BUILD index 1227185..241ad42 100644 --- a/BUILD +++ b/BUILD
@@ -3,17 +3,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", @@ -22,20 +18,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 a570b4f..b6c87b8 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -3,7 +3,7 @@ load("//:bazlets.bzl", "load_bazlets") load_bazlets( - commit = "2ad931eb07d5a43c7a26132716a1411a47fcbfdf", + commit = "96f691ebbf4ef1c46b798e871ed5acd9d844651c", #local_path = "/home/<user>/projects/bazlets", )
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 a6701a4..4d8de2c 100644 --- a/src/main/resources/Documentation/build.md +++ b/src/main/resources/Documentation/build.md
@@ -23,30 +23,6 @@ bazel-bin/@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-bin/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,25 +65,6 @@ bazel build plugins/@PLUGIN@:@PLUGIN@ ``` -Note, that the plugin dependencies with [database interception](database-monitoring.md) -are built separately. To do that, issue this command: - -``` - bazel build plugins/@PLUGIN@:@PLUGIN@-deps_deploy.jar -``` - -The output from the former target is: - -``` - bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar -``` - -The output from the latter targets are: - -``` - bazel-bin/plugins/@PLUGIN@/@PLUGIN@-deps_deploy.jar -``` - To execute the tests run either one of: ``` @@ -115,11 +72,6 @@ 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 7c085e7..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-bin/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", ], )