Index: build/android/gyp/javac.py |
diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py |
index a0fcda815635e0d19948ab394f459ff49c9a08bf..866bcfe03b9fe4382c6a79dc1c4bf078b7d3e94f 100755 |
--- a/build/android/gyp/javac.py |
+++ b/build/android/gyp/javac.py |
@@ -55,7 +55,8 @@ def ColorJavacOutput(output): |
def DoJavac( |
- classpath, classes_dir, chromium_code, java_files): |
+ classpath, classes_dir, chromium_code, |
+ use_errorprone, errorprone_path, java_files): |
"""Runs javac. |
Builds |java_files| with the provided |classpath| and puts the generated |
@@ -88,7 +89,28 @@ def DoJavac( |
# trigger a compile warning or error. |
javac_args.extend(['-XDignore.symbol.file']) |
- javac_cmd = ['javac'] + javac_args + java_files |
+ def GetErrorproneCommand(): |
jbudorick
2015/05/15 18:37:12
This should not be done with a local function.
raywilliams_chromium
2015/05/18 19:53:23
Done.
|
+ disabled_checks = [ |
+ # Something in chrome_private_java makes this check crash. |
+ 'ClassCanBeStatic', |
+ # These crash on lots of targets. |
+ 'WrongParameterPackage', |
+ 'GuiceOverridesGuiceInjectableMethod', |
+ 'GuiceOverridesJavaxInjectableMethod', |
+ 'ElementsCountedInLoop', |
+ ] |
+ errorprone_options = [ |
jbudorick
2015/05/15 18:37:12
errorprone_options can just be a constant, right?
raywilliams_chromium
2015/05/18 19:53:24
Hmm... I don't think python has constants. I can k
jbudorick
2015/05/18 19:58:32
Python doesn't have constants in that the interpre
raywilliams_chromium
2015/05/18 20:50:23
cool - extracted constant
and re-tested to make su
raywilliams_chromium
2015/05/18 20:50:23
Done.
|
+ '-Xepdisable:' + ','.join( |
+ ['com.google.errorprone.bugpatterns.' + s for s in disabled_checks]) |
+ ] |
+ return [errorprone_path] + errorprone_options |
+ |
+ if use_errorprone: |
+ javac_cmd = GetErrorproneCommand() |
+ else: |
+ javac_cmd = ['javac'] |
+ |
+ javac_cmd = javac_cmd + javac_args + java_files |
def Compile(): |
build_utils.CheckOutput( |
@@ -184,6 +206,14 @@ def main(argv): |
'warnings for chromium code.') |
parser.add_option( |
jbudorick
2015/05/15 18:37:12
Do we need both of these options? Passing --enable
raywilliams_chromium
2015/05/18 19:53:23
Done.
raywilliams_chromium
2015/05/18 19:53:23
Good idea :)
|
+ '--enable-errorprone', |
+ action='store_true', |
+ help='Use this to enable use of the errorprone compiler.') |
+ parser.add_option( |
+ '--errorprone-path', |
+ help='Path to the errorprone compiler executable.') |
+ |
+ parser.add_option( |
'--classes-dir', |
help='Directory for compiled .class files.') |
parser.add_option('--jar-path', help='Jar output path.') |
@@ -240,6 +270,8 @@ def main(argv): |
classpath, |
classes_dir, |
options.chromium_code, |
+ options.chromium_code and options.enable_errorprone, |
+ options.errorprone_path, |
java_files) |
if options.jar_path: |