Bug 1371445 - Pre: Produce and upload XML and HTML findbugs reports. r=maliu
We want HTML reports for humans and XML reports for processing. It's
unfortunate that we need to handle this manually, but here we are.
MozReview-Commit-ID: BKEhl7cInPP
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -433,72 +433,107 @@ def makeTaskExecutionListener(artifactRo
println "TEST-UNEXPECTED-FAIL | android-lint | Lint found errors in the project; aborting build. See the report at: $url"
break
case ':app:testOfficialAustralisDebugUnitTest':
def url = "${artifactRootUrl}/public/android/unittest/officialAustralisDebug/index.html"
println "TEST-UNEXPECTED-FAIL | android-test | There were failing tests. See the reports at: $url"
break
- case ':app:findbugsOfficialAustralisDebug':
+ case ':app:findbugsHtmlOfficialAustralisDebug':
def url = "${artifactRootUrl}/public/android/findbugs/findbugs-officialAustralisDebug-output.html"
println "TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: $url"
break
+ case ':app:findbugsXmlOfficialAustralisDebug':
+ def url = "${artifactRootUrl}/public/android/findbugs/findbugs-officialAustralisDebug-output.xml"
+ println "TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: $url"
+ break
+
case ':app:lintOfficialPhotonDebug':
def url = "${artifactRootUrl}/public/android/lint/lint-results-officialPhotonDebug.html"
println "TEST-UNEXPECTED-FAIL | android-lint | Lint found errors in the project; aborting build. See the report at: $url"
break
case ':app:testOfficialPhotonDebugUnitTest':
def url = "${artifactRootUrl}/public/android/unittest/officialPhotonDebug/index.html"
println "TEST-UNEXPECTED-FAIL | android-test | There were failing tests. See the reports at: $url"
break
- case ':app:findbugsOfficialPhotonDebug':
+ case ':app:findbugsHtmlOfficialPhotonDebug':
def url = "${artifactRootUrl}/public/android/findbugs/findbugs-officialPhotonDebug-output.html"
println "TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: $url"
break
+
+ case ':app:findbugsXmlOfficialPhotonDebug':
+ def url = "${artifactRootUrl}/public/android/findbugs/findbugs-officialPhotonDebug-output.xml"
+ println "TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: $url"
+ break
}
}
}
}
// TASK_ID and RUN_ID are provided by docker-worker; see
// https://docs.taskcluster.net/manual/execution/workers/docker-worker.
if (System.env.TASK_ID && System.env.RUN_ID) {
def artifactRootUrl = "https://queue.taskcluster.net/v1/task/${System.env.TASK_ID}/runs/${System.env.RUN_ID}/artifacts"
gradle.addListener(makeTaskExecutionListener(artifactRootUrl))
}
-// Bug 1320035: Gradle configuration for running findbugs
+// Bug 1320035: Gradle configuration for running findbugs. Findbugs only allows
+// to generate one report per invocation: https://stackoverflow.com/a/42720235.
+// Run two tasks, accepting the cost of duplicate work.
android.applicationVariants.all { variant ->
- task("findbugs${variant.name.capitalize()}", type: FindBugs) {
- description "Analyze ${variant.name} code with findbugs"
+ task("findbugsHtml${variant.name.capitalize()}", type: FindBugs) {
+ // TODO: figure out how to share the shared configuration.
+ description "Analyze ${variant.name} code with findbugs (HTML report)"
group "Verification"
ignoreFailures = false // We want builds to fail when running this task and issues are found
effort = "max" // Using more memory and time to find issues is acceptable in automation
reportLevel = "high" // For now we only care about high priority bugs. After we have fixed
// the issues with medium/low priority we can lower the report level here.
classes = files("$project.buildDir/intermediates/classes")
source = variant.javaCompile.source
classpath = variant.javaCompile.classpath
excludeFilter = file("findbugs-exclude.xml")
+ dependsOn "assemble${variant.name.capitalize()}"
reports {
- html.enabled = true // We only care about HTML reports for humans
- xml.enabled = false
-
+ html.enabled = true // HTML reports for humans.
html.destination = "$project.buildDir/outputs/findbugs/findbugs-${variant.name}-output.html"
+ xml.enabled = false
}
+ }
+
+ task("findbugsXml${variant.name.capitalize()}", type: FindBugs) {
+ // TODO: figure out how to share the shared configuration.
+ description "Analyze ${variant.name} code with findbugs (XML report)"
+ group "Verification"
+ ignoreFailures = false // We want builds to fail when running this task and issues are found
+ effort = "max" // Using more memory and time to find issues is acceptable in automation
+ reportLevel = "high" // For now we only care about high priority bugs. After we have fixed
+ // the issues with medium/low priority we can lower the report level here.
+
+ classes = files("$project.buildDir/intermediates/classes")
+ source = variant.javaCompile.source
+ classpath = variant.javaCompile.classpath
+
+ excludeFilter = file("findbugs-exclude.xml")
dependsOn "assemble${variant.name.capitalize()}"
+
+ reports {
+ xml.enabled = true // XML reports for machines.
+ xml.destination = "$project.buildDir/outputs/findbugs/findbugs-${variant.name}-output.xml"
+ html.enabled = false
+ }
}
}
// Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
apply from: "${topsrcdir}/mobile/android/gradle/debug_level.gradle"
android.applicationVariants.all configureVariantDebugLevel
--- a/taskcluster/ci/android-stuff/kind.yml
+++ b/taskcluster/ci/android-stuff/kind.yml
@@ -255,19 +255,25 @@ jobs:
disable_signing.py
platform_supports_post_upload_to_latest.py
MOZHARNESS_SCRIPT: "mozharness/scripts/fx_desktop_build.py"
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-frontend/releng.manifest"
artifacts:
- name: public/android/findbugs/findbugs-officialAustralisDebug-output.html
path: /home/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialAustralisDebug-output.html
type: file
+ - name: public/android/findbugs/findbugs-officialAustralisDebug-output.xml
+ path: /home/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialAustralisDebug-output.xml
+ type: file
- name: public/android/findbugs/findbugs-officialPhotonDebug-output.html
path: /home/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialPhotonDebug-output.html
type: file
+ - name: public/android/findbugs/findbugs-officialPhotonDebug-output.xml
+ path: /home/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialPhotonDebug-output.xml
+ type: file
- name: public/build
path: /home/worker/artifacts/
type: directory
caches:
- name: tooltool-cache
mount-point: /home/worker/tooltool-cache
type: persistent
relengapi-proxy: true