+ if (cloverreport_jvmargs.length() > 0) {
+ jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
+ }
+
+ def argsList = [
+ "--alwaysreport",
+ "--initstring",
+ cloverDb,
+ "--unittests"
+ ]
+
+ args argsList.toArray()
+}
+
+
+task cloverHtmlReport(type: JavaExec) {
+ group = "Verification"
+ description = "Creates clover HTML report"
+
+ onlyIf {
+ file(cloverDb).exists()
+ }
+
+ def cloverHtmlDir = cloverReportDir
+ inputs.dir cloverClassesDir
+ outputs.dir cloverHtmlDir
+
+ classpath = sourceSets.clover.runtimeClasspath
+ main = "com.atlassian.clover.reporters.html.HtmlReporter"
+
+ if (cloverreport_mem.length() > 0) {
+ maxHeapSize = cloverreport_mem
+ }
+ if (cloverreport_jvmargs.length() > 0) {
+ jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
+ }
+
+ def argsList = [
+ "--alwaysreport",
+ "--initstring",
+ cloverDb,
+ "--outputdir",
+ cloverHtmlDir
+ ]
+
+ if (cloverreport_html_options.length() > 0) {
+ argsList += cloverreport_html_options.split(" ")
+ }
+
+ args argsList.toArray()
+}
+
+
+task cloverXmlReport(type: JavaExec) {
+ group = "Verification"
+ description = "Creates clover XML report"
+
+ onlyIf {
+ file(cloverDb).exists()
+ }
+
+ def cloverXmlFile = "${cloverReportDir}/clover.xml"
+ inputs.dir cloverClassesDir
+ outputs.file cloverXmlFile
+
+ classpath = sourceSets.clover.runtimeClasspath
+ main = "com.atlassian.clover.reporters.xml.XMLReporter"
+
+ if (cloverreport_mem.length() > 0) {
+ maxHeapSize = cloverreport_mem
+ }
+ if (cloverreport_jvmargs.length() > 0) {
+ jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
+ }
+
+ def argsList = [
+ "--alwaysreport",
+ "--initstring",
+ cloverDb,
+ "--outfile",
+ cloverXmlFile
+ ]
+
+ if (cloverreport_xml_options.length() > 0) {
+ argsList += cloverreport_xml_options.split(" ")
+ }
+
+ args argsList.toArray()
+}
+
+
+task cloverReport {
+ group = "Verification"
+ description = "Creates clover reports"
+
+ dependsOn cloverXmlReport
+ dependsOn cloverHtmlReport