Merge "Buck: Activate error prone checks"

This commit is contained in:
David Ostrovsky 2016-12-13 20:55:54 +00:00 committed by Gerrit Code Review
commit 52e9272e68
3 changed files with 32 additions and 0 deletions

View File

@ -685,6 +685,25 @@ Watchman can either be de-installed or disabled. See
link:#buck-daemon[Using Buck daemon] section above how to temporarily
disable `buckd`.
== Error Prone integration
link:http://errorprone.info[Error Prone] is a static analysis tool for
Java that catches common programming mistakes at compile-time. It can
be permanenty or instantly activated. For permanent activation, add these
lines to your `.buckconfig.local` file in gerrit tree:
```
[sanitizers]
error_prone = 1
```
For instant activation, pass this config option to the `build` or `test`
commands:
```
buck build --config sanitizers.error_prone=1 gerrit
```
== Troubleshooting Buck
In some cases problems with Buck itself need to be investigated. See for example

View File

@ -310,3 +310,10 @@ maven_jar(
sha1 = '198ea005f41219f038f4291f0b0e9f3259730e92',
license = 'icu4j',
)
maven_jar(
name = 'errorprone',
id = 'com.google.errorprone:error_prone_ant:2.0.15',
sha1 = '607e3866e2ee25b74708c2898f84eac2f5452d2f',
license = 'Apache2.0',
)

View File

@ -41,9 +41,15 @@ def java_test(*args, **kwargs):
# Munge kwargs to set Gerrit-specific defaults.
def _munge_args(kwargs):
if read_config('sanitizers', 'error_prone'):
_set_error_prone(kwargs)
_set_auto_value(kwargs)
_set_extra_arguments(kwargs)
def _set_error_prone(kwargs):
kwargs['javac_jar'] = '//lib:errorprone'
kwargs['compiler_class_name'] = 'com.google.errorprone.ErrorProneJavaCompiler'
def _set_extra_arguments(kwargs):
ext = 'extra_arguments'
if ext not in kwargs: