|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <!-- |
|
3 Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
|
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
|
6 This code is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License version 2 only, as |
|
8 published by the Free Software Foundation. |
|
9 |
|
10 This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 version 2 for more details (a copy is included in the LICENSE file that |
|
14 accompanied this code). |
|
15 |
|
16 You should have received a copy of the GNU General Public License version |
|
17 2 along with this work; if not, write to the Free Software Foundation, |
|
18 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
|
20 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 or visit www.oracle.com if you need additional information or have any |
|
22 questions. |
|
23 --> |
|
24 <project name="code-coverage" default="generate-code-coverage-report" basedir=".."> |
|
25 |
|
26 <!-- CODE COVERAGE --> |
|
27 <target name="init-cc-enabled" if="${cc.enabled}"> |
|
28 |
|
29 <echo message="initialize [${jcov}] java coverage"/> |
|
30 |
|
31 |
|
32 <property name="cc.report.dir" value="${cc.dir}/CC_${jcov}_report"/> |
|
33 <property name="cc.merged.xml" value="${cc.dir}/CC_${jcov}_result-merged.xml"/> |
|
34 |
|
35 <condition property="run.test.cc.jvmargs" value="${cc.dynamic.args}"> |
|
36 <equals arg1="${jcov}" arg2="dynamic" trim="true"/> |
|
37 </condition> |
|
38 |
|
39 <mkdir dir="${cc.dir}"/> |
|
40 |
|
41 <!-- info --> |
|
42 <echo message="jcov=${jcov}"/> |
|
43 <echo message="cc.generate.template=${cc.generate.template}"/> |
|
44 <echo message="cc.instrument=${cc.instrument}"/> |
|
45 <echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/> |
|
46 <echo message="cc.report.dir=${cc.report.dir}"/> |
|
47 <echo message="cc.merged.xml=${cc.merged.xml}"/> |
|
48 </target> |
|
49 |
|
50 <target name="init-cc-disabled" unless="${cc.enabled}"> |
|
51 <property name="run.test.cc.jvmargs" value=""/> |
|
52 </target> |
|
53 |
|
54 <target name="init-cc" depends="init-cc-disabled, init-cc-enabled"> |
|
55 <property name="run.test.cc.jvmargs" value=""/> |
|
56 </target> |
|
57 |
|
58 <target name="init-cc-cleanup" if="${cc.enabled}"> |
|
59 <delete dir="${cc.dir}" failonerror="false" /> |
|
60 </target> |
|
61 |
|
62 <target name="check-merging-files" depends="init"> |
|
63 <resourcecount property="cc.xmls"> |
|
64 <filelist dir="${cc.dir}" files="*.xml" /> |
|
65 </resourcecount> |
|
66 <condition property="nothing-to-merge" value="true"> |
|
67 <equals arg1="${cc.xmls}" arg2="1" trim="true"/> |
|
68 </condition> |
|
69 </target> |
|
70 |
|
71 <target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}"> |
|
72 <echo message="making pre-merge workaround"/> |
|
73 <move todir="${cc.dir}" includeemptydirs="false"> |
|
74 <fileset dir="${cc.dir}"> |
|
75 <include name="*.xml"/> |
|
76 </fileset> |
|
77 <mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/> |
|
78 </move> |
|
79 </target> |
|
80 |
|
81 <target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}"> |
|
82 <echo message="merging files"/> |
|
83 <fileset dir="${cc.dir}" id="cc.xmls"> |
|
84 <include name="**/*${jcov}*.xml"/> |
|
85 <include name="**/CC_template.xml"/> |
|
86 </fileset> |
|
87 |
|
88 <pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/> |
|
89 |
|
90 <java classname="com.sun.tdk.jcov.Merger"> |
|
91 <arg value="-verbose"/> |
|
92 <arg value="-output"/> |
|
93 <arg value="${cc.merged.xml}"/> |
|
94 <arg value="-exclude"/> |
|
95 <arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/> |
|
96 <arg line="${cc.all.xmls}"/> |
|
97 <classpath> |
|
98 <pathelement location="${jcov.jar}"/> |
|
99 </classpath> |
|
100 </java> |
|
101 |
|
102 </target> |
|
103 |
|
104 <target name="generate-code-coverage-report" depends="merge-code-coverage"> |
|
105 <java classname="com.sun.tdk.jcov.RepGen"> |
|
106 <arg value="-verbose"/> |
|
107 <!-- <arg line ="-exclude_list CC.report.exclude"/> --> |
|
108 <arg line="-output ${cc.report.dir}"/> |
|
109 <arg value="${cc.merged.xml}"/> |
|
110 <classpath> |
|
111 <pathelement location="${jcov.jar}"/> |
|
112 </classpath> |
|
113 </java> |
|
114 </target> |
|
115 |
|
116 |
|
117 </project> |