Mon, 09 Nov 2015 13:45:10 -0800
Merge
lagergren@111 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
lagergren@111 | 2 | <!-- |
lagergren@111 | 3 | Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
lagergren@111 | 4 | DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
lagergren@111 | 5 | |
lagergren@111 | 6 | This code is free software; you can redistribute it and/or modify it |
lagergren@111 | 7 | under the terms of the GNU General Public License version 2 only, as |
lagergren@111 | 8 | published by the Free Software Foundation. |
lagergren@111 | 9 | |
lagergren@111 | 10 | This code is distributed in the hope that it will be useful, but WITHOUT |
lagergren@111 | 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
lagergren@111 | 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
lagergren@111 | 13 | version 2 for more details (a copy is included in the LICENSE file that |
lagergren@111 | 14 | accompanied this code). |
lagergren@111 | 15 | |
lagergren@111 | 16 | You should have received a copy of the GNU General Public License version |
lagergren@111 | 17 | 2 along with this work; if not, write to the Free Software Foundation, |
lagergren@111 | 18 | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
lagergren@111 | 19 | |
lagergren@111 | 20 | Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
lagergren@111 | 21 | or visit www.oracle.com if you need additional information or have any |
lagergren@111 | 22 | questions. |
lagergren@111 | 23 | --> |
lagergren@111 | 24 | <project name="code-coverage" default="generate-code-coverage-report" basedir=".."> |
lagergren@111 | 25 | |
lagergren@111 | 26 | <!-- CODE COVERAGE --> |
lagergren@111 | 27 | <target name="init-cc-enabled" if="${cc.enabled}"> |
lagergren@111 | 28 | |
lagergren@111 | 29 | <echo message="initialize [${jcov}] java coverage"/> |
lagergren@111 | 30 | |
lagergren@111 | 31 | |
lagergren@111 | 32 | <property name="cc.report.dir" value="${cc.dir}/CC_${jcov}_report"/> |
lagergren@111 | 33 | <property name="cc.merged.xml" value="${cc.dir}/CC_${jcov}_result-merged.xml"/> |
lagergren@111 | 34 | |
lagergren@111 | 35 | <condition property="run.test.cc.jvmargs" value="${cc.dynamic.args}"> |
lagergren@111 | 36 | <equals arg1="${jcov}" arg2="dynamic" trim="true"/> |
lagergren@111 | 37 | </condition> |
lagergren@111 | 38 | |
jlaskey@143 | 39 | <condition property="cc.generate.template" value="true"> |
jlaskey@143 | 40 | <equals arg1="${cc.dynamic.genereate.template}" arg2="true" trim="true"/> |
jlaskey@143 | 41 | </condition> |
jlaskey@143 | 42 | |
lagergren@111 | 43 | <mkdir dir="${cc.dir}"/> |
jlaskey@143 | 44 | <mkdir dir="${build.dir}/to_be_instrumented"/> |
lagergren@111 | 45 | |
lagergren@111 | 46 | <!-- info --> |
lagergren@111 | 47 | <echo message="jcov=${jcov}"/> |
lagergren@111 | 48 | <echo message="cc.generate.template=${cc.generate.template}"/> |
lagergren@111 | 49 | <echo message="cc.instrument=${cc.instrument}"/> |
lagergren@111 | 50 | <echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/> |
lagergren@111 | 51 | <echo message="cc.report.dir=${cc.report.dir}"/> |
lagergren@111 | 52 | <echo message="cc.merged.xml=${cc.merged.xml}"/> |
lagergren@111 | 53 | </target> |
lagergren@111 | 54 | |
lagergren@111 | 55 | <target name="init-cc-disabled" unless="${cc.enabled}"> |
lagergren@111 | 56 | <property name="run.test.cc.jvmargs" value=""/> |
lagergren@111 | 57 | </target> |
lagergren@111 | 58 | |
jlaskey@143 | 59 | <target name="prepare-to-be-instrumented" depends="compile" description="Prepares to_be_instrumented dir"> |
jlaskey@143 | 60 | <copy todir="${build.dir}/to_be_instrumented"> |
jlaskey@143 | 61 | <fileset dir="${build.classes.dir}"> |
jlaskey@143 | 62 | <include name="**/*.class"/> |
jlaskey@143 | 63 | </fileset> |
jlaskey@143 | 64 | </copy> |
jlaskey@143 | 65 | </target> |
jlaskey@143 | 66 | |
jlaskey@143 | 67 | <target name="generate-cc-template" depends="prepare-to-be-instrumented" description="Generates code coverage template for dynamic CC" if="cc.generate.template"> |
jlaskey@143 | 68 | <property name="cc.instrumented.path" location="${build.dir}/to_be_instrumented"/> |
jlaskey@143 | 69 | <java classname="com.sun.tdk.jcov.TmplGen"> |
jlaskey@143 | 70 | <arg value="-verbose"/> |
jlaskey@143 | 71 | <arg line="-include ${cc.include}"/> |
jlaskey@143 | 72 | <arg line="-type all"/> |
jlaskey@143 | 73 | <arg line="-template ${cc.template}"/> |
jlaskey@143 | 74 | <arg value="${cc.instrumented.path}"/> |
jlaskey@143 | 75 | <classpath> |
jlaskey@143 | 76 | <pathelement location="${jcov.jar}"/> |
jlaskey@143 | 77 | </classpath> |
jlaskey@143 | 78 | </java> |
jlaskey@143 | 79 | |
jlaskey@143 | 80 | <java classname="com.sun.tdk.jcov.RepGen"> |
jlaskey@143 | 81 | <arg value="-verbose"/> |
jlaskey@143 | 82 | <arg line="-output ${cc.dir}/CC_template_report"/> |
jlaskey@143 | 83 | <arg value="${cc.template}"/> |
jlaskey@143 | 84 | <classpath> |
jlaskey@143 | 85 | <pathelement location="${jcov.jar}"/> |
jlaskey@143 | 86 | </classpath> |
jlaskey@143 | 87 | </java> |
jlaskey@143 | 88 | </target> |
jlaskey@143 | 89 | |
lagergren@111 | 90 | <target name="init-cc" depends="init-cc-disabled, init-cc-enabled"> |
lagergren@111 | 91 | <property name="run.test.cc.jvmargs" value=""/> |
lagergren@111 | 92 | </target> |
lagergren@111 | 93 | |
lagergren@111 | 94 | <target name="init-cc-cleanup" if="${cc.enabled}"> |
lagergren@111 | 95 | <delete dir="${cc.dir}" failonerror="false" /> |
jlaskey@143 | 96 | <delete dir="${build.dir}/to_be_instrumented" failonerror="false" /> |
lagergren@111 | 97 | </target> |
lagergren@111 | 98 | |
lagergren@111 | 99 | <target name="check-merging-files" depends="init"> |
jlaskey@143 | 100 | <echo message="checking avalibility of ${cc.template}"/> |
lagergren@111 | 101 | <condition property="nothing-to-merge" value="true"> |
jlaskey@143 | 102 | <not> |
jlaskey@143 | 103 | <available file="${cc.template}"/> |
jlaskey@143 | 104 | </not> |
lagergren@111 | 105 | </condition> |
jlaskey@143 | 106 | <echo message="nothing-to-merge = ${nothing-to-merge}"/> |
lagergren@111 | 107 | </target> |
lagergren@111 | 108 | |
lagergren@111 | 109 | <target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}"> |
jlaskey@143 | 110 | <echo message="making pre-merge workaround due to missed template"/> |
lagergren@111 | 111 | <move todir="${cc.dir}" includeemptydirs="false"> |
lagergren@111 | 112 | <fileset dir="${cc.dir}"> |
lagergren@111 | 113 | <include name="*.xml"/> |
lagergren@111 | 114 | </fileset> |
lagergren@111 | 115 | <mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/> |
lagergren@111 | 116 | </move> |
lagergren@111 | 117 | </target> |
lagergren@111 | 118 | |
lagergren@111 | 119 | <target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}"> |
lagergren@111 | 120 | <echo message="merging files"/> |
lagergren@111 | 121 | <fileset dir="${cc.dir}" id="cc.xmls"> |
jlaskey@143 | 122 | <include name="**/*_${jcov}_*.xml"/> |
lagergren@111 | 123 | <include name="**/CC_template.xml"/> |
lagergren@111 | 124 | </fileset> |
lagergren@111 | 125 | |
lagergren@111 | 126 | <pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/> |
jlaskey@143 | 127 | <echo message="merging files - ${cc.all.xmls}" /> |
lagergren@111 | 128 | <java classname="com.sun.tdk.jcov.Merger"> |
lagergren@111 | 129 | <arg value="-verbose"/> |
lagergren@111 | 130 | <arg value="-output"/> |
lagergren@111 | 131 | <arg value="${cc.merged.xml}"/> |
lagergren@111 | 132 | <arg value="-exclude"/> |
lagergren@111 | 133 | <arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/> |
jlaskey@262 | 134 | <arg value="-exclude"/> |
sundar@468 | 135 | <arg value="jdk\.nashorn\.javaadapters*"/> |
jlaskey@262 | 136 | <arg value="-exclude"/> |
jlaskey@262 | 137 | <arg value="jdk\.nashorn\.internal\.objects\.annotations*"/> |
jlaskey@262 | 138 | <arg value="-exclude"/> |
jlaskey@262 | 139 | <arg value="jdk\.nashorn\.internal\.scripts*"/> |
jlaskey@262 | 140 | <arg value="-exclude"/> |
jlaskey@262 | 141 | <arg value="jdk\.nashorn\.internal\.lookup\.MethodHandleFactory*"/> |
jlaskey@262 | 142 | <arg value="-exclude"/> |
jlaskey@262 | 143 | <arg value="jdk\.nashorn\.internal\.test\.framework*"/> |
jlaskey@262 | 144 | <arg value="-exclude"/> |
jlaskey@262 | 145 | <arg value="jdk\.nashorn\.test\.models*"/> |
jlaskey@262 | 146 | <arg value="-exclude"/> |
jlaskey@262 | 147 | <arg value="jdk\.nashorn\.internal\.ir\.debug*"/> |
jlaskey@269 | 148 | <arg value="-exclude"/> |
jlaskey@269 | 149 | <arg value="jdk\.nashorn\.internal\.runtime\.regexp\.joni\.bench*"/> |
jlaskey@269 | 150 | <arg value="-exclude"/> |
jlaskey@269 | 151 | <arg value="jdk\.nashorn\.internal\.runtime\.DebugLogger*"/> |
jlaskey@269 | 152 | <arg value="-exclude"/> |
jlaskey@269 | 153 | <arg value="jdk\.nashorn\.internal\.runtime\.Timing*"/> |
jlaskey@269 | 154 | <arg value="-exclude"/> |
jlaskey@269 | 155 | <arg value="jdk\.nashorn\.internal\.runtime\.Logging*"/> |
jlaskey@269 | 156 | <arg value="-exclude"/> |
jlaskey@269 | 157 | <arg value="jdk\.nashorn\.internal\.runtime\.Debug*"/> |
jlaskey@269 | 158 | <arg value="-exclude"/> |
jlaskey@269 | 159 | <arg value="jdk\.nashorn\.internal\.objects\.NativeDebug*"/> |
lagergren@111 | 160 | <arg line="${cc.all.xmls}"/> |
lagergren@111 | 161 | <classpath> |
lagergren@111 | 162 | <pathelement location="${jcov.jar}"/> |
lagergren@111 | 163 | </classpath> |
lagergren@111 | 164 | </java> |
lagergren@111 | 165 | |
lagergren@111 | 166 | </target> |
lagergren@111 | 167 | |
lagergren@111 | 168 | <target name="generate-code-coverage-report" depends="merge-code-coverage"> |
lagergren@111 | 169 | <java classname="com.sun.tdk.jcov.RepGen"> |
lagergren@111 | 170 | <arg value="-verbose"/> |
lagergren@111 | 171 | <!-- <arg line ="-exclude_list CC.report.exclude"/> --> |
lagergren@111 | 172 | <arg line="-output ${cc.report.dir}"/> |
lagergren@111 | 173 | <arg value="${cc.merged.xml}"/> |
lagergren@111 | 174 | <classpath> |
lagergren@111 | 175 | <pathelement location="${jcov.jar}"/> |
lagergren@111 | 176 | </classpath> |
lagergren@111 | 177 | </java> |
lagergren@111 | 178 | </target> |
lagergren@111 | 179 | |
lagergren@111 | 180 | |
lagergren@111 | 181 | </project> |