Bug 1457255 - 3. Turn Java warnings into errors; r=nalexander
☠☠ backed out by 076e2b910839 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Mon, 30 Apr 2018 08:40:21 -0400
changeset 469892 d486c0db4626d70c909bbc57a9dc013b222a7163
parent 469891 ed06c8833608c41c9962e11af663f852c4f20833
child 469893 076e2b91083973a1fb8c8a79bc36b7c5f3cc4bca
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. MozReview-Commit-ID: 7bFOPoBmtsc
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