JAL-3541 use javaExec to run clover tasks
authorJim Procter <jprocter@issues.jalview.org>
Tue, 25 Feb 2020 17:10:19 +0000 (17:10 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 25 Feb 2020 17:10:19 +0000 (17:10 +0000)
build.gradle

index 427d4a3..5597218 100644 (file)
@@ -469,25 +469,35 @@ task cloverInstr() {
 }
 
 
+task cloverReportHTML (type: JavaExec) {
+    inputs.dir "${buildDir}/clover"
+    outputs.dir "${reportsDir}/clover"
+
+    classpath configurations.cloverRuntime
+    main = "com.atlassian.clover.reporters.html.HtmlReporter"
+    args "--initstring", "${buildDir}/clover/clover.db",
+    "-o", "${reportsDir}/clover"
+}
+
+task cloverReportXML (type: JavaExec) {
+    inputs.dir "${buildDir}/clover"
+    outputs.dir "${reportsDir}/clover"
+
+    classpath configurations.cloverRuntime
+    main = "com.atlassian.clover.reporters.xml.XMLReporter"
+    args "--initstring", "${buildDir}/clover/clover.db",
+    "-o", "${reportsDir}/clover/clover.xml"
+}
 task cloverReport {
   group = "Verification"
-    description = "Createst the Clover report"
+    description = "Creates the Clover report"
     inputs.dir "${buildDir}/clover"
     outputs.dir "${reportsDir}/clover"
     onlyIf {
       file("${buildDir}/clover/clover.db").exists()
     }
-  doFirst {
-    def argsList = ["--initstring", "${buildDir}/clover/clover.db",
-    "-o", "${reportsDir}/clover"]
-    String[] args = argsList.toArray()
-    com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
-
-    // and generate ${reportsDir}/clover/clover.xml
-    args = ["--initstring", "${buildDir}/clover/clover.db",
-    "-o", "${reportsDir}/clover/clover.xml"].toArray()
-    com.atlassian.clover.reporters.xml.XMLReporter.runReport(args)
-  }
+    dependsOn cloverReportXML
+    dependsOn cloverReportHTML
 }
 
 // end clover bits