make/code_coverage.xml

changeset 111
230a711062c1
child 143
606a1946e3e2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/code_coverage.xml	Fri Feb 22 11:27:40 2013 +0100
     1.3 @@ -0,0 +1,117 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!--
     1.6 + Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 + 
     1.9 + This code is free software; you can redistribute it and/or modify it
    1.10 + under the terms of the GNU General Public License version 2 only, as
    1.11 + published by the Free Software Foundation.
    1.12 + 
    1.13 + This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + version 2 for more details (a copy is included in the LICENSE file that
    1.17 + accompanied this code).
    1.18 + 
    1.19 + You should have received a copy of the GNU General Public License version
    1.20 + 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + 
    1.23 + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + or visit www.oracle.com if you need additional information or have any
    1.25 + questions.
    1.26 +-->
    1.27 +<project name="code-coverage" default="generate-code-coverage-report" basedir="..">
    1.28 +
    1.29 +  <!-- CODE COVERAGE -->
    1.30 +  <target name="init-cc-enabled" if="${cc.enabled}">
    1.31 +
    1.32 +    <echo message="initialize [${jcov}] java coverage"/>
    1.33 +
    1.34 +
    1.35 +    <property name="cc.report.dir" value="${cc.dir}/CC_${jcov}_report"/>
    1.36 +    <property name="cc.merged.xml" value="${cc.dir}/CC_${jcov}_result-merged.xml"/>
    1.37 +
    1.38 +    <condition property="run.test.cc.jvmargs" value="${cc.dynamic.args}">
    1.39 +      <equals arg1="${jcov}" arg2="dynamic" trim="true"/>
    1.40 +    </condition>
    1.41 +
    1.42 +    <mkdir dir="${cc.dir}"/>
    1.43 +
    1.44 +    <!-- info -->
    1.45 +    <echo message="jcov=${jcov}"/>
    1.46 +    <echo message="cc.generate.template=${cc.generate.template}"/>
    1.47 +    <echo message="cc.instrument=${cc.instrument}"/>
    1.48 +    <echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/>
    1.49 +    <echo message="cc.report.dir=${cc.report.dir}"/>
    1.50 +    <echo message="cc.merged.xml=${cc.merged.xml}"/>
    1.51 +  </target>
    1.52 +
    1.53 +  <target name="init-cc-disabled" unless="${cc.enabled}">
    1.54 +    <property name="run.test.cc.jvmargs" value=""/>
    1.55 +  </target>
    1.56 +
    1.57 +  <target name="init-cc" depends="init-cc-disabled, init-cc-enabled">
    1.58 +    <property name="run.test.cc.jvmargs" value=""/>
    1.59 +  </target>
    1.60 +
    1.61 +  <target name="init-cc-cleanup" if="${cc.enabled}">
    1.62 +    <delete dir="${cc.dir}" failonerror="false" />
    1.63 +  </target>
    1.64 +
    1.65 +  <target name="check-merging-files" depends="init">
    1.66 +	<resourcecount property="cc.xmls">
    1.67 +  		<filelist dir="${cc.dir}" files="*.xml" />
    1.68 +	</resourcecount>	
    1.69 +    <condition property="nothing-to-merge" value="true">
    1.70 +      <equals arg1="${cc.xmls}" arg2="1" trim="true"/>
    1.71 +    </condition>
    1.72 +  </target>
    1.73 +
    1.74 +  <target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}">
    1.75 +	<echo message="making pre-merge workaround"/>
    1.76 +	<move todir="${cc.dir}" includeemptydirs="false">
    1.77 +		<fileset dir="${cc.dir}">
    1.78 +			<include name="*.xml"/>
    1.79 +		</fileset>
    1.80 +		<mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/>
    1.81 +	</move>
    1.82 +  </target>
    1.83 + 
    1.84 +  <target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}">
    1.85 +	<echo message="merging files"/>
    1.86 +    <fileset dir="${cc.dir}" id="cc.xmls">
    1.87 +      <include name="**/*${jcov}*.xml"/>
    1.88 +      <include name="**/CC_template.xml"/>
    1.89 +    </fileset>
    1.90 +
    1.91 +    <pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/>
    1.92 +
    1.93 +    <java classname="com.sun.tdk.jcov.Merger">
    1.94 +      <arg value="-verbose"/>
    1.95 +      <arg value="-output"/>
    1.96 +      <arg value="${cc.merged.xml}"/>
    1.97 +      <arg value="-exclude"/>
    1.98 +      <arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/>
    1.99 +      <arg line="${cc.all.xmls}"/>
   1.100 +      <classpath>
   1.101 +        <pathelement location="${jcov.jar}"/>
   1.102 +      </classpath>
   1.103 +    </java>
   1.104 +
   1.105 +  </target>
   1.106 +
   1.107 +  <target name="generate-code-coverage-report" depends="merge-code-coverage">
   1.108 +    <java classname="com.sun.tdk.jcov.RepGen">
   1.109 +      <arg value="-verbose"/>
   1.110 +<!--      <arg line ="-exclude_list CC.report.exclude"/> -->
   1.111 +      <arg line="-output ${cc.report.dir}"/>
   1.112 +      <arg value="${cc.merged.xml}"/>
   1.113 +      <classpath>
   1.114 +        <pathelement location="${jcov.jar}"/>
   1.115 +      </classpath>
   1.116 +    </java>
   1.117 +  </target>
   1.118 +
   1.119 +
   1.120 +</project>

mercurial