Bug 1457255 - 3. Turn Java warnings into errors; r=nalexander
☠☠ backed out by 258fa1eb49c9 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Tue, 01 May 2018 00:22:54 -0400
changeset 469981 524a0f9fb9788b5fc7c7ed3aefe41a981bb546f3
parent 469980 a49833bfd519d024618c7c7f1c10c27b63474166
child 469982 9c42ce50a911718ea64e5d2266cf02d37e6e444f
push id9179
push userarchaeopteryx@coole-files.de
push dateThu, 03 May 2018 15:28:18 +0000
treeherdermozilla-beta@e6f9ade8bca7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1457255
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457255 - 3. Turn Java warnings into errors; r=nalexander Turn Java warnings into errors except for the deprecation and serial warnings. This is done for all Gradle projects except the thirdparty project.
build.gradle
--- a/build.gradle
+++ b/build.gradle
@@ -94,17 +94,33 @@ if ('multi' == System.env.AB_CD) {
             if (execResult.exitValue != 0) {
                 throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
             }
         }
     }
 }
 
 afterEvaluate {
-    subprojects {
+    subprojects { project ->
+        if (project.name != 'thirdparty') {
+            tasks.withType(JavaCompile) {
+                // Add compiler args for all code except third-party code.
+                options.compilerArgs += [
+                    // Turn on all warnings, except...
+                    "-Xlint:all",
+                    // Deprecation, because we do use deprecated API for compatibility.
+                    "-Xlint:-deprecation",
+                    // Serial, because we don't use Java serialization.
+                    "-Xlint:-serial",
+                    // Turn all remaining warnings into errors,
+                    // unless marked by @SuppressWarnings.
+                    "-Werror"]
+            }
+        }
+
         if (!hasProperty('android')) {
             return
         }
         android.applicationVariants.all {
             preBuild.dependsOn rootProject.generateCodeAndResources
         }
         android.libraryVariants.all {
             preBuild.dependsOn rootProject.generateCodeAndResources