16255
|
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 |
|
16529
|
39 |
<condition property="cc.generate.template" value="true">
|
|
40 |
<equals arg1="${cc.dynamic.genereate.template}" arg2="true" trim="true"/>
|
|
41 |
</condition>
|
|
42 |
|
16255
|
43 |
<mkdir dir="${cc.dir}"/>
|
16529
|
44 |
<mkdir dir="${build.dir}/to_be_instrumented"/>
|
16255
|
45 |
|
|
46 |
<!-- info -->
|
|
47 |
<echo message="jcov=${jcov}"/>
|
|
48 |
<echo message="cc.generate.template=${cc.generate.template}"/>
|
|
49 |
<echo message="cc.instrument=${cc.instrument}"/>
|
|
50 |
<echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/>
|
|
51 |
<echo message="cc.report.dir=${cc.report.dir}"/>
|
|
52 |
<echo message="cc.merged.xml=${cc.merged.xml}"/>
|
|
53 |
</target>
|
|
54 |
|
|
55 |
<target name="init-cc-disabled" unless="${cc.enabled}">
|
|
56 |
<property name="run.test.cc.jvmargs" value=""/>
|
|
57 |
</target>
|
|
58 |
|
16529
|
59 |
<target name="prepare-to-be-instrumented" depends="compile" description="Prepares to_be_instrumented dir">
|
|
60 |
<copy todir="${build.dir}/to_be_instrumented">
|
|
61 |
<fileset dir="${build.classes.dir}">
|
|
62 |
<include name="**/*.class"/>
|
|
63 |
<include name="**/*.clazz"/>
|
|
64 |
</fileset>
|
|
65 |
</copy>
|
|
66 |
|
|
67 |
<move todir="${build.dir}/to_be_instrumented/jdk/nashorn/internal/objects">
|
|
68 |
<fileset dir="${build.dir}/to_be_instrumented/jdk/nashorn/internal/objects">
|
|
69 |
<include name="**/*.clazz"/>
|
|
70 |
</fileset>
|
|
71 |
<mapper type="glob" from="*.clazz" to="*.class"/>
|
|
72 |
</move>
|
|
73 |
</target>
|
|
74 |
|
|
75 |
<target name="generate-cc-template" depends="prepare-to-be-instrumented" description="Generates code coverage template for dynamic CC" if="cc.generate.template">
|
|
76 |
<property name="cc.instrumented.path" location="${build.dir}/to_be_instrumented"/>
|
|
77 |
<java classname="com.sun.tdk.jcov.TmplGen">
|
|
78 |
<arg value="-verbose"/>
|
|
79 |
<arg line="-include ${cc.include}"/>
|
|
80 |
<arg line="-type all"/>
|
|
81 |
<arg line="-template ${cc.template}"/>
|
|
82 |
<arg value="${cc.instrumented.path}"/>
|
|
83 |
<classpath>
|
|
84 |
<pathelement location="${jcov.jar}"/>
|
|
85 |
</classpath>
|
|
86 |
</java>
|
|
87 |
|
|
88 |
<java classname="com.sun.tdk.jcov.RepGen">
|
|
89 |
<arg value="-verbose"/>
|
|
90 |
<arg line="-output ${cc.dir}/CC_template_report"/>
|
|
91 |
<arg value="${cc.template}"/>
|
|
92 |
<classpath>
|
|
93 |
<pathelement location="${jcov.jar}"/>
|
|
94 |
</classpath>
|
|
95 |
</java>
|
|
96 |
</target>
|
|
97 |
|
16255
|
98 |
<target name="init-cc" depends="init-cc-disabled, init-cc-enabled">
|
|
99 |
<property name="run.test.cc.jvmargs" value=""/>
|
|
100 |
</target>
|
|
101 |
|
|
102 |
<target name="init-cc-cleanup" if="${cc.enabled}">
|
|
103 |
<delete dir="${cc.dir}" failonerror="false" />
|
16529
|
104 |
<delete dir="${build.dir}/to_be_instrumented" failonerror="false" />
|
16255
|
105 |
</target>
|
|
106 |
|
|
107 |
<target name="check-merging-files" depends="init">
|
16529
|
108 |
<echo message="checking avalibility of ${cc.template}"/>
|
16255
|
109 |
<condition property="nothing-to-merge" value="true">
|
16529
|
110 |
<not>
|
|
111 |
<available file="${cc.template}"/>
|
|
112 |
</not>
|
16255
|
113 |
</condition>
|
16529
|
114 |
<echo message="nothing-to-merge = ${nothing-to-merge}"/>
|
16255
|
115 |
</target>
|
|
116 |
|
|
117 |
<target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}">
|
16529
|
118 |
<echo message="making pre-merge workaround due to missed template"/>
|
16255
|
119 |
<move todir="${cc.dir}" includeemptydirs="false">
|
|
120 |
<fileset dir="${cc.dir}">
|
|
121 |
<include name="*.xml"/>
|
|
122 |
</fileset>
|
|
123 |
<mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/>
|
|
124 |
</move>
|
|
125 |
</target>
|
|
126 |
|
|
127 |
<target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}">
|
|
128 |
<echo message="merging files"/>
|
|
129 |
<fileset dir="${cc.dir}" id="cc.xmls">
|
16529
|
130 |
<include name="**/*_${jcov}_*.xml"/>
|
16255
|
131 |
<include name="**/CC_template.xml"/>
|
|
132 |
</fileset>
|
|
133 |
|
|
134 |
<pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/>
|
16529
|
135 |
<echo message="merging files - ${cc.all.xmls}" />
|
16255
|
136 |
<java classname="com.sun.tdk.jcov.Merger">
|
|
137 |
<arg value="-verbose"/>
|
|
138 |
<arg value="-output"/>
|
|
139 |
<arg value="${cc.merged.xml}"/>
|
|
140 |
<arg value="-exclude"/>
|
|
141 |
<arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/>
|
|
142 |
<arg line="${cc.all.xmls}"/>
|
|
143 |
<classpath>
|
|
144 |
<pathelement location="${jcov.jar}"/>
|
|
145 |
</classpath>
|
|
146 |
</java>
|
|
147 |
|
|
148 |
</target>
|
|
149 |
|
|
150 |
<target name="generate-code-coverage-report" depends="merge-code-coverage">
|
|
151 |
<java classname="com.sun.tdk.jcov.RepGen">
|
|
152 |
<arg value="-verbose"/>
|
|
153 |
<!-- <arg line ="-exclude_list CC.report.exclude"/> -->
|
|
154 |
<arg line="-output ${cc.report.dir}"/>
|
|
155 |
<arg value="${cc.merged.xml}"/>
|
|
156 |
<classpath>
|
|
157 |
<pathelement location="${jcov.jar}"/>
|
|
158 |
</classpath>
|
|
159 |
</java>
|
|
160 |
</target>
|
|
161 |
|
|
162 |
|
|
163 |
</project>
|