17bb3dbfe8
Consume JGit as first third party library from its own cell. Normally the cell is defined as lib/jgit directory. It can be easily replaced with CLI: buck build --config repositories.jgit=path/to/dev/jgit gerrit or tweaking the .buckconfig: [repositories] jgit = path/to/dev/jgit The former approach is sufficient to build and run the test from the CLI, the latter is needed to generate eclipse project. To isolate the JGit rules in its own cell some refactoring was needed. JGit patch for GWT module was moved to gerrit-patch-jgit project, and some symlinks were needed for maven machinery to work. include_defs() doesn't work for now across cell boundaries, and native `buck fetch` feature still has some limitations: [1]. Moreover, excluding paths, unsigning JARs and license linking should be re-implemented on top of it. [1] https://github.com/facebook/buck/issues/602 Test Plan: Normal gerrit build and the build with hijacked JGit cell should work in both standalone (gerrit.war) and Eclipse environment. Note, that to test --config repositories.jgit=path/to/dev/jgit use case, the most recent JGit tree must be used, that contains Buck driven build implementation. Change-Id: I39f2d5d75bbac88804406d6242b5e714f4916926
184 lines
3.8 KiB
Python
184 lines
3.8 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'])
|
|
|
|
BASE_JETTY_DEPS = [
|
|
'//gerrit-common:server',
|
|
'//gerrit-extension-api:api',
|
|
'//gerrit-gwtexpui:linker_server',
|
|
'//gerrit-gwtexpui:server',
|
|
'//gerrit-httpd:httpd',
|
|
'//gerrit-server:server',
|
|
'//gerrit-sshd:sshd',
|
|
'//lib:guava',
|
|
'//lib/guice:guice',
|
|
'//lib/guice:guice-assistedinject',
|
|
'//lib/guice:guice-servlet',
|
|
'//lib/log:api',
|
|
'//lib/log:log4j',
|
|
'@jgit//:jgit',
|
|
]
|
|
|
|
DEPS = BASE_JETTY_DEPS + [
|
|
'//gerrit-reviewdb:server',
|
|
'//lib/log:jsonevent-layout',
|
|
]
|
|
|
|
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:derby',
|
|
'//lib:gwtjsonrpc',
|
|
'//lib:gwtorm',
|
|
'//lib:h2',
|
|
'//lib/commons:validator',
|
|
'//lib/mina:sshd',
|
|
],
|
|
provided_deps = ['//gerrit-launcher:launcher'],
|
|
visibility = [
|
|
'//gerrit-acceptance-framework/...',
|
|
'//gerrit-acceptance-tests/...',
|
|
'//gerrit-war:',
|
|
],
|
|
)
|
|
|
|
REST_UTIL_DEPS = [
|
|
'//gerrit-cache-h2:cache-h2',
|
|
'//gerrit-util-cli:cli',
|
|
'//lib:args4j',
|
|
'//lib:gwtorm',
|
|
'//lib/commons:dbcp',
|
|
]
|
|
|
|
java_library(
|
|
name = 'util',
|
|
deps = DEPS + REST_UTIL_DEPS,
|
|
exported_deps = [':util-nodep'],
|
|
visibility = [
|
|
'//gerrit-acceptance-tests/...',
|
|
'//gerrit-gwtdebug:gwtdebug',
|
|
'//gerrit-war:',
|
|
],
|
|
)
|
|
|
|
java_library(
|
|
name = 'util-nodep',
|
|
srcs = glob([SRCS + 'util/*.java']),
|
|
provided_deps = DEPS + REST_UTIL_DEPS,
|
|
visibility = ['//gerrit-acceptance-framework/...'],
|
|
)
|
|
|
|
JETTY_DEPS = [
|
|
'//lib/jetty:jmx',
|
|
'//lib/jetty:server',
|
|
'//lib/jetty:servlet',
|
|
]
|
|
|
|
java_library(
|
|
name = 'http',
|
|
deps = DEPS + JETTY_DEPS,
|
|
exported_deps = [':http-jetty'],
|
|
visibility = ['//gerrit-war:'],
|
|
)
|
|
|
|
java_library(
|
|
name = 'http-jetty',
|
|
srcs = glob([SRCS + 'http/jetty/*.java']),
|
|
provided_deps = JETTY_DEPS + BASE_JETTY_DEPS + [
|
|
'//gerrit-launcher:launcher',
|
|
'//gerrit-reviewdb:client',
|
|
'//lib:servlet-api-3_1',
|
|
],
|
|
visibility = ['//gerrit-acceptance-framework/...'],
|
|
)
|
|
|
|
REST_PGM_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',
|
|
]
|
|
|
|
java_library(
|
|
name = 'pgm',
|
|
resources = glob([RSRCS + '*']),
|
|
deps = DEPS + REST_PGM_DEPS + [
|
|
':daemon',
|
|
],
|
|
visibility = [
|
|
'//:',
|
|
'//gerrit-acceptance-tests/...',
|
|
'//gerrit-gwtdebug:gwtdebug',
|
|
'//tools/eclipse:classpath',
|
|
'//Documentation:licenses.txt',
|
|
],
|
|
)
|
|
|
|
# no transitive deps, used for gerrit-acceptance-framework
|
|
java_library(
|
|
name = 'daemon',
|
|
srcs = glob([SRCS + '*.java', SRCS + 'rules/*.java']),
|
|
resources = glob([RSRCS + '*']),
|
|
deps = ['//lib/auto:auto-value'],
|
|
provided_deps = DEPS + REST_PGM_DEPS + [
|
|
'//gerrit-launcher:launcher',
|
|
],
|
|
visibility = [
|
|
'//gerrit-acceptance-framework/...',
|
|
'//gerrit-gwtdebug:gwtdebug',
|
|
],
|
|
)
|
|
|
|
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',
|
|
'@jgit//:jgit',
|
|
'@jgit//:junit',
|
|
],
|
|
source_under_test = [':pgm'],
|
|
)
|