gerrit/gerrit-extension-api/BUCK
Christian Aistleitner 40748e5bdc Init plugins' AllRequestFilters, even if they are loaded after startup
When installing a plugin with AllRequestFilters after Gerrit has been
started up, the filter's doFilter is called as expected. But the
filter's init method is never called, as FilterProxy did not keep
track of which filters have been around when its own init got called.

This lack of calling init, breaks the Filter contract, and makes the
javamelody plugin throw NPEs [1] for each request when installing it
in a running Gerrit. While restarting Gerrit renders the javamelody
plugin working, the root problem is the missing call to the
filter's init.

Hence, we make FilterProxy call init for plugins that did not get
initialized when FilterProxy itself got initialized. Thereby, the
javamelody plugin can be loaded directly into a running Gerrit again.

[1]
  [2015-08-03 23:20:01,379] WARN  org.eclipse.jetty.servlet.ServletHandler : /
  java.lang.NullPointerException
          at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:170)
          at com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.doFilter(GerritMonitoringFilter.java:73)
  [...]

Change-Id: I095ef517210911c982438d8ce3a7740d05c27eee
2015-09-01 11:25:40 +09:00

77 lines
1.4 KiB
Python

SRC = 'src/main/java/com/google/gerrit/extensions/'
SRCS = glob([SRC + '**/*.java'])
EXT_API_SRCS = glob([SRC + 'client/*.java'])
gwt_module(
name = 'client',
srcs = EXT_API_SRCS,
gwt_xml = SRC + 'Extensions.gwt.xml',
visibility = ['PUBLIC'],
)
java_library(
name = 'client-lib',
srcs = EXT_API_SRCS,
resources = EXT_API_SRCS + glob([SRC + 'Extensions.gwt.xml']),
visibility = ['PUBLIC'],
)
java_binary(
name = 'extension-api',
deps = [':lib'],
visibility = ['PUBLIC'],
)
java_library(
name = 'lib',
exported_deps = [
':api',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib:servlet-api-3_1',
],
visibility = ['PUBLIC'],
)
java_library(
name = 'api',
srcs = glob([SRC + '**/*.java']),
provided_deps = [
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
],
visibility = ['PUBLIC'],
)
java_sources(
name = 'extension-api-src',
srcs = SRCS,
visibility = ['PUBLIC'],
)
java_test(
name = 'api_tests',
srcs = glob(['src/test/java/**/*.java']),
deps = [
':api',
'//lib:truth',
'//lib/guice:guice',
],
source_under_test = [':api'],
)
java_doc(
name = 'extension-api-javadoc',
title = 'Gerrit Review Extension API Documentation',
pkgs = ['com.google.gerrit.extensions'],
paths = ['src/main/java'],
srcs = SRCS,
deps = [
'//lib/guice:javax-inject',
'//lib/guice:guice_library'
],
visibility = ['PUBLIC'],
)