gerrit/gerrit-common/BUCK
Dave Borowitz 08180de4de Support AutoValue
AutoValue[1] is a lightweight annotation-processor-based library for
implementing classes with simple, obvious value semantics.

Add support for AutoValue to build rules and Eclipse project
generation. Buck does not currently have an officially-supported
interface for specifying annotation processor dependencies[2], so we
have to take the slightly ugly approach of monkey-patching
java_library and java_test to add annotation processor arguments to
each rule that requires annotation processing; hopefully this ugliness
can be reduced in the future.

[1] https://github.com/google/auto/tree/master/value
[2] https://github.com/facebook/buck/issues/85

Change-Id: I8b49d6f9f25d61688b667d964848c6ce106ae4ec
2014-11-08 08:31:08 -08:00

82 lines
1.7 KiB
Python

SRC = 'src/main/java/com/google/gerrit/'
ANNOTATIONS = [
SRC + 'common/Nullable.java',
SRC + 'common/audit/Audit.java',
SRC + 'common/auth/SignInRequired.java',
]
EXCLUDES = [
SRC + 'common/SiteLibraryLoaderUtil.java',
SRC + 'common/PluginData.java',
SRC + 'common/FileUtil.java',
SRC + 'common/IoUtil.java',
SRC + 'common/TimeUtil.java',
]
java_library(
name = 'annotations',
srcs = ANNOTATIONS,
visibility = ['PUBLIC'],
)
gwt_module(
name = 'client',
srcs = glob([SRC + 'common/**/*.java'], excludes = EXCLUDES),
gwt_xml = SRC + 'Common.gwt.xml',
deps = [
':annotations',
'//gerrit-extension-api:client',
'//gerrit-patch-jgit:client',
'//gerrit-prettify:client',
'//gerrit-reviewdb:client',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib/jgit:jgit',
],
visibility = ['PUBLIC'],
)
java_library(
name = 'server',
srcs = glob([SRC + 'common/**/*.java'], excludes = ANNOTATIONS),
deps = [
':annotations',
'//gerrit-extension-api:api',
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:guava',
'//lib/jgit:jgit',
'//lib/joda:joda-time',
],
visibility = ['PUBLIC'],
)
TEST = 'src/test/java/com/google/gerrit/common/'
AUTO_VALUE_TEST_SRCS = [TEST + 'AutoValueTest.java']
java_test(
name = 'client_tests',
srcs = glob(['src/test/java/**/*.java'], excludes = AUTO_VALUE_TEST_SRCS),
deps = [
':client',
'//lib:guava',
'//lib:junit',
],
source_under_test = [':client'],
)
java_test(
name = 'auto_value_tests',
srcs = AUTO_VALUE_TEST_SRCS,
deps = [
'//lib:guava',
'//lib:junit',
'//lib:truth',
'//lib/auto:auto-value',
],
)