2
我想定制的Cobertura的行为代码覆盖..默认的Cobertura仪器在构建所有的类,但我想读一个特定的XML通常是这样的:蚂蚁脚本中的Groovy任务来自定义Cobertura?
<include>
....
<targetclass name = "com.example.ExMain">
<method name = "helloWorld" returnType="String">
</target>
....
</include>
我想读这样的xml是从外部源提供的,并且自定义Cobertura以便仅处理上述xml中指定的类。为此,我编写了一个groovy脚本,现在我需要将groovy脚本挂接到ant构建脚本中Cobertura ..
这是Cobertura实际处理类的蚂蚁部分。
...
<cobertura-instrument todir="${instrumented.dir}">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${classes.dir}">
<exclude name="**/*.class" />//Custom change
</fileset>
</cobertura-instrument>
...
注意,在上面的部分,我已经明确排除的Cobertura的仪器能在我的脚本挂钩..
显然文件集不允许我到包括内部具有常规任务调用我的自定义脚本来读取XML ..如果我把groovy任务外,不知何故报告不会得到生成..所以我想没有其他选择,除了调用文件集中的groovy脚本,以包括自定义在xml中提到的类..这怎么做到的?