|
12 | 12 |
|
13 | 13 | <property environment="env" /> |
14 | 14 | <property name="java14-home" value="${env.JAVA14_HOME}" /> |
| 15 | + <property name="clover-jar" value="${env.CLOVER_JAR}" /> |
15 | 16 |
|
16 | 17 |
|
17 | 18 | <!-- By default, don't filter tests on anything --> |
18 | 19 | <property name="test-spec" value="" /> |
19 | 20 |
|
20 | | - <!-- By default, delete jar files when cleaning --> |
21 | | - <property name="delete-jars" value="yes" /> |
22 | | - |
23 | 21 | <!-- By default, clean can fail --> |
24 | 22 | <property name="clean-can-fail" value="yes" /> |
25 | 23 |
|
|
39 | 37 | <taskdef name="retroweaver" classpath="lib/buildlib/retroweaver-all-1.2.3.jar" |
40 | 38 | classname="com.rc.retroweaver.ant.RetroWeaverTask" /> |
41 | 39 |
|
| 40 | + <!-- Extension that defines the "extendclasspath" task. This should be a standard feature of Ant, but |
| 41 | + as long as it's not, we can use this extension from the Clover developers. --> |
| 42 | + <taskdef resource="com/cenqua/ant/antlib.xml" classpath="lib/buildlib/cenquatasks.jar" /> |
| 43 | + <extendclasspath path="lib/buildlib/junit.jar" /> |
42 | 44 |
|
| 45 | + |
43 | 46 | <!-- *********** |
44 | 47 | Help Target |
45 | 48 | *********** --> |
|
54 | 57 | <echo message="variables should be defined:" /> |
55 | 58 | <echo message="JAVA14_HOME: Home folder of the Java 1.4 JRE or J2SDK" /> |
56 | 59 | <echo message="PATH: 'svn' needs to refer to the Subversion client executable" /> |
| 60 | + <echo message="CLOVER_JAR: Location of the Clover jar file (necessary only if " /> |
| 61 | + <echo message=" Clover tasks will be used)"/> |
57 | 62 | <echo message="" /> |
58 | 63 | <echo message="Additionally, Ant must be run under Java 5.0 or later. If that is " /> |
59 | 64 | <echo message="not the system default, it may be set for Ant by using JAVA_HOME." /> |
|
134 | 139 | <include name="**/*.png" /> |
135 | 140 | <include name="**/*.jpg" /> |
136 | 141 | <include name="**/*.jpeg" /> |
| 142 | + <include name="**/*.properties" /> |
137 | 143 | <!-- Additional resource files should be listed here --> |
138 | 144 | </fileset> |
139 | 145 | </copy> |
|
178 | 184 | <pathconvert property="retroweaver-base-classpath" dirsep="${file.separator}" pathsep="${path.separator}"> |
179 | 185 | <path> |
180 | 186 | <pathelement location="${java14-runtime}" /> |
| 187 | + <pathelement location="${clover-jar}" /> |
181 | 188 | <pathelement location="classes/base-14" /> |
182 | 189 | <pathelement location="classes/lib-14" /> |
183 | 190 | </path> |
|
193 | 200 | <pathconvert property="retroweaver-test-classpath" dirsep="${file.separator}" pathsep="${path.separator}"> |
194 | 201 | <path> |
195 | 202 | <pathelement location="${java14-runtime}" /> |
| 203 | + <pathelement location="${clover-jar}" /> |
196 | 204 | <pathelement location="lib/buildlib/junit.jar" /> |
197 | 205 | <pathelement location="classes/base-14" /> |
198 | 206 | <pathelement location="classes/lib-14" /> |
|
222 | 230 | <junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" dir="${basedir}"> |
223 | 231 | <classpath> |
224 | 232 | <pathelement location="lib/buildlib/junit.jar" /> |
| 233 | + <pathelement location="${clover-jar}" /> |
225 | 234 | <pathelement location="classes/test" /> |
226 | 235 | <pathelement location="classes/base" /> |
227 | 236 | <pathelement location="classes/lib" /> |
|
240 | 249 | <junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" jvm="${java14-exec}" dir="${basedir}"> |
241 | 250 | <classpath> |
242 | 251 | <pathelement location="lib/buildlib/junit.jar" /> |
| 252 | + <pathelement location="${clover-jar}" /> |
243 | 253 | <pathelement location="classes/test-14" /> |
244 | 254 | <pathelement location="classes/base-14" /> |
245 | 255 | <pathelement location="classes/lib-14" /> |
|
257 | 267 | <junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" dir="${basedir}"> |
258 | 268 | <classpath> |
259 | 269 | <pathelement location="lib/buildlib/junit.jar" /> |
| 270 | + <pathelement location="${clover-jar}" /> |
260 | 271 | <pathelement location="classes/test-14" /> |
261 | 272 | <pathelement location="classes/base-14" /> |
262 | 273 | <pathelement location="classes/lib-14" /> |
|
349 | 360 | <!-- Additional external library APIs may be listed here --> |
350 | 361 | </javadoc> |
351 | 362 | </target> |
| 363 | + |
| 364 | + |
| 365 | + <target name="clover" depends="clover-15" description="Shortcut for 'clover-15'"> |
| 366 | + </target> |
| 367 | + |
| 368 | + <target name="clover-15" depends="clean, setup-clover, test-15, report-clover" |
| 369 | + description="Generate a Clover test coverage report (using 'test-15')" /> |
| 370 | + |
| 371 | + <target name="clover-14" depends="clean, setup-clover, test-14, report-clover" |
| 372 | + description="Generate a Clover test coverage report (using 'test-14')" /> |
| 373 | + |
| 374 | + <target name="clover-14-in-15" depends="clean, setup-clover, test-14-in-15, report-clover" |
| 375 | + description="Generate a Clover test coverage report (using 'test-14-in-15')" /> |
| 376 | + |
| 377 | + <target name="report-clover" depends="resolve-version-tag"> |
| 378 | + <echo message="Generating Clover report" /> |
| 379 | + <clover-report> |
| 380 | + <current outfile="docs/clover" title="${readable-project-name} Test Coverage (${version-tag})"> |
| 381 | + <format type="html" /> |
| 382 | + </current> |
| 383 | + </clover-report> |
| 384 | + <antcall target="clean-intermediate"> <!-- Remove instrumented class files --> |
| 385 | + <param name="clean-can-fail" value="no" /> |
| 386 | + </antcall> |
| 387 | + </target> |
| 388 | + |
| 389 | + <target name="setup-clover"> |
| 390 | + <extendclasspath path="${clover-jar}" /> |
| 391 | + <taskdef resource="clovertasks" classpath="${clover-jar}" /> |
| 392 | + <mkdir dir="cloverdb" /> |
| 393 | + <clover-setup initString="cloverdb/clover.db"> |
| 394 | + <files> |
| 395 | + <exclude name="**/*Test.java" /> |
| 396 | + <exclude name="**/*TestCase.java" /> |
| 397 | + <!-- Additional test sources should be listed here --> |
| 398 | + </files> |
| 399 | + </clover-setup> |
| 400 | + </target> |
352 | 401 |
|
353 | 402 |
|
354 | | - <!-- ************ |
355 | | - Clean Target |
356 | | - ************ --> |
| 403 | + <!-- ************* |
| 404 | + Clean Targets |
| 405 | + ************* --> |
357 | 406 |
|
358 | | - <target name="clean" unless="skip-clean" |
| 407 | + <target name="clean" depends="clean-intermediate, clean-products" |
359 | 408 | description="Remove all build products; the result should match the intended Subversion contents"> |
| 409 | + </target> |
360 | 410 |
|
361 | | - <echo message="Deleting all build products" /> |
| 411 | + <target name="clean-intermediate" unless="skip-clean"> |
| 412 | + <echo message="Deleting all intermediate build products" /> |
362 | 413 |
|
363 | 414 | <delete dir="classes" failonerror="${clean-can-fail}" /> |
364 | | - <delete dir="docs" failonerror="${clean-can-fail}" /> |
365 | | - |
366 | | - <condition property="do-delete-jars"> |
367 | | - <istrue value="${delete-jars}" /> |
368 | | - </condition> |
| 415 | + <delete dir="cloverdb" failonerror="${clean-can-fail}" /> |
| 416 | + |
369 | 417 | <delete includeemptydirs="true" failonerror="${clean-can-fail}"> |
370 | 418 | <fileset dir="${basedir}" defaultexcludes="no"> |
371 | | - <include name="*.jar" if="do-delete-jars" /> |
372 | | - <include name="*.zip" if="do-delete-jars" /> |
373 | | - <include name="*.tar.gz" if="do-delete-jars" /> |
374 | | - <include name="${ant.project.name}-*" /> |
375 | 419 | <include name="src/**/*.class" /> |
376 | 420 | <!-- We could get rid of backups, but "update" ignores them, so they're okay. |
377 | 421 | (doesn't work if defaultexcludes is "yes") --> |
|
384 | 428 | </delete> |
385 | 429 |
|
386 | 430 | </target> |
| 431 | + |
| 432 | + <target name="clean-products" unless="skip-clean"> |
| 433 | + <echo message="Deleting all final build products" /> |
| 434 | + |
| 435 | + <delete dir="docs" failonerror="${clean-can-fail}" /> |
| 436 | + |
| 437 | + <delete includeemptydirs="true" failonerror="${clean-can-fail}"> |
| 438 | + <fileset dir="${basedir}" defaultexcludes="no"> |
| 439 | + <include name="*.jar" /> |
| 440 | + <include name="*.zip" /> |
| 441 | + <include name="*.tar.gz" /> |
| 442 | + <include name="${ant.project.name}-*" /> |
| 443 | + </fileset> |
| 444 | + </delete> |
| 445 | + </target> |
387 | 446 |
|
388 | 447 |
|
389 | 448 | <!-- ****************** |
|
402 | 461 |
|
403 | 462 | <target name="commit" depends="update, build" |
404 | 463 | description="Commit source to the Subversion archive (after building)"> |
405 | | - <antcall target="clean"> <!-- Clean up after the latest build --> |
406 | | - <param name="delete-jars" value="no" /> |
| 464 | + <antcall target="clean-intermediate"> <!-- Clean up after the latest build --> |
407 | 465 | <param name="clean-can-fail" value="no" /> |
408 | 466 | </antcall> |
409 | 467 | <exec executable="svn" failonerror="yes"> |
|
497 | 555 | </zip> |
498 | 556 | </target> |
499 | 557 |
|
| 558 | + <!-- We don't include this in the standard release process, because we don't want to |
| 559 | + include instrumented files in the release, and because Clover must be run on a |
| 560 | + licensed machine --> |
| 561 | + <target name="clover-zip" depends="clover-14-in-15, resolve-version-tag"> |
| 562 | + <echo message="Creating ${version-tag}-clover.zip" /> |
| 563 | + <zip destfile="${version-tag}-clover.zip"> |
| 564 | + <zipfileset dir="docs/clover" prefix="${version-tag}/clover" /> |
| 565 | + </zip> |
| 566 | + </target> |
| 567 | + |
500 | 568 |
|
501 | 569 | <!-- ******************************** |
502 | 570 | Misc Occasionally-Useful Targets |
|
594 | 662 | <fail message="Can't find ${ant.project.name}.jar" unless="jar-exists" /> |
595 | 663 | </target> |
596 | 664 |
|
| 665 | + <target name="assert-clover-jar-exists"> |
| 666 | + <available property="clover-jar-exists" file="${clover-jar}" /> |
| 667 | + <fail message="${clover-jar} does not exist" unless="clover-jar-exists" /> |
| 668 | + </target> |
| 669 | + |
597 | 670 | <target name="resolve-development-value"> |
598 | 671 | <condition property="development-value" value="true"> |
599 | 672 | <istrue value="${is-development}" /> |
|
0 commit comments