1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651
|
<!--===========================================================================
COMMON_BUILD.XML (version 20081010)
This is the build file that is used across all Pentaho projects that are
using the "new and improved" ivy builds.
This file contains the default implementation of the ant tasks to
perform a build. This file should be included by the build.xml file
for each project in the Pentaho system. That build file should
redefine any task that is defined in this file IF AND ONLY IF the
functioning of that task should be different for that specific
project.
NOTE: Any modification to this file should be viewed as a modification
the EVERY common_build.xml file (and the change should be copied
to all common_build.xml files that can be found)
FORMATTING:
ALIGNMENT: indent=2 spaces and wrap lines longer than 120 chars
NAMING: targets intended for execution by a user are named single-word
or hyphenated. Internal targets use '.' notation.
TO GET STARTED with your project, you will need this file in
your project's root directory along with three additional files:
1. build.xml
2. build.properties
3. ivy_settings.xml
4. ivy.xml
Below are some templates:
=== build.xml
<project name="MyProject" basedir="." default="jar" xmlns:ivy="antlib:org.apache.ivy.ant" >
<description>
This build file is used to create the MyProject project and works with the common_build.xml file.
</description>
<import file="common_build.xml"/>
</project>
=== build.properties
project.revision=1.0-SNAPSHOT #the version of your project. This will appear in jar META-INF, dist artifact filenames and IVY revision metadata.
ivy.artifact.id=my-project #IVY metadata describing the name of the artifact
impl.title=My Project #English language version of your project name
============================================================================-->
<project name="Pentaho Common Build" basedir="." default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
-------------------------------------------------------------------------------
Common Build file provides tasks needed to perform a project build.
It is typically not used directly but imported by each project's build.xml
file. The build.xml file can override tasks when customization is required.
MAIN TARGETS
============
* clean / clean-all :
remove all artifacts of the build, clean-all adds the removal
of any library or jar dependencies downloaded as part of the build
* resolve :
download/refresh library or jar dependencies needed for the build (uses Apache IVY)
* compile :
run javac on the project's source
* jar :
creates a jar file
* dist :
creates all project distributables
* test :
runs JUnit tests from your project's test source
SPECIAL TARGETS
============
* publish-local :
builds a jar for your project and registers it with the local artifact repository isolated
to your machine at $HOME/.ivy2/local. Further executions of the the resolve target by this
or other projects will find your published jar.
* ivy-clean* :
this family of targets helps reset your IVY environment in the event that you are having
difficulty resolving dependencies
TYPICAL TARGET SEQUENCE
============
* clean-all resolve dist :
a good start to build all project distributables from scratch. Note that jar dependencies
will not be downloaded unless you explicitly run the resolve target. We made the resolution
and retrieval completely discretionary since there are many situations in which
you will not want to get or refresh dependencies, e.g. if you are offline with no Internet
access. In such case, you could just run "dist" if the set of jars you already have are
sufficient.
</description>
<!-- Load the properties files in the proper order -->
<property file="override.properties"
description="Properties customized for your development environment belong in this file. This file will never be checked into the SCM." />
<property file="build.properties"
description="Properties customized for your particular project belong in this file." />
<!-- =================================================================================
Property Defaults
Any of these properties can be overridden in either build.properties or override.properties
=================================================================================-->
<!-- Project meta properties -->
<property name="impl.vendor"
value="Pentaho Corporation"
description="Jar file metadata describing the jar's vendor" />
<property name="impl.productID"
value=""
description="Jar file metadata indicating the product ID (this is not the revision)" />
<!-- Compile properties -->
<property name="src.dir" value="${basedir}/src" description="Project source code directory" />
<property name="bin.dir" value="${basedir}/bin" description="Base directory for all non-dist build output" />
<property name="classes.dir"
value="${bin.dir}/classes"
description="Classes compiled from project source code are placed here" />
<property name="lib.dir"
value="${basedir}/lib"
description="Directory that hosts Jar files required to compile project source. (IVY will populate this directory with required jars)" />
<property name="devlib.dir"
value="${basedir}/dev-lib"
description="Directory for developer to place development Jar files (not affected by clean targets)" />
<!-- Compiler properties (passed directly to javac ant target) -->
<property name="javac.debug"
value="true"
description="Indicates whether source should be compiled with debug information (passed to javac ant task)." />
<property name="javac.deprecation"
value="true"
description="Indicates whether source should be compiled with deprecation information" />
<property name="javac.source" value="1.5" description="Provide source compatibility with specified release" />
<property name="javac.target" value="1.5" description="Generate class files for specific VM version" />
<!-- Build Cache properties -->
<property name="build.cache.dir"
value="${user.home}/.pentaho_build_cache"
description="Base dir for runtime jars that are required exclusively by the build process" />
<property name="tmp.build.cache.dir"
value="${build.cache.dir}/tmp"
description="Temporary directory where files are prepared for build cache" />
<property name="ivy.build.cache.dir"
value="${build.cache.dir}/ivy"
description="Directory where the IVY jar is placed after it is auto downloaded by the build" />
<property name="cobertura.build.cache.dir"
value="${build.cache.dir}/cobertura"
description="Directory where the Cobertura jar (and dependencies) is placed after it is auto-downloaded by the build" />
<property name="antcontrib.build.cache.dir"
value="${build.cache.dir}/ant-contrib"
description="Directory where the Ant-Contrib jar (and dependencies) is placed after it is auto-downloaded by the build" />
<property name="pentaho.build.cache.dir"
value="${build.cache.dir}/pentaho"
description="Directory where the Pentaho ant tasks jar (and dependencies) is placed after it is auto-downloaded by the build" />
<property name="svnant.build.cache.dir"
value="${build.cache.dir}/svnant"
description="Directory where the SVN ANT install is placed after it is auto downloaded by the build" />
<!-- SVN Ant Properties -->
<property name="svnant.url"
value="http://subclipse.tigris.org/files/documents/906/43359/svnant-1.2.0-RC1.zip"
description="The URL to the current release of SVN Ant" />
<property name="svnant.use-javahl"
value="false"
description="Prefer JNI JavaHL binding over the command line client for native svn support" />
<property name="svnant.use-svnkit"
value="true"
description="Prefer SVNKit binding over the command line client for native svn support (defaults to true)" />
<!-- Test properties -->
<property name="testsrc.dir" value="${basedir}/test-src" description="Directory that hosts the test source files" />
<property name="testlib.dir"
value="${basedir}/test-lib"
description="Directory for jar files needed during unit testing" />
<property name="testbin.dir" value="${bin.dir}/test" description="Base directory for all compiler generated test output" />
<property name="testclasses.dir"
value="${testbin.dir}/classes"
description="Classes compiled from project test code are placed here" />
<property name="testreports.dir"
value="${bin.dir}/reports/test"
description="Base directory that holds all unit test report files" />
<property name="testreports.xml.dir"
value="${testreports.dir}/xml"
description="Unit test xml reports are placed here" />
<property name="testreports.html.dir"
value="${testreports.dir}/html"
description="Unit test html reports are placed here" />
<property name="junit.haltonfailure" value="no" description="Fail the build if a test fails" />
<property name="headless.unittest" value="true" description="Runs the unit tests in headless mode" />
<!-- Code Coverage properties -->
<property name="instrumented.classes.dir"
value="${testbin.dir}/instrumented-classes"
description="Directory where instrumented project classes are placed for use by code coverage utility" />
<property name="cobertura.data.dir"
value="${testbin.dir}/cobertura-bin"
description="Temporary data directory used by Cobertura" />
<property name="coberturareports.dir"
value="${bin.dir}/reports/cobertura"
description="Base directory for all generated Cobertura code coverage reports" />
<property name="coberturareports.xml.dir"
value="${coberturareports.dir}/xml"
description="Cobertura xml reports are placed here" />
<property name="coberturareports.html.dir"
value="${coberturareports.dir}/html"
description="Cobertura html reports are placed here" />
<!-- Javadoc properties -->
<property name="javadoc.dir"
value="${bin.dir}/javadoc"
description="Directory where generated javadoc will be placed" />
<property name="javadoc.packagenames"
value="org.pentaho.*"
description="This property is passed to the packagenames property of the javadoc ant task. You should customize this for your project." />
<!-- Distribution and Assembly properties -->
<property name="dist.dir"
value="${basedir}/dist"
description="Base directory for all project artifacts (jar, zip, tar.gz, etc...)" />
<property name="license.dir"
value="${basedir}"
description="Base directory where this project's license files reside" />
<property name="res.dir"
value="${basedir}/res"
description="Directory that holds resources not included in the source tree" />
<!-- Ivy properties -->
<property name="ivy.install.version" value="2.0.0-beta2" description="Specifies the version of IVY to fetch" />
<property name="ivy.jar.file"
value="${ivy.build.cache.dir}/ivybeta1.jar"
description="The full path to the IVY jar file to use during the build. If the file is not present, the build will attempt to fetch IVY and save the jar as specified by this property" />
<property name="ivy.settingsurl"
value="file:${basedir}/ivysettings.xml"
description="URL to the (common) ivysettings.xml. This file is required by the build to configure IVY. Note you must escape the ':' if this property exists in a .properties file" />
<property name="ivy.artifact.group"
value="pentaho"
description="IVY metadata describing the originating company or organization" />
<property name="ivy.artifact.pomfile"
value="${dist.dir}/pom.xml"
description="The path to the Maven pom file to deploy with the artifact" />
<property name="ivy.artifact.ivyfilename"
value="ivy.xml"
description="The name of the IVY xml file to deploy with the artifact" />
<property name="ivy.artifact.ivypathname"
value="${dist.dir}/ivy.xml"
description="The full path to the IVY xml file to deploy with the artifact" />
<!-- Load the manifest file (if any) as a properties file -->
<property name="dist.manifest.file" value="${dist.dir}/MANIFEST.MF" description="The manifest file that will be generated as part of the build" />
<property name="manifest.file" value="${res.dir}/META-INF/MANIFEST.MF" description="The location of the MANIFEST.MF file for this application." />
<property file="${manifest.file}" description="Loads the manifest information from the manifest file as a properties file." />
<!-- Set the project revision number to the value in the manifest file (if it has not
been specified in the properties file -->
<property name="project.revision" value="${Implementation-Version}" description="Sets the version number of the project based on the Implementation-Version found in the manifest file (if one is supplied and nothing is specified in the build.properties)" />
<fail message="A project revision number has not been determined!">
<condition>
<matches string="${project.revision}" pattern="\$\{.*\}" />
</condition>
</fail>
<!-- Set the project title to the value in the manifest file (if it has not
been specified in the properties file -->
<property name="impl.title" value="${Implementation-Title}" description="Sets the title of the project based on the Implementation-Title found in the manifest file (if one is supplied and nothing is specified in the build.properties)" />
<fail message="A project title has not been determined!">
<condition>
<matches string="${impl.title}" pattern="\$\{.*\}" />
</condition>
</fail>
<!-- Build Mode properties -->
<property name="release" value="false" description="Set this to true if you want to generate a release artifact" />
<!-- Set the os property -->
<condition property="isLinux">
<os family="unix" />
</condition>
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isMac">
<os family="mac" />
</condition>
<condition property="os.classifier" value="win">
<os family="windows" />
</condition>
<condition property="os.classifier" value="mac">
<os family="mac" />
</condition>
<condition property="os.classifier" value="linux">
<os family="unix" />
</condition>
<property name="os.classifier" value="unsupported" />
<!-- Setup the compile classpath -->
<path id="classpath">
<fileset dir="${devlib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- Setup the classpath used for testing -->
<path id="test.classpath">
<fileset dir="${devlib.dir}">
<include name="*" />
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${testlib.dir}">
<include name="*.jar" />
</fileset>
<dirset dir="${classes.dir}" />
<dirset dir="${testclasses.dir}" />
</path>
<!--=======================================================================
install-antcontrib
(Fetches and) installs ant-contrib tasks.
====================================================================-->
<target name="install-antcontrib"
depends="antcontrib.download-check">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${antcontrib.build.cache.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>
</target>
<!--=======================================================================
antcontrib.download-check
Fetches ant-contrib from sourceforge if it is not already present
====================================================================-->
<target name="antcontrib.download-check">
<condition property="antcontrib.available">
<and>
<available file="${antcontrib.build.cache.dir}" />
<available classname="net.sf.antcontrib.logic.IfTask">
<classpath>
<fileset dir="${antcontrib.build.cache.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</available>
</and>
</condition>
<antcall target="antcontrib.download" />
</target>
<!--=======================================================================
antcontrib.download
Fetches ant-contrib from sourceforge
====================================================================-->
<target name="antcontrib.download" unless="antcontrib.available">
<mkdir dir="${tmp.build.cache.dir}" />
<get src="http://downloads.sourceforge.net/ant-contrib/ant-contrib-1.0b3-bin.zip"
dest="${tmp.build.cache.dir}/antcontrib.zip"
usetimestamp="true" />
<unzip src="${tmp.build.cache.dir}/antcontrib.zip" dest="${tmp.build.cache.dir}">
<patternset>
<include name="**/*.jar" />
</patternset>
</unzip>
<copy todir="${antcontrib.build.cache.dir}">
<fileset dir="${tmp.build.cache.dir}/ant-contrib">
<include name="**/*.jar" />
</fileset>
</copy>
</target>
<!--=======================================================================
init
Ensures that all the required directories exist before processing
a build.
====================================================================-->
<target name="init">
<mkdir dir="${classes.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${devlib.dir}" />
<mkdir dir="${testlib.dir}" />
</target>
<!--=======================================================================
svnant.download-check
Fetch SVN ANT zip if it is not already present
====================================================================-->
<target name="svnant.download-check">
<condition property="svnant.available">
<and>
<available file="${svnant.build.cache.dir}" />
<available classname="org.tigris.subversion.svnant.SvnTask">
<classpath>
<fileset dir="${svnant.build.cache.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</available>
</and>
</condition>
<antcall target="svnant.download" />
</target>
<!--=======================================================================
svnant.download
Downloads the IVY jar file for use by ant.
====================================================================-->
<target name="svnant.download" unless="svnant.available">
<mkdir dir="${svnant.build.cache.dir}" />
<get src="${svnant.url}" dest="${svnant.build.cache.dir}/svnant.zip" usetimestamp="true" />
<unzip src="${svnant.build.cache.dir}/svnant.zip" dest="${svnant.build.cache.dir}">
<patternset>
<include name="**/*.jar" />
</patternset>
</unzip>
</target>
<!--=======================================================================
install-svnant
(Fetches and) installs the SVN ANT for use by this ant script
====================================================================-->
<target name="install-svnant"
depends="install-antcontrib, svnant.download-check">
<if>
<istrue value="${svnant.isinstalled}" />
<then>
<echo message="Skipping SVN ANT install. IVY has already been configured by the build" />
</then>
<else>
<echo message="Installing SVN ANT..." />
<path id="svnant.lib.path">
<fileset dir="${svnant.build.cache.dir}" includes="**/*.jar" />
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.lib.path" />
<property name="svnant.isinstalled" value="true" />
</else>
</if>
</target>
<!--=======================================================================
test-svnant
Tests SVN by printing out the repository
====================================================================-->
<target name="test-svnant" depends="install-svnant">
<svn javahl="${svnant.use-javahl}" svnkit="${svnant.use-svnkit}">
<wcVersion path="." />
</svn>
<echo message="Subversion repository url: ${repository.url}" />
</target>
<!--=======================================================================
svn-revision
Prints and sets the SVN revision for the repository at the current dir (if svn.revision is not set)
====================================================================-->
<target name="svn-revision"
depends="install-svnant">
<svn javahl="${svnant.use-javahl}" svnkit="${svnant.use-svnkit}">
<status path="." revisionProperty="svn.revision" />
</svn>
<echo message="Subversion repository revision: ${svn.revision}" />
</target>
<!--=======================================================================
set-build.id
Sets a property build.id to the either "development" or the svn revision
if in release mode
====================================================================-->
<target name="set-build.id" unless="build.id" depends="install-antcontrib">
<if>
<istrue value="${release}" />
<then>
<antcallback target="svn-revision" return="svn.revision" />
<property name="build.id" value="${svn.revision}" />
</then>
<else>
<property name="build.id" value="development" />
</else>
</if>
</target>
<!--=================================================================================
version-properties: common Ant driven version file generation. Projects that produce
a package or packages should run this target. Projects that produce
jars only should NOT.
===================================================================================-->
<target name="version-properties" depends="set-build.id">
<tstamp>
<format property="build.time" pattern="yyyy/MM/dd hh:mm aa"/>
</tstamp>
<propertyfile
file="version.properties" comment="Release Build version info">
<entry key="release.major.number" value="${release.major.number}" />
<entry key="release.minor.number" value="${release.minor.number}" />
<entry key="release.milestone.number" value="${release.milestone.number}" />
<entry key="release.candidate.token" value="${release.candidate.token}" />
<entry key="impl.vendor" value="${impl.vendor}" />
<entry key="impl.version" value="${release.major.number}.${release.minor.number}.${release.milestone.number}.${build.id}" />
<entry key="impl.title" value="${impl.title}" />
<entry key="buildDate" value="${build.time}"/>
<entry key="svn.revision" value="${build.id}"/>
<entry key="release.build.number" default="0" type="int" operation="+" value="1" pattern="0000"/>
</propertyfile>
<property file="${basedir}/version.properties"/>
</target>
<!--=======================================================================
install-ivy
(Fetches and) installs the IVY jar for use by this ant script
====================================================================-->
<target name="install-ivy"
depends="install-antcontrib,ivy.download-check">
<if>
<istrue value="${ivy.isinstalled}" />
<then>
<echo message="Skipping IVY install. IVY has already been configured by the build" />
</then>
<else>
<echo message="Installing IVY..." />
<path id="ivy.lib.path">
<fileset dir="${ivy.build.cache.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
<ivy:settings url="${ivy.settingsurl}" />
<property name="ivy.isinstalled" value="true" />
</else>
</if>
</target>
<!--=======================================================================
ivy.download-check
Fetch IVY jar from sourceforge if it is not already present
====================================================================-->
<target name="ivy.download-check">
<condition property="ivy.available">
<and>
<available file="${ivy.build.cache.dir}" />
<available classname="org.apache.ivy.ant.IvyTask">
<classpath>
<fileset dir="${ivy.build.cache.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</available>
</and>
</condition>
<antcall target="ivy.download" />
</target>
<!--=======================================================================
ivy.download
Downloads the IVY jar file for use by ant.
====================================================================-->
<target name="ivy.download" unless="ivy.available">
<mkdir dir="${ivy.build.cache.dir}" />
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}"
usetimestamp="true" />
</target>
<!--=======================================================================
ivy.check-releasable
Verifies that there are no SNAPSHOT dependencies defined in the ivy xml.
If there are SNAPSHOTS, fail the release build.
====================================================================-->
<target name="ivy.check-releasable" depends="install-ivy, install-antcontrib">
<if>
<istrue value="${release}" />
<then>
<sequential>
<ivy:artifactproperty conf="*" name="dep.[module]/[artifact]-[revision]" value="[revision]" />
<propertyselector property="violators" match="dep\..*SNAPSHOT.*" select="\0" casesensitive="false" />
<fail if="violators"
message="Release not possible, you have dependencies on non-released artifacts: ${violators}" />
</sequential>
</then>
</if>
</target>
<!--=======================================================================
resolve
Using ivy and the dependencies for the project (defined in the ivy.xml
file), this task will retrieve the needed files and place them into
the defined directories.
====================================================================-->
<target name="resolve"
depends="resolve-default, resolve-test, ivy.check-releasable"
description="Retrieves all the dependent libraries" />
<target name="resolve-init" unless="resolve-init.skip" depends="install-ivy">
<!-- If this is the 1st time through resolve-init, then we need to clean up the jars
-->
<antcall target="clean-jars" />
<property name="resolve-init.skip" value="" />
</target>
<target name="resolve-default" depends="resolve-init">
<ivy:resolve file="ivy.xml" conf="default" />
<ivy:retrieve conf="default" pattern="${lib.dir}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="resolve-test" depends="resolve-init">
<ivy:resolve file="ivy.xml" conf="test" />
<ivy:retrieve conf="test" pattern="${testlib.dir}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="resolve-codegen" depends="resolve-init">
<ivy:resolve file="ivy.xml" conf="codegen" />
<ivy:retrieve conf="codegen" pattern="${lib.dir}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="resolve-runtime" depends="resolve-init">
<ivy:resolve file="ivy.xml" conf="runtime" />
<ivy:retrieve conf="runtime" pattern="${lib.dir}/[module]-[revision](-[classifier]).[ext]" />
</target>
<!--=======================================================================
ivy-clean-cache
Cleans the IVY cache. You are erasing IVY's memory. Run this if you
want to force IVY to go fetch all your project dependencies from scratch.
WARNING: this will affect all IVY projects, not just the current workspace
====================================================================-->
<target name="ivy-clean-cache" depends="install-ivy">
<ivy:cleancache />
</target>
<!--=======================================================================
ivy-clean-local
Completely cleans your local repository of any files published locally
by way of publish-local.
WARNING: this is a global action and will affect other IVY projects
currently referencing a locally published dependency
====================================================================-->
<target name="ivy-clean-local" depends="install-ivy">
<delete dir="${ivy.local.default.root}/" />
</target>
<!--=======================================================================
ivy-clean-pentaho
Completely cleans your IVY cache and local repository of pentaho-specific files.
WARNING: this is a global action and will affect other IVY projects
currently referencing a locally published dependency
====================================================================-->
<target name="ivy-clean-pentaho"
depends="install-ivy">
<mkdir dir="${ivy.local.default.root}" /> <!-- just in case it doesn't exist -->
<for param="dir">
<path>
<dirset dir="${ivy.local.default.root}" includes="*pentaho*" />
<dirset dir="${ivy.default.ivy.user.dir}/cache" includes="*pentaho*" />
</path>
<sequential>
<delete dir="@{dir}" includeemptydirs="true" />
</sequential>
</for>
<for param="file">
<path>
<fileset dir="${ivy.local.default.root}" includes="*pentaho*" />
<fileset dir="${ivy.default.ivy.user.dir}/cache" includes="*pentaho*" />
</path>
<sequential>
<delete file="@{file}" />
</sequential>
</for>
</target>
<!--=======================================================================
report
Allows ivy to report on the dependencies for this project
====================================================================-->
<target name="report" depends="install-ivy">
<ivy:resolve file="ivy.xml" />
<ivy:report conf="default" />
</target>
<!--=======================================================================
publish-local-nojar
Publishes the jar file for this project to the user's local repository
for download by other projects currently being executed on the user's
system.
====================================================================-->
<target name="publish-local-nojar" depends="install-ivy">
<ivy:resolve file="${ivy.artifact.ivyfilename}" />
<ivy:publish resolver="local" pubrevision="${project.revision}" overwrite="true" forcedeliver="true">
<artifacts pattern="${dist.dir}/[artifact]-[revision](-[classifier]).[ext]" />
</ivy:publish>
</target>
<!--=======================================================================
publish-local
Builds and publishes the jar file for this project to the user's
local repository for download by other projects currently being
executed on the user's system.
====================================================================-->
<target name="publish-local"
depends="dist, dist-source, publish-local-nojar"
description="Builds and publishes the jar file to the local repository" />
<!--=======================================================================
publish-pentaho
Creates and publishes the jar file for this project to a Maven2
repository.
====================================================================-->
<target name="publish-pentaho"
depends="dist, dist-source, publish-pentaho-nojar">
</target>
<!--=======================================================================
publish-pentaho-nojar
Publishes the jar file for this project to a Maven2 repository.
====================================================================-->
<target name="publish-pentaho-nojar"
depends="install-antcontrib,create-pom,ivy.deliver">
<antcall target="maven-publish-dependencies">
<param name="publish.groupId" value="${ivy.artifact.group}" />
<param name="publish.artifactId" value="${ivy.artifact.id}" />
<param name="publish.version" value="${project.revision}" />
<param name="publish.file" value="${ivy.artifact.ivypathname}" />
</antcall>
<antcall target="maven-publish-sources">
<param name="publish.groupId" value="${ivy.artifact.group}" />
<param name="publish.artifactId" value="${ivy.artifact.id}" />
<param name="publish.version" value="${project.revision}" />
<param name="publish.file" value="${dist.dir}/${ivy.artifact.id}-${project.revision}-sources.jar" />
</antcall>
<antcall target="maven-publish-artifact">
<param name="publish.pomFile" value="${ivy.artifact.pomfile}" />
<param name="publish.file" value="${dist.dir}/${ivy.artifact.id}-${project.revision}.jar" />
</antcall>
</target>
<!--=======================================================================
ivy.deliver
Creates a publishable version of the ivy dependencies file, ivy.xml
====================================================================-->
<target name="ivy.deliver">
<ivy:deliver conf="*(public)" deliverpattern="${dist.dir}/ivy.xml" />
</target>
<!--=======================================================================
maven-publish-dependencies
A function that deploys an ivy.xml file to a maven repository
====================================================================-->
<target name="maven-publish-dependencies">
<sequential>
<fail message="No file found at: ${publish.file}">
<condition>
<not>
<available file="${publish.file}" />
</not>
</condition>
</fail>
<echo message="Publishing ${publish.file} to ${ivy.repository.publish}..." />
<if>
<isset property="isWindows" />
<then>
<exec executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="mvn.bat" />
<arg value="deploy:deploy-file" />
<arg value="-DrepositoryId=${ivy.repository.id}" />
<arg value="-Durl=${ivy.repository.publish}" />
<arg value="-DgroupId=${publish.groupId}" />
<arg value="-DartifactId=${publish.artifactId}" />
<arg value="-Dversion=${publish.version}" />
<arg value="-Dpackaging=ivy.xml" />
<arg value="-Dfile=${publish.file}" />
</exec>
</then>
<else>
<exec executable="mvn" failonerror="true">
<arg value="deploy:deploy-file" />
<arg value="-DrepositoryId=${ivy.repository.id}" />
<arg value="-Durl=${ivy.repository.publish}" />
<arg value="-DgroupId=${publish.groupId}" />
<arg value="-DartifactId=${publish.artifactId}" />
<arg value="-Dversion=${publish.version}" />
<arg value="-Dpackaging=ivy.xml" />
<arg value="-Dfile=${publish.file}" />
</exec>
</else>
</if>
</sequential>
</target>
<!--=======================================================================
maven-publish-artifact
A function that deploys an artifact to a maven repository
====================================================================-->
<target name="maven-publish-artifact">
<sequential>
<fail message="No file found at: ${publish.file}">
<condition>
<not>
<available file="${publish.file}" />
</not>
</condition>
</fail>
<echo message="Publishing ${publish.file} to ${ivy.repository.publish}..." />
<if>
<isset property="isWindows" />
<then>
<exec executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="mvn.bat" />
<arg value="deploy:deploy-file" />
<arg value="-DrepositoryId=${ivy.repository.id}" />
<arg value="-Durl=${ivy.repository.publish}" />
<arg value="-DpomFile=${publish.pomFile}" />
<arg value="-Dfile=${publish.file}" />
</exec>
</then>
<else>
<exec executable="mvn" failonerror="true">
<arg value="deploy:deploy-file" />
<arg value="-DrepositoryId=${ivy.repository.id}" />
<arg value="-Durl=${ivy.repository.publish}" />
<arg value="-DpomFile=${publish.pomFile}" />
<arg value="-Dfile=${publish.file}" />
</exec>
</else>
</if>
</sequential>
</target>
<!--=======================================================================
maven-publish-sources
A function that deploys a java-sources artifact to a maven repository
====================================================================-->
<target name="maven-publish-sources">
<sequential>
<fail message="No file found at: ${publish.file}">
<condition>
<not>
<available file="${publish.file}" />
</not>
</condition>
</fail>
<echo message="Publishing ${publish.file} to ${ivy.repository.publish}..." />
<if>
<isset property="isWindows" />
<then>
<exec executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="mvn.bat" />
<arg value="deploy:deploy-file" />
<arg value="-DrepositoryId=${ivy.repository.id}" />
<arg value="-Durl=${ivy.repository.publish}" />
<arg value="-DgroupId=${publish.groupId}" />
<arg value="-DartifactId=${publish.artifactId}" />
<arg value="-Dversion=${publish.version}" />
<arg value="-DgeneratePom=false" />
<arg value="-Dpackaging=java-source" />
<arg value="-Dfile=${publish.file}" />
</exec>
</then>
<else>
<exec executable="mvn" failonerror="true">
<arg value="deploy:deploy-file" />
<arg value="-DrepositoryId=${ivy.repository.id}" />
<arg value="-Durl=${ivy.repository.publish}" />
<arg value="-DgroupId=${publish.groupId}" />
<arg value="-DartifactId=${publish.artifactId}" />
<arg value="-Dversion=${publish.version}" />
<arg value="-DgeneratePom=true" />
<arg value="-Dpackaging=java-source" />
<arg value="-Dfile=${publish.file}" />
</exec>
</else>
</if>
</sequential>
</target>
<!--=======================================================================
create-pom
Creates the POM file for publishing the jar file to a Maven2 repository.
====================================================================-->
<target name="create-pom" depends="install-ivy">
<ivy:makepom ivyfile="./ivy.xml" pomfile="${dist.dir}/pom.xml">
<mapping conf="default" scope="compile" />
<mapping conf="runtime" scope="runtime" />
</ivy:makepom>
</target>
<!--=======================================================================
clean-jars
Removes all the libraries that have been downloaded for this project
using the ivy dependencies.
====================================================================-->
<target name="clean-jars">
<delete dir="${lib.dir}" />
<delete dir="${testlib.dir}" />
</target>
<!--=======================================================================
clean
Removes all the files generated from the build process.
====================================================================-->
<target name="clean"
description="Cleans all the files generated from a build with the exception of IVY-downloaded jars (see clean-all)"
depends="clean-tests, clean-cobertura, clean-javadoc, clean-dist">
<delete dir="${classes.dir}" />
<delete dir="${bin.dir}" />
</target>
<!--=======================================================================
clean-dist
Removes all dist artifacts
====================================================================-->
<target name="clean-dist">
<delete dir="${dist.dir}" />
</target>
<!--=======================================================================
clean-all
Removes all the libraries that have been downloaded for this project
in the workspace's lib dirs as well as all the files
generated from the build process.
====================================================================-->
<target name="clean-all" depends="clean,clean-jars" description="Cleans all the generated and dependency files" />
<!--=======================================================================
copy-license-lgpl
Copies the LGPL license file into the binary directory.
====================================================================-->
<target name="copy-license-lgpl"
if="lgpl-license-avail">
<copy todir="${classes.dir}/META-INF">
<fileset dir="${license.dir}" includes="lgpl-2.1.txt" />
</copy>
</target>
<!--=======================================================================
copy-license-gpl-parent
Copies the GPL license file from the parent directory into the
binary directory.
====================================================================-->
<target name="copy-license-gpl"
if="gpl-license-avail">
<copy todir="${classes.dir}/META-INF">
<fileset dir="${license.dir}" includes="gpl-2.0.txt" />
</copy>
</target>
<!--=======================================================================
compile
Compiles the source code (using the specified options) into the
binary directory.
NOTE: This contains multiple sub-tasks which will occur in the
following order (this is provided for easier overriding by
the build.xml which will include this file)...
- compile.pre : anything needed to prep for compile
- compile.compile : the actual compilation step
- compile.src_copy : copying the source into the bin directory
- compile.res_copy : copying the resources into the bin directory
- compile.lic_copy : copying the license information into the bin directory
- compile.post : anything needed after the compile is done
====================================================================-->
<target name="compile"
depends="init, compile.pre, compile.compile, compile.src_copy, compile.res_copy, compile.lic_copy, compile.post"
description="Performs all the steps to prepare the bin directory with a complete compilation" />
<!--=======================================================================
compile.pre
Prepares to perform the compile.
====================================================================-->
<target name="compile.pre"/>
<!--=======================================================================
compile.compile
Performs the actual compile
====================================================================-->
<target name="compile.compile" depends="init">
<javac destdir="${classes.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
fork="true"
source="${javac.source}"
target="${javac.target}">
<classpath>
<path refid="classpath" />
</classpath>
<src path="${src.dir}" />
</javac>
</target>
<!--=======================================================================
compile.res_copy
Copies any needed resources into the classes directory. Will not
duplicate copying of resources from src tree (handled by compile.src_copy
if jar.include.source is set.
====================================================================-->
<target name="compile.res_copy" depends="install-antcontrib">
<if>
<available file="${res.dir}" />
<then>
<copy todir="${classes.dir}">
<fileset dir="${res.dir}" />
</copy>
</then>
</if>
<if>
<not>
<isset property="jar.include.source" />
</not>
<then>
<copy todir="${classes.dir}" flatten="false">
<fileset dir="${src.dir}" excludes="**/*.java" />
</copy>
</then>
</if>
</target>
<!--=======================================================================
compile.src_copy
Copies the source files to the bin directory
NOTE: if the dont.copy.source variable exists, this step will be
skipped!
====================================================================-->
<target name="compile.src_copy"
depends="init"
if="jar.include.source">
<copy todir="${classes.dir}" flatten="false">
<fileset dir="${src.dir}" />
</copy>
</target>
<!--=======================================================================
compile.lic_copy
Copies the license file(s) into the bin directory
====================================================================-->
<target name="compile.lic_copy" depends="init">
<condition property="lgpl-license-avail">
<available file="${license.dir}/lgpl-2.1.txt" />
</condition>
<antcall target="copy-license-lgpl" />
<condition property="gpl-license-avail">
<available file="${license.dir}/gpl-2.0.txt" />
</condition>
<antcall target="copy-license-gpl" />
</target>
<!--=======================================================================
compile.post
Performs any needed post-compile tasks
====================================================================-->
<target name="compile.post"/>
<!--=======================================================================
jar
Creates a jar file from the bin directory
====================================================================-->
<target name="jar" depends="compile,set-build.id,generate.manifest" description="Jars up the bin directory after a compile">
<jar destfile="${dist.dir}/${ivy.artifact.id}-${project.revision}.jar" manifest="${dist.manifest.file}">
<fileset dir="${classes.dir}" />
</jar>
</target>
<!--=======================================================================
generate.manifest
Creates a new manifest file if one is not specified, or updates
an existing manifest file if one is specified.
====================================================================-->
<target name="generate.manifest" depends="init,set-build.id">
<delete file="${dist.manifest.file}" />
<touch file="${dist.manifest.file}" />
<copy file="${manifest.file}" tofile="${dist.manifest.file}" overwrite="true" failonerror="false" />
<manifest file="${dist.manifest.file}" mode="update">
<attribute name="Implementation-Title" value="${impl.title}" />
<attribute name="Implementation-Version" value="${project.revision}.${build.id}" />
<attribute name="Implementation-Vendor" value="${impl.vendor}" />
<attribute name="Implementation-ProductID" value="${impl.productID}" />
</manifest>
</target>
<!--=======================================================================
dist-source
Generates zip and targz distributions of the javadoc
====================================================================-->
<target name="dist-source"
depends="source.jar, source.targz" />
<!--=======================================================================
source.jar
Creates a jar of the project source for distribution
====================================================================-->
<target name="source.jar" depends="init">
<jar jarfile="${dist.dir}/${ivy.artifact.id}-${project.revision}-sources.jar" basedir="${src.dir}" />
</target>
<!--=======================================================================
source.targz
Creates a gzipped tar of the project source for distribution
====================================================================-->
<target name="source.targz" depends="init">
<tar compression="gzip"
destfile="${dist.dir}/${ivy.artifact.id}-${project.revision}-sources.tar.gz"
basedir="${src.dir}" />
</target>
<!--=======================================================================
clean-tests
Removes all files related to tests
====================================================================-->
<target name="clean-tests">
<delete dir="${testbin.dir}" />
</target>
<!--=======================================================================
init-tests
Compiles project test source
====================================================================-->
<target name="init-tests" depends="clean-tests">
<mkdir dir="${testclasses.dir}" />
<mkdir dir="${testsrc.dir}" />
</target>
<!--=======================================================================
compile-tests
Compiles project test source
====================================================================-->
<target name="compile-tests" depends="init-tests">
<javac destdir="${testclasses.dir}"
debug="true"
optimize="false"
source="${javac.source}"
target="${javac.target}"
fork="true">
<src path="${testsrc.dir}" />
<classpath refid="test.classpath" />
</javac>
<!-- Copy the non-java files from the source directory to the test classes directory
-->
<copy todir="${testclasses.dir}">
<fileset dir="${testsrc.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!--=======================================================================
test
Compiles and runs all the tests for the project
====================================================================-->
<target name="test" depends="compile,compile-tests, init-test-reports" description="Compiles and runs unit tests">
<junit fork="yes" failureProperty="test.failed" haltonfailure="${junit.haltonfailure}" printsummary="yes">
<sysproperty key="java.awt.headless" value="${headless.unittest}"/>
<classpath refid="test.classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${testreports.xml.dir}">
<fileset dir="${testsrc.dir}" casesensitive="yes">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${testreports.html.dir}">
<fileset dir="${testreports.xml.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${testreports.html.dir}" />
</junitreport>
</target>
<!--=======================================================================
clean-test-reports
Remove all xml and html JUnit test reports
====================================================================-->
<target name="clean-test-reports">
<delete dir="${testreports.xml.dir}" />
<delete dir="${testreports.html.dir}" />
</target>
<!--=======================================================================
init-test-reports
Prepare directories for JUnit test reports
====================================================================-->
<target name="init-test-reports" depends="clean-test-reports">
<mkdir dir="${testreports.xml.dir}" />
<mkdir dir="${testreports.html.dir}" />
</target>
<!--=======================================================================
dist
Creates a distribution of this project
====================================================================-->
<target name="dist" depends="jar" description="Creates a distribution" />
<!--=======================================================================
continuous
Runs a typical continuous integration build including project dist, javadoc, test,
and coverage artifacts
====================================================================-->
<target name="continuous"
depends="clean-all,resolve,cobertura,dist-javadoc,dist-source,dist"/>
<!--=======================================================================
continuous-testless
Runs a typical continuous integration build including project dist, javadoc, test,
and coverage artifacts
====================================================================-->
<target name="continuous-testless"
depends="clean-all,resolve,dist-javadoc,dist-source,dist"/>
<!--=======================================================================
javadoc
Generates javadoc source documentation for this project
====================================================================-->
<target name="javadoc"
depends="javadoc.init, compile">
<javadoc destdir="${javadoc.dir}/docs/api"
access="public"
source="${javac.source}"
use="true"
notree="false"
nonavbar="false"
noindex="false"
splitindex="true"
author="true"
version="true"
maxmemory="256M"
nodeprecatedlist="false"
nodeprecated="false"
packagenames="${javadoc.packagenames}"
sourcepath="${src.dir}"
doctitle="${impl.title} documentation">
<link href="http://java.sun.com/j2se/${javac.source}.0/docs/api/" />
<classpath refid="classpath" />
</javadoc>
</target>
<!--=======================================================================
dist-javadoc
Generates zip and targz distributions of the javadoc
====================================================================-->
<target name="dist-javadoc"
depends="javadoc.zip, javadoc.targz" />
<!--=======================================================================
clean-javadoc
Removes generated javadoc files (note, this does not remove javadoc distributions.
Use clean-dist to remove artifacts from the dist.dir.
====================================================================-->
<target name="clean-javadoc">
<delete dir="${javadoc.dir}" />
</target>
<!--=======================================================================
javadoc.init
Creates directories for javadoc process
====================================================================-->
<target name="javadoc.init" depends="clean-javadoc">
<mkdir dir="${javadoc.dir}" />
</target>
<!--=======================================================================
javadoc.zip
Creates a zip of the javadoc for distribution
====================================================================-->
<target name="javadoc.zip" depends="javadoc">
<jar jarfile="${dist.dir}/${ivy.artifact.id}-${project.revision}-javadoc.zip"
basedir="${javadoc.dir}"
includes="**/*"
excludes="**/Thumbs.db" />
</target>
<!--=======================================================================
javadoc.targz
Creates a gzipped tar of the javadoc for distribution
====================================================================-->
<target name="javadoc.targz" depends="javadoc">
<tar compression="gzip"
destfile="${dist.dir}/${ivy.artifact.id}-${project.revision}-javadoc.tar.gz"
basedir="${javadoc.dir}"
includes="**/*"
excludes="**/Thumbs.db" />
</target>
<!--=======================================================================
cobertura
Runs tests in an instrumented environment and produces Cobertura test coverage reports
====================================================================-->
<target name="cobertura"
depends="clean-cobertura,cobertura.install,compile,compile-tests,cobertura.instrument-classes,cobertura.test-instrumented,cobertura.xml-report,cobertura.html-report"/>
<!--=======================================================================
cobertura.instrument-classes
Instruments the application classes used by Cobertura during cobertura.test-instrumented
====================================================================-->
<target name="cobertura.instrument-classes" depends="cobertura.clean-instrumented-classes,cobertura.install,compile">
<cobertura-instrument todir="${instrumented.classes.dir}" datafile="${cobertura.data.dir}/cobertura.ser">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${classes.dir}">
<!--
Instrument all the application classes, but
don't instrument the test classes.
-->
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>
</target>
<!--=======================================================================
cobertura.install
Downloads and installs Cobertura ant tasks
====================================================================-->
<target name="cobertura.install" depends="cobertura.download">
<path id="cobertura.classpath">
<fileset dir="${cobertura.build.cache.dir}">
<include name="*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
</target>
<!--=======================================================================
cobertura.download-check
Fetches Cobertura from sourceforge if it is not already present
====================================================================-->
<target name="cobertura.download-check">
<condition property="cobertura.available">
<and>
<available file="${cobertura.build.cache.dir}" />
<available classname="net.sourceforge.cobertura.ant.InstrumentTask">
<classpath>
<fileset dir="${cobertura.build.cache.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</available>
</and>
</condition>
<antcall target="cobertura.download" />
</target>
<!--=======================================================================
cobertura.download
Retrieves Cobertura jar via IVY
====================================================================-->
<target name="cobertura.download" depends="install-ivy" unless="cobertura.available">
<ivy:retrieve inline="true"
organisation="net.sourceforge.cobertura"
module="cobertura"
revision="1.9"
pattern="${cobertura.build.cache.dir}/[module].[ext]" />
</target>
<!--=======================================================================
clean-cobertura
Removes all files created by Cobertura code coverage utility
====================================================================-->
<target name="clean-cobertura"
depends="cobertura.clean-instrumented-classes,cobertura.clean-coverage-reports">
<delete dir="${cobertura.data.dir}" />
</target>
<!--=======================================================================
cobertura.clean-instrumented-classes
Remove the instrumented classes used by Cobertura
====================================================================-->
<target name="cobertura.clean-instrumented-classes">
<delete dir="${instrumented.classes.dir}" />
</target>
<!--=======================================================================
cobertura.clean-coverage-reports
Remove all xml and html Cobertura coverage reports
====================================================================-->
<target name="cobertura.clean-coverage-reports">
<delete dir="${coberturareports.xml.dir}" />
<delete dir="${coberturareports.html.dir}" />
<delete dir="${coberturareports.dir}" />
</target>
<!--=======================================================================
cobertura.test-instrumented
Runs tests against instrumented classes and generates xml and html JUnit test reports
====================================================================-->
<target name="cobertura.test-instrumented"
depends="init-test-reports,cobertura.install,compile,compile-tests,cobertura.instrument-classes">
<mkdir dir="${instrumented.classes.dir}" />
<junit fork="yes" failureProperty="test.failed" haltonfailure="${junit.haltonfailure}">
<sysproperty key="java.awt.headless" value="${headless.unittest}"/>
<!-- Specify the name of the coverage data file to use. -->
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.data.dir}/cobertura.ser" />
<!--
Note the classpath order: instrumented classes are before the
original (uninstrumented) classes. This is important.
-->
<classpath location="${instrumented.classes.dir}" />
<classpath location="${classes.dir}" />
<classpath location="${testclasses.dir}" />
<classpath refid="test.classpath" />
<classpath refid="cobertura.classpath" />
<formatter type="xml" />
<test name="${testcase}" todir="${testreports.xml.dir}" if="testcase" />
<batchtest todir="${testreports.xml.dir}" unless="testcase">
<fileset dir="${testsrc.dir}" casesensitive="yes">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${testreports.html.dir}">
<fileset dir="${testreports.xml.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${testreports.html.dir}" />
</junitreport>
</target>
<!--=======================================================================
cobertura.xml-report
Produces machine-readable xml Cobertura coverage report from results of instrumented tests
====================================================================-->
<target name="cobertura.xml-report" depends="cobertura.test-instrumented">
<cobertura-report destdir="${coberturareports.xml.dir}" datafile="${cobertura.data.dir}/cobertura.ser" format="xml">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
</cobertura-report>
</target>
<!--=======================================================================
cobertura.html-report
Produces human-readable html Cobertura coverage report from results of instrumented tests
====================================================================-->
<target name="cobertura.html-report" depends="cobertura.test-instrumented">
<cobertura-report destdir="${coberturareports.html.dir}"
datafile="${cobertura.data.dir}/cobertura.ser"
format="html">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
</cobertura-report>
</target>
<!--=======================================================================
install-pentaho-ant-tasks
Fetches and installs Pentaho Ant tasks
====================================================================-->
<target name="install-pentaho-ant-tasks" depends="install-ivy">
<ivy:retrieve inline="true"
organisation="pentaho"
module="pentaho-ant-tasks"
revision="1.1"
pattern="${pentaho.build.cache.dir}/[module].[ext]" />
<path id="pentaho-ant-tasks.classpath">
<fileset dir="${pentaho.build.cache.dir}">
<include name="*.jar" />
</fileset>
</path>
<taskdef name="dot-classpath"
description="Builds Eclipse .classpath from ANT classpath"
classname="org.pentaho.anttasks.DotClasspath"
classpathref="pentaho-ant-tasks.classpath">
</taskdef>
</target>
<!--=======================================================================
create-dot-classpath
Creates the Eclipse .classpath file from the resolved
classpath from Ant.
====================================================================-->
<target name="create-dot-classpath"
depends="install-pentaho-ant-tasks,init">
<dot-classpath>
<!-- Include all lib dirs -->
<classpath>
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${devlib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${testlib.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</dot-classpath>
</target>
</project>
|