Define a setuptask
'closure' in your clover
{} code block to configure advanced options for your Groovy project's build processes. Here, you can define various attributes and elements of the clover-setup task.
The setuptask
closure is passed the following parameters:
ant
— an instance of a org.codehaus.gant.GantBuilderbinding
— the groovy binding for accessing project variablesplugin
— the clover grails plugin that invoked this closureThe syntax used to define your clover-setup tasks in the clover
{} code block is Gant.
Please be aware that some attributes and sub-elements of the clover-setup task do not support Groovy. Therefore, if your Grails project makes substantial use of Groovy code (as opposed to pure Java code, which is likely to be the case), not all features of the clover-setup task will be available to you. Refer to the clover-setup topic for details.
clover { // Example setuptask closure that will be invoked to configure clover. // Any Clover initialisation tasks should be defined here. // All attributes on the ant clover-setup task, which are // supported by your source code, can be defined here. setuptask = { ant, binding, plugin -> ant.'clover-setup'(initstring: "${binding.projectWorkDir}/clover/custom/clover.db") { ant.fileset(dir: "grails-app", includes: "**/*.groovy") { } } } }
clover { setuptask = { ant, binding, plugin -> ant.'clover-setup'(initstring: "${binding.projectWorkDir}/clover/db/clover.db", tmpDir: "${binding.projectWorkDir}/clover/tmp") { distributedCoverage(port: 7777, host: "localhost", timeout: 5000, numClients: 0) } } }
Use the Shared Coverage Recorder only in case when you have performance problem related with creation of thousands of coverage recording files in clover.db directory. See Coverage Recorders for more details.
clover { setuptask = { ant, binding, plugin -> ant.delete(dir: "target/clover/db") ant.delete(dir: "target/clover/tmp") ant.'clover-setup'(initstring: "target/clover/db/clover.db", tmpDir: "target/clover/tmp") { ant.profiles { ant.profile(name: "default", coverageRecorder: "SHARED") } } } reporttask = { ant, binding, plugin -> ant.delete(dir: "target/clover/report") ant.'clover-report'(initstring: "target/clover/db/clover.db") { ant.current(outfile: "target/clover/report/clover.xml") { ant.format(type: "xml") } ant.current(outfile: "target/clover/report") { ant.format(type: "html") } } } }