Bug 1641711 - Make javadoc output parsing more resilient. r=snorp
authorAgi Sferro <agi@sferro.dev>
Mon, 01 Jun 2020 15:58:05 +0000
changeset 597406 eb654059cd8baa99ade5008b2b5bd93166604c44
parent 597405 4618c9093d0e36521021f3dde91c5e86e2da54ce
child 597407 0f5a98fe760847762c1536443c87fa81349c70fe
push id13310
push userffxbld-merge
push dateMon, 29 Jun 2020 14:50:06 +0000
treeherdermozilla-beta@15a59a0afa5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1641711
milestone78.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 1641711 - Make javadoc output parsing more resilient. r=snorp As it turns out, javadoc output is not stable across platforms / OSs / versions (not a big suprise). E.g. in try this is an example line: ``` /builds/worker/checkouts/gecko/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java:1124: warning - Tag @link: reference not found: Autocomplete.LoginStorageDelegate.onLoginFetch onLoginFetch ``` on my mac, this is the same error: ``` /Users/asferro/workspace/mozilla-central/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java:1118: error: reference not found * {@link Autocomplete.LoginStorageDelegate.onLoginFetch onLoginFetch}. ``` Notice the `-` character after `warning` in the first example and the `:` character after the second example. To be able to parse both this patch simiplifies the regex and also adds a failsafe that will mark anything that contains the string "error" and "warning" as such. Differential Revision: https://phabricator.services.mozilla.com/D77545
mobile/android/geckoview/build.gradle
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -256,19 +256,25 @@ android.libraryVariants.all { variant ->
         description = "Generate Javadoc for build variant $name"
         destinationDir = new File(destinationDir, variant.baseName)
         doFirst {
             classpath = files(variant.javaCompileProvider.get().classpath.files)
         }
 
         def results = []
         def listener = {
+            if (!it.toLowerCase().contains("warning") && !it.toLowerCase().contains("error")) {
+              // Likely not an error or a warning
+              return
+            }
             // Like '/abs/path/to/topsrcdir/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java:480: warning: no @return'
-            def matches = (it =~ /(.+):(\d+): (warning|error): (.*)/)
+            def matches = (it =~ /(.+):(\d+):.*(warning|error)(.*)/)
             if (!matches) {
+                // could not parse, let's add it anyway since it's a warning or error
+                results << [path: "parsing-failed", lineno: 0, level: "error", message: it]
                 return
             }
             def (_, file, line, level, message) = matches[0]
             results << [path: file, lineno: line, level: level, message: message]
         } as StandardOutputListener
 
         doFirst {
             logging.addStandardErrorListener(listener)