gerrit/gerrit-pgm/BUCK
Dave Borowitz b8336f176a Move most GPG-related code to a gerrit-gpg module
Bouncy Castle is still an optional dependency for Gerrit, so we want
to avoid accidentally attempting to load Bouncy Castle classes when
they might not be available. Rather than try to guard every
org.bouncycastle.* reference with a hasPGP() check, reduce the surface
area of calls that actually require Bouncy Castle. Move almost all
code that calls Bouncy Castle into a new module, gerrit-gpg.

Callers need only interact with this module by installing the
GpgModule, which is careful to protect all Bouncy Castle class loading
with the appropriate havePGP() check. Moreover, this module doesn't
need to be installed in the gerrit-server package at all, so we can
break the compile-time dependency between gerrit-server and Bouncy
Castle, so accidentally introducing a dependency on Bouncy Castle
results in a compile error.

The REST API and extension APIs dealing with GPG keys only refer to
the GpgKeyInfo POJO, and don't need to actually refer to Bouncy Castle
classes. Add a shim interface, GpgApiAdapter, that is used by
AccountApiImpl to process GPG keys. GpgModule binds this interface to
either the Bouncy Castle enabled implementation, or a not-implemented
implementation.

Since there are various places in the server code where we want to
inspect whether signed push is enabled at the server level, but we
don't want to have to call into gerrit-gpg code to do this, bind a
boolean with @EnableSignedPush from GpgModule.

Change-Id: Idbab00a52d86216cae73d02876d56be54aef6581
2015-08-28 14:13:13 -04:00

144 lines
3.1 KiB
Python

SRCS = 'src/main/java/com/google/gerrit/pgm/'
RSRCS = 'src/main/resources/com/google/gerrit/pgm/'
INIT_API_SRCS = glob([SRCS + 'init/api/*.java'])
DEPS = [
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:linker_server',
'//gerrit-gwtexpui:server',
'//gerrit-httpd:httpd',
'//gerrit-server:server',
'//gerrit-sshd:sshd',
'//gerrit-reviewdb:server',
'//lib:guava',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit:jgit',
'//lib/log:api',
'//lib/log:jsonevent-layout',
'//lib/log:log4j'
]
java_library(
name = 'init-api',
srcs = INIT_API_SRCS,
deps = DEPS + ['//gerrit-common:annotations'],
visibility = ['PUBLIC'],
)
java_sources(
name = 'init-api-src',
srcs = INIT_API_SRCS,
visibility = ['PUBLIC'],
)
java_library(
name = 'init',
srcs = glob([SRCS + 'init/*.java']),
resources = glob([RSRCS + 'init/*']),
deps = DEPS + [
':init-api',
':util',
'//gerrit-common:annotations',
'//gerrit-lucene:lucene',
'//lib:args4j',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:h2',
'//lib/commons:validator',
'//lib/mina:sshd',
],
provided_deps = ['//gerrit-launcher:launcher'],
visibility = [
'//gerrit-acceptance-tests/...',
'//gerrit-war:',
],
)
java_library(
name = 'util',
srcs = glob([SRCS + 'util/*.java']),
deps = DEPS + [
'//gerrit-cache-h2:cache-h2',
'//gerrit-util-cli:cli',
'//lib:args4j',
'//lib:gwtorm',
'//lib/commons:dbcp',
],
visibility = [
'//gerrit-acceptance-tests/...',
'//gerrit-gwtdebug:gwtdebug',
'//gerrit-war:',
],
)
java_library(
name = 'http',
srcs = glob([SRCS + 'http/**/*.java']),
deps = DEPS + [
'//lib/jetty:jmx',
'//lib/jetty:server',
'//lib/jetty:servlet',
],
provided_deps = [
'//gerrit-launcher:launcher',
'//lib:servlet-api-3_1',
],
visibility = ['//gerrit-war:'],
)
java_library(
name = 'pgm',
srcs = glob([SRCS + '*.java', SRCS + 'rules/*.java']),
resources = glob([RSRCS + '*']),
deps = DEPS + [
':http',
':init',
':init-api',
':util',
'//gerrit-cache-h2:cache-h2',
'//gerrit-gpg:gpg',
'//gerrit-lucene:lucene',
'//gerrit-oauth:oauth',
'//gerrit-openid:openid',
'//lib:args4j',
'//lib:gwtorm',
'//lib:protobuf',
'//lib:servlet-api-3_1',
'//lib/auto:auto-value',
'//lib/prolog:cafeteria',
'//lib/prolog:compiler',
'//lib/prolog:runtime',
],
provided_deps = ['//gerrit-launcher:launcher'],
visibility = [
'//:',
'//gerrit-acceptance-tests/...',
'//gerrit-gwtdebug:gwtdebug',
'//tools/eclipse:classpath',
'//Documentation:licenses.txt',
],
)
java_test(
name = 'pgm_tests',
srcs = glob(['src/test/java/**/*.java']),
deps = [
':init',
':init-api',
':pgm',
'//gerrit-common:server',
'//gerrit-server:server',
'//lib:guava',
'//lib:junit',
'//lib/easymock:easymock',
'//lib/guice:guice',
'//lib/jgit:jgit',
'//lib/jgit:junit',
],
source_under_test = [':pgm'],
)