From 62a349db4aeac932c011a52e621df2e3a7e0c98f Mon Sep 17 00:00:00 2001 From: Kien Ha <kienha9922@gmail.com> Date: Mon, 11 Jul 2016 17:23:28 -0400 Subject: [PATCH] Update scoverage to use convert xml - Update docs for options to have default values - Add plugin="scoverage" attribute - Update documentation to use 4 space indentation Change-Id: Ib12541a45f884770e8369f98b43d3b78cca7d8ec Signed-off-by: Kien Ha <kienha9922@gmail.com> --- jenkins_jobs/modules/publishers.py | 16 ++++++++++------ tests/publishers/fixtures/scoverage001.xml | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 1a583bfa2..3067327db 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -5151,9 +5151,9 @@ def scoverage(parser, xml_parent, data): Requires the Jenkins :jenkins-wiki:`Scoverage Plugin <Scoverage+Plugin>`. :arg str report-directory: This is a directory that specifies the locations - where the xml scoverage report is generated + where the xml scoverage report is generated (required) :arg str report-file: This is a file name that is given to the xml - scoverage report. + scoverage report (required) Example: @@ -5163,10 +5163,14 @@ def scoverage(parser, xml_parent, data): scoverage = XML.SubElement( xml_parent, 'org.jenkinsci.plugins.scoverage.ScoveragePublisher') - XML.SubElement(scoverage, 'reportDir').text = str( - data.get('report-directory', '')) - XML.SubElement(scoverage, 'reportFile').text = str( - data.get('report-file', '')) + scoverage.set('plugin', 'scoverage') + + mappings = [ + ('report-directory', 'reportDir', None), + ('report-file', 'reportFile', None), + ] + helpers.convert_mapping_to_xml( + scoverage, data, mappings, fail_required=True) def display_upstream_changes(parser, xml_parent, data): diff --git a/tests/publishers/fixtures/scoverage001.xml b/tests/publishers/fixtures/scoverage001.xml index 9a02f86a5..f3324669f 100644 --- a/tests/publishers/fixtures/scoverage001.xml +++ b/tests/publishers/fixtures/scoverage001.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <org.jenkinsci.plugins.scoverage.ScoveragePublisher> + <org.jenkinsci.plugins.scoverage.ScoveragePublisher plugin="scoverage"> <reportDir>target/scala-2.10/scoverage-report/</reportDir> <reportFile>scoverage.xml</reportFile> </org.jenkinsci.plugins.scoverage.ScoveragePublisher>