Buck: Activate error prone checks
Given that Bazel activates error prone static analyzer per default,
allow to activate it for Buck as well.  We already monkey patch
java_library and java_test rules, so it's trivial to munge javac_jar
and compiler_class_name attributes as well.
Due to compile performance coniderations and some issues that were
reported with error prone activated by default in Buck driven build,
we make the integration optional and disabled by default. There are
two option to activate it:
1. Add these lines to your private .buckconfig.local to permanently
activate error prone checks:
  [sanitizers]
    error_prone = 1
2. Use this config option to instantly run error prone check:
  buck build --config sanitizers.error_prone=1  gerrit
Error prone has an issue with naming artifact with all transitive
dependencies included: while it has the suffix "ant", it should be
just called "all". But, TBH, we don't care.
Error Prone is Google library and is released under Apache 2 license.
Change-Id: I2bbe0313ad3e54df1d52968cc28d7e13db36d83f
			
			
This commit is contained in:
		
				
					committed by
					
						
						David Ostrovsky
					
				
			
			
				
	
			
			
			
						parent
						
							24669bb247
						
					
				
				
					commit
					8b73d9cb56
				
			@@ -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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user