LordRaydenMK LordRaydenMK - 1 month ago 33
Android Question

Publish Android Lint results from Pipeline project

I am building an Android project with Jenkins (2.0 Beta) as a Pipeline.

From a Freestyle job I can archive the build results using a post build action Publish Android Lint Results.

My Pipeline script is:

node {
stage 'Checkout'
git branch: 'final', url: 'https://github.com/LordRaydenMK/android-testing/'

stage 'Build'
sh './gradlew clean assemble'

stage 'Android Lint'
sh './gradlew lint'

stage 'Lint Results'
//How to archive the results ?

stage 'Test'
sh './gradlew test'

stage 'JUnit tests'
step([$class: 'JUnitResultArchiver', testResults: 'app/build/test-results/*/TEST-*.xml'])
}


I am running lint and the results are saved in a file. I don't know how to publish the results so the Android Lint Plugin can pick them up.

JUnit results are archived fine.

Answer

After looking trough the source code I realized the published version (2.2) is not compatible with Pipeline.

Version 2.3 with pipeline compatibility is not released yet.

Update: Version 2.3 of the Android Lint Plugin was released. To archive the results you can use

step([$class: 'LintPublisher', pattern: 'app/build/outputs/lint-results*.xml'])