summaryrefslogtreecommitdiffstats
path: root/build/config
diff options
context:
space:
mode:
authorraywilliams <raywilliams@google.com>2015-06-22 09:17:37 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-22 16:17:59 +0000
commit6ffb1179d6adf08edd64848b45b7415b6b6de43d (patch)
tree18fbe00ba29dae845f555ec1f266cb75693b45e0 /build/config
parent50f6a89145b1e209ae464d95b1576a2a4116ac8a (diff)
downloadchromium_src-6ffb1179d6adf08edd64848b45b7415b6b6de43d.zip
chromium_src-6ffb1179d6adf08edd64848b45b7415b6b6de43d.tar.gz
chromium_src-6ffb1179d6adf08edd64848b45b7415b6b6de43d.tar.bz2
Add the Errorprone Java Compiler
These changes let the errorprone compiler find problems when building Android. A global flag disabled Errorprone by default. When enabled, code problems will be shown with suggestions on how to fix them. BUG=485599 Review URL: https://codereview.chromium.org/1136573002 Cr-Commit-Position: refs/heads/master@{#335509}
Diffstat (limited to 'build/config')
-rw-r--r--build/config/android/config.gni3
-rw-r--r--build/config/android/internal_rules.gni17
-rw-r--r--build/config/android/rules.gni14
3 files changed, 33 insertions, 1 deletions
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index e74e8fe..d6a8ad5 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -42,6 +42,9 @@ if (is_android) {
# Set to true to run findbugs on JAR targets.
run_findbugs = false
+
+ # Set to true to enable the Errorprone compiler
+ use_errorprone_java_compiler = false
}
# Host stuff -----------------------------------------------------------------
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 0933ceb..1988d8f 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -909,6 +909,12 @@ template("compile_java") {
if (defined(invoker.chromium_code)) {
_chromium_code = invoker.chromium_code
}
+
+ _enable_errorprone = use_errorprone_java_compiler
+ if (defined(invoker.enable_errorprone)) {
+ _enable_errorprone = invoker.enable_errorprone
+ }
+
_manifest_entries = []
if (defined(invoker.manifest_entries)) {
_manifest_entries = invoker.manifest_entries
@@ -978,7 +984,13 @@ template("compile_java") {
if (_chromium_code) {
args += [ "--chromium-code=1" ]
}
-
+ if (_enable_errorprone) {
+ deps += [ "//third_party/errorprone:chromium_errorprone" ]
+ args += [
+ "--use-errorprone-path",
+ "bin/chromium_errorprone",
+ ]
+ }
args += rebase_path(_java_files, root_build_dir)
}
@@ -1128,6 +1140,9 @@ template("java_library_impl") {
chromium_code = _chromium_code
android = _requires_android
+ if (defined(invoker.enable_errorprone)) {
+ _enable_errorprone = invoker.enable_errorprone
+ }
if (defined(invoker.jar_excluded_patterns)) {
jar_excluded_patterns = invoker.jar_excluded_patterns
}
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 4c22fac..b831c09 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -798,6 +798,7 @@ template("java_strings_grd_prebuilt") {
# android_library target, for example.
#
# chromium_code: If true, extra analysis warning/errors will be enabled.
+# enable_errorprone: If true, enables the errorprone compiler.
#
# data_deps, testonly
#
@@ -825,6 +826,9 @@ template("java_binary") {
if (defined(invoker.deps)) {
deps = invoker.deps
}
+ if (defined(invoker.enable_errorprone)) {
+ enable_errorprone = invoker.enable_errorprone
+ }
if (defined(invoker.java_files)) {
java_files = invoker.java_files
}
@@ -919,6 +923,8 @@ template("junit_binary") {
# ease the gyp->gn conversion and will be removed in the future.
#
# chromium_code: If true, extra analysis warning/errors will be enabled.
+# enable_errorprone: If true, enables the errorprone compiler.
+#
# jar_excluded_patterns: List of patterns of .class files to exclude from the
# final jar.
#
@@ -967,6 +973,9 @@ template("java_library") {
if (defined(invoker.deps)) {
deps = invoker.deps
}
+ if (defined(invoker.enable_errorprone)) {
+ enable_errorprone = invoker.enable_errorprone
+ }
if (defined(invoker.jar_excluded_patterns)) {
jar_excluded_patterns = invoker.jar_excluded_patterns
}
@@ -1058,6 +1067,8 @@ template("java_prebuilt") {
# ease the gyp->gn conversion and will be removed in the future.
#
# chromium_code: If true, extra analysis warning/errors will be enabled.
+# enable_errorprone: If true, enables the errorprone compiler.
+#
# jar_excluded_patterns: List of patterns of .class files to exclude from the
# final jar.
#
@@ -1103,6 +1114,9 @@ template("android_library") {
if (defined(invoker.deps)) {
deps = invoker.deps
}
+ if (defined(invoker.enable_errorprone)) {
+ enable_errorprone = invoker.enable_errorprone
+ }
if (defined(invoker.jar_excluded_patterns)) {
jar_excluded_patterns = invoker.jar_excluded_patterns
}