aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2016-09-01 15:55:25 -0400
committerScott González <scott.gonzalez@gmail.com>2016-09-01 15:55:25 -0400
commit930934f4d22ce4397bcc85cde33c32acef2ec622 (patch)
tree9d7db6cc6973bdc5beaf68c81b3fe9e7174970a9 /demos
parent586d572ad2667f8f4c974f9e48d8ce7a4519af0c (diff)
downloadjquery-ui-930934f4d22ce4397bcc85cde33c32acef2ec622.tar.gz
jquery-ui-930934f4d22ce4397bcc85cde33c32acef2ec622.zip
Autocomplete: Change JSONP demo to use local data source
Fixes #14974
Diffstat (limited to 'demos')
-rw-r--r--demos/autocomplete/remote-jsonp.html23
-rw-r--r--demos/autocomplete/search.php13
2 files changed, 19 insertions, 17 deletions
diff --git a/demos/autocomplete/remote-jsonp.html b/demos/autocomplete/remote-jsonp.html
index d43dbbb75..45976bb2c 100644
--- a/demos/autocomplete/remote-jsonp.html
+++ b/demos/autocomplete/remote-jsonp.html
@@ -10,7 +10,6 @@
.ui-autocomplete-loading {
background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
}
- #city { width: 25em; }
</style>
<script src="../../external/requirejs/require.js"></script>
<script src="../bootstrap.js">
@@ -19,24 +18,22 @@
$( "#log" ).scrollTop( 0 );
}
- $( "#city" ).autocomplete({
+ $( "#birds" ).autocomplete({
source: function( request, response ) {
$.ajax( {
- url: "http://gd.geobytes.com/AutoCompleteCity",
+ url: "search.php",
dataType: "jsonp",
data: {
- q: request.term
+ term: request.term
},
success: function( data ) {
-
- // Handle 'no match' indicated by [ "" ] response
- response( data.length === 1 && data[ 0 ].length === 0 ? [] : data );
+ response( data );
}
} );
},
- minLength: 3,
+ minLength: 2,
select: function( event, ui ) {
- log( "Selected: " + ui.item.label );
+ log( "Selected: " + ui.item.value + " aka " + ui.item.id );
}
} );
</script>
@@ -44,9 +41,8 @@
<body>
<div class="ui-widget">
- <label for="city">Your city: </label>
- <input id="city" type="text">
- Powered by <a href="http://geobytes.com">geobytes.com</a>
+ <label for="birds">Birds: </label>
+ <input id="birds">
</div>
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
@@ -55,7 +51,8 @@
</div>
<div class="demo-description">
-<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are cities, displayed when at least three characters are entered into the field. The datasource is the <a href="http://geobytes.com">geobytes.com webservice</a>. That data is also available in callbacks, as illustrated by the Result area below the input.</p>
+<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.</p>
+<p>The datasource is a server-side script which returns JSONP data, specified via a function which uses <code>jQuery.ajax()</code> for the <code>source</code> option.</p>
</div>
</body>
</html>
diff --git a/demos/autocomplete/search.php b/demos/autocomplete/search.php
index 04bda4224..489b30c1e 100644
--- a/demos/autocomplete/search.php
+++ b/demos/autocomplete/search.php
@@ -1,6 +1,6 @@
<?php
-sleep( 3 );
+sleep( 2 );
// no term passed - just exit early with no response
if (empty($_GET['term'])) exit ;
$q = strtolower($_GET["term"]);
@@ -573,7 +573,6 @@ $items = array(
"Heuglin's Gull"=>"Larus heuglini"
);
-
$result = array();
foreach ($items as $key=>$value) {
if (strpos(strtolower($key), $q) !== false) {
@@ -584,6 +583,12 @@ foreach ($items as $key=>$value) {
}
// json_encode is available in PHP 5.2 and above, or you can install a PECL module in earlier versions
-echo json_encode($result);
+$output = json_encode($result);
+
+if ($_GET["callback"]) {
+ $output = $_GET["callback"] . "($output);";
+}
+
+echo $output;
-?> \ No newline at end of file
+?>
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
<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- ===========================================================================

                           * ================== *
                           |  FOP build system  |
                           * ================== *

Building instructions
=====================

First, install Ant (http://ant.apache.org). Check that ant or ant.bat
is in your search path and that JAVA_HOME and ANT_HOME are properly set.
Next make sure your current working directory is where this very file is
located. Then type

  ant

If everything is right and all the required packages are visible, this action
will generate a file called "fop.jar" in the "./build" directory.

If you experience any problems with the build please visit the FOP website for
more information: http://xmlgraphics.apache.org/fop


Build targets
=============

The build system is not only responsible for compiling Fop into a jar file,
but is also responsible for creating the javadocs, distributions, examples
and a miscellaneous stuff. In fact, the file you have here is _exactly_ what
is used by fop maintainers to take care of nearly everything in the Fop
project, no less and no more.

Call the Ant (see above) with the parameter "-projecthelp" to get a
list of possible build targets.

============================================================================ -->
<project default="all" basedir="." name="fop">
<!-- See build.properties and build-local.properties for overriding build settings. -->
<!-- build-local.properties is not stored in SVN and overrides values from build.properties -->
  <property environment="env"/>
  <property file="${basedir}/build-local.properties"/>
  <property file="${basedir}/build.properties"/>
  
  <path id="libs-build-classpath">
    <fileset dir="${basedir}/lib">
      <include name="*.jar"/>
    </fileset>
  </path>
  <property name="lib-tools" value="${basedir}/lib/build"/>
  <path id="libs-tools-build-classpath">
    <path refid="libs-build-classpath"/>
    <fileset dir="${lib-tools}">
      <include name="*.jar"/>
    </fileset>
  </path>
  <path id="libs-run-classpath">
    <path refid="libs-build-classpath"/>
    <fileset dir="${basedir}/build">
      <include name="fop.jar"/>
      <include name="fop-hyph.jar"/>
    </fileset>
  </path>
  <patternset id="exclude-jai">
    <exclude name="org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java" unless="jai.present"/>
  </patternset>
  <patternset id="exclude-jce-dependencies">
    <exclude name="org/apache/fop/pdf/PDFEncryptionJCE.java" unless="jce.present"/>
  </patternset>
  <patternset id="exclude-codegen">
    <exclude name="org/apache/fop/tools/Event*.java"/>
  </patternset>
  <property name="Name" value="Apache FOP"/>
  <property name="name" value="fop"/>
  <property name="NAME" value="FOP"/>
  <property name="version" value="2.9.0-SNAPSHOT"/>
  <property name="year" value="1999-2023"/>
  <property name="javac.debug" value="on"/>
  <property name="javac.optimize" value="off"/>
  <property name="javac.deprecation" value="on"/>
  <property name="javac.source" value="1.8"/>
  <property name="javac.target" value="1.8"/>
  <property name="javac.fork" value="no"/>
  <property name="junit.fork" value="yes"/>
  <property name="junit.haltonfailure" value="off"/>
  <property name="junit.maxmemory" value="1024m"/>
  <property name="junit.printsummary" value="off"/>
  <property name="junit.formatter.brief" value="on"/>
  <property name="javadoc.packages" value="org.apache.fop.*"/>
  <property name="core.dir" value="${basedir}/../fop-core"/>
  <property name="core.src.dir" value="${core.dir}/src"/>
  <property name="core.src.java.dir" value="${core.src.dir}/main/java"/>
  <property name="core.checkstyle.dir" value="${core.src.dir}/tools/resources/checkstyle"/>
  <property name="core.findbugs.dir" value="${core.src.dir}/tools/resources/findbugs"/>
  <property name="events.dir" value="${basedir}/../fop-events"/>
  <property name="events.src.dir" value="${events.dir}/src"/>
  <property name="events.src.java.dir" value="${events.src.dir}/main/java"/>
  <property name="events.checkstyle.dir" value="${events.src.dir}/tools/resources/checkstyle"/>
  <property name="events.findbugs.dir" value="${events.src.dir}/tools/resources/findbugs"/>
  <property name="sandbox.dir" value="${basedir}/../fop-sandbox"/>
  <property name="sandbox.src.dir" value="${sandbox.dir}/src"/>
  <property name="sandbox.src.java.dir" value="${sandbox.src.dir}/main/java"/>
  <property name="servlet.dir" value="${basedir}/../fop-servlet"/>
  <property name="servlet.src.dir" value="${servlet.dir}/src"/>
  <property name="servlet.src.java.dir" value="${servlet.src.dir}/main/java"/>
  <property name="util.dir" value="${basedir}/../fop-util"/>
  <property name="util.src.dir" value="${util.dir}/src"/>
  <property name="util.src.java.dir" value="${util.src.dir}/main/java"/>
  <property name="util.checkstyle.dir" value="${util.src.dir}/tools/resources/checkstyle"/>
  <property name="util.findbugs.dir" value="${util.src.dir}/tools/resources/findbugs"/>
  <property name="src.dir" value="${core.src.dir}"/>
  <property name="src.codegen.dir" value="${src.dir}/main/codegen"/>
  <property name="src.codegen.fonts.dir" value="${src.codegen.dir}/fonts"/>
  <property name="src.java.dir" value="${src.dir}/main/java"/>
  <property name="src.resources.dir" value="${src.dir}/main/resources"/>
  <property name="src.sandbox.dir" value="${sandbox.src.dir}"/>
  <property name="src.viewer.resources.dir" value="${core.src.dir}/main/resources/org/apache/fop/render/awt/viewer/resources"/>
  <property name="src.viewer.images.dir" value="${core.src.dir}/main/resources/org/apache/fop/render/awt/viewer/images"/>
  <property name="fo.examples.dir" value="${basedir}/examples/fo/basic"/>
  <property name="fo.examples.userconfig" value="conf/fop.xconf"/>
  <property name="fo.examples.include" value="**/*.fo"/>
  <property name="fo.examples.force" value="false"/>
  <property name="xml.tests.include" value="**/*.xml"/>
  <property name="xml.tests.force" value="false"/>
  <property name="xml.tests.userconfig" value="conf/fop.xconf"/>
  <property name="lib.dir" value="${basedir}/lib"/>
  <property name="user.hyph.dir" value="${basedir}/hyph"/>
  <property name="unidata.dir" value="${basedir}/UNIDATA"/>
  <property name="hyph.stacksize" value="512k"/>
  <property name="test.dir" value="${basedir}/test"/>
  <property name="test.java.dir" value="${src.dir}/test/java"/>
  <property name="test.resources.dir" value="${src.dir}/test/resources"/>
  <property name="build.dir" value="${basedir}/build"/>
  <property name="build.gensrc.dir" value="${build.dir}/gensrc"/>
  <property name="build.classes.dir" value="${build.dir}/classes"/>
  <property name="build.sandbox-classes.dir" value="${build.dir}/sandbox-classes"/>
  <property name="build.codegen-classes.dir" value="${build.dir}/codegen-classes"/>
  <property name="build.codegen.fonts.dir" value="${build.gensrc.dir}/org/apache/fop/fonts/"/>
  <property name="build.javadocs.dir" value="${build.dir}/javadocs"/>
  <property name="build.examples.dir" value="${build.dir}/examples"/>
  <property name="build.unit.tests.dir" value="${build.dir}/test-classes"/>
  <property name="build.tests.dir" value="${build.dir}/tests"/>
  <property name="build.viewer.resources.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/resources"/>
  <property name="build.viewer.images.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/images"/>
  <property name="build.property.examples.mime.type" value="application/pdf"/>
  <property name="build.property.tests.mime.type" value="application/pdf"/>
  <property name="nightly.dir" value="${basedir}/nightly"/>
  <tstamp/>
  <property name="samedir" value="${basedir}"/>
  <property name="junit.reports.dir" value="${build.dir}/test-reports"/>
  <property name="junit.html.reports.dir" value="${build.dir}/test-reports/html"/>
  <property name="copy.dependencies.arg" value=""/>
  
  <condition property="isWindows">
    <os family="windows" />
  </condition>
  <condition property="isUnix">
    <os family="unix" />
  </condition>    
  
<!-- Importing Apache Forrest for building the docs -->
<!--
  <property environment="env"/>
  <property name="forrest.home" value="${env.FORREST_HOME}"/>
  <import file="${env.FORREST_HOME}/main/forrest.build.xml" optional="true"/>
-->
  
  <presetdef name="javac">
    <javac fork="${javac.fork}"
      debug="${javac.debug}"
      deprecation="${javac.deprecation}"
      optimize="${javac.optimize}"
      source="${javac.source}" target="${javac.target}"/>
  </presetdef>
  
  <presetdef name="junit">
    <junit haltonfailure="${junit.haltonfailure}"
      fork="${junit.fork}"
      printsummary="${junit.printsummary}"
      maxmemory="${junit.maxmemory}"/>
  </presetdef>
  
  <!-- =================================================================== -->
<!-- Initialization target                                               -->
<!-- =================================================================== -->
  <target name="init" depends="init-avail">
  </target>
  <target name="init-avail">
    <echo message="------------------- ${Name} ${version} [${year}] ----------------"/>
    <echo message="See build.properties and build-local.properties for additional build settings"/>
    <echo message="${ant.version}"/>
    <echo message="VM: ${java.vm.version}, ${java.vm.vendor}"/>
    <echo message="JAVA_HOME: ${env.JAVA_HOME}"/>
    <available property="jai.present" classname="javax.media.jai.JAI" classpathref="libs-build-classpath"/>
    <condition property="jai.message" value="JAI Support PRESENT">
      <equals arg1="${jai.present}" arg2="true"/>
    </condition>
    <condition property="jai.message" value="JAI Support NOT Present">
      <not>
        <equals arg1="${jai.present}" arg2="true"/>
      </not>
    </condition>
    <echo message="${jai.message}"/>
    <available property="jce.present" classname="javax.crypto.Cipher" classpathref="libs-build-classpath"/>
    <condition property="jce.message" value="JCE Support PRESENT">
      <equals arg1="${jce.present}" arg2="true"/>
    </condition>
    <condition property="jce.message" value="JCE Support NOT Present">
      <not>
        <equals arg1="${jce.present}" arg2="true"/>
      </not>
    </condition>
    <echo message="${jce.message}"/>
    <available property="jdk14.present" classname="java.lang.CharSequence"/>
    <fail message="${Name} requires at least Java 1.4!" unless="jdk14.present"/>
    <available property="junit.present" classname="org.junit.Test" classpathref="libs-tools-build-classpath"/>
    <condition property="junit.message" value="JUnit Support PRESENT">
      <equals arg1="${junit.present}" arg2="true"/>
    </condition>
    <condition property="junit.message" value="JUnit Support NOT Present - Committers are required to have JUnit working">
      <not>
        <equals arg1="${junit.present}" arg2="true"/>
      </not>
    </condition>
    <echo message="${junit.message}"/>
    <condition property="xmlunit.present">
      <and>
        <available classname="org.custommonkey.xmlunit.XMLTestCase" classpathref="libs-tools-build-classpath"/>
        <isset property="junit.present"/>
      </and>
    </condition>
    <condition property="xmlunit.message" value="XMLUnit Support PRESENT">
      <equals arg1="${xmlunit.present}" arg2="true"/>
    </condition>
    <condition property="xmlunit.message" value="XMLUnit Support NOT Present - you can get it from http://xmlunit.sourceforge.net">
      <not>
        <equals arg1="${xmlunit.present}" arg2="true"/>
      </not>
    </condition>
    <echo message="${xmlunit.message}"/>
  </target>
<!-- =================================================================== -->
<!-- Help on usage                                                       -->
<!-- =================================================================== -->
  <target name="usage">
    <echo message="Use the -projecthelp option instead"/>
  </target>
<!-- =================================================================== -->
<!-- Generate the source code                                            -->
<!-- =================================================================== -->
  <macrodef name="create-font">
    <attribute name="name"/>
    <sequential>
      <xslt in="${src.codegen.fonts.dir}/@{name}.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.codegen.fonts.dir}/base14/@{name}.java"/>
    </sequential>
  </macrodef>
  <target name="codegen" depends="init" description="Generates the java files from the xml resources">
    <echo message="Generating the java files from xml resources"/>
    <mkdir dir="${build.gensrc.dir}"/>
    <mkdir dir="${build.gensrc.dir}/org/apache/fop/fonts/base14"/>
    <xslt in="${src.codegen.fonts.dir}/encodings.xml" style="${src.codegen.fonts.dir}/code-point-mapping.xsl" out="${build.codegen.fonts.dir}/CodePointMapping.java"/>
    <xslt basedir="${src.codegen.fonts.dir}" includes="Helvetica*.xml,Times*.xml,Courier*.xml" style="${src.codegen.fonts.dir}/font-file.xsl" destdir="${build.codegen.fonts.dir}/base14/" extension=".java">
      <param name="encoding" expression="WinAnsiEncoding"/>
    </xslt>
    <create-font name="Symbol"/>
    <create-font name="ZapfDingbats"/>
  </target>
<!-- =================================================================== -->
<!-- Compiles the source directory                                       -->
<!-- =================================================================== -->
  <target name="compile-java" depends="init, codegen">
<!-- create directories -->
    <mkdir dir="${build.classes.dir}"/>
    <javac destdir="${build.classes.dir}" includeAntRuntime="true">
      <src path="${build.gensrc.dir}"/>
      <src path="${core.src.java.dir}"/>
      <src path="${events.src.java.dir}"/>
      <src path="${util.src.java.dir}"/>
      <patternset includes="**/*.java"/>
      <patternset refid="exclude-jce-dependencies"/>
      <patternset refid="exclude-jai"/>
      <patternset refid="exclude-codegen"/>
      <classpath refid="libs-build-classpath"/>
      <compilerarg value="-Xlint:cast"/> 
    </javac>
    <mkdir dir="${build.sandbox-classes.dir}"/>
    <javac destdir="${build.sandbox-classes.dir}" includeAntRuntime="true">
      <src path="${src.sandbox.dir}"/>
      <patternset includes="**/*.java"/>
      <patternset refid="exclude-jai"/>
      <patternset refid="exclude-codegen"/>
      <classpath>
        <path refid="libs-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
      </classpath>
    </javac>
  </target>
  <target name="resourcegen" depends="compile-java">
    <javac destdir="${build.classes.dir}" includeAntRuntime="true">
      <src path="${events.src.java.dir}"/>
      <patternset includes="**/tools/Event*.java"/>
      <classpath>
        <path refid="libs-tools-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
      </classpath>
    </javac>
    <copy todir="${build.classes.dir}">
      <fileset dir="${src.resources.dir}">
        <include name="**/tools/*.xsl"/>
      </fileset>
    </copy>
    <taskdef name="eventResourceGenerator" classname="org.apache.fop.tools.EventProducerCollectorTask">
      <classpath>
        <path refid="libs-tools-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
        <pathelement location="${build.codegen-classes.dir}"/>
      </classpath>
    </taskdef>
    <eventResourceGenerator destdir="${build.gensrc.dir}">
      <fileset dir="${src.java.dir}">
        <include name="**/*.java"/>
      </fileset>
    </eventResourceGenerator>
  </target>
  <target name="compile-copy-resources" depends="resourcegen">
    <copy todir="${build.classes.dir}">
      <fileset dir="${src.resources.dir}">
        <include name="META-INF/**"/>
        <include name="**/*.icm"/>
        <include name="**/*.icc"/>
        <include name="**/*.xml"/>
        <include name="**/*.LICENSE.txt"/>
        <include name="**/*.xsl"/>
      </fileset>
      <fileset dir="${build.gensrc.dir}">
        <include name="**/*.xml"/>
      </fileset>
    </copy>
    <copy todir="${build.sandbox-classes.dir}">
      <fileset dir="${src.resources.dir}">
        <include name="META-INF/services/*.ElementMapping"/>
        <include name="META-INF/services/*.FOEventHandler"/>
        <include name="META-INF/services/*.IFDocumentHandler"/>
        <include name="META-INF/services/*.ImageHandler"/>
        <include name="META-INF/services/*.XMLHandler"/>
      </fileset>
    </copy>
    <mkdir dir="${build.viewer.resources.dir}"/>
    <copy todir="${build.viewer.resources.dir}">
      <fileset dir="${src.viewer.resources.dir}"/>
    </copy>
    <mkdir dir="${build.viewer.images.dir}"/>
    <copy todir="${build.viewer.images.dir}">
      <fileset dir="${src.viewer.images.dir}"/>
    </copy>
<!-- sandbox -->
    <copy todir="${build.sandbox-classes.dir}">
      <fileset dir="${src.sandbox.dir}">
        <include name="META-INF/**"/>
      </fileset>
    </copy>
  </target>
  <target name="compile" depends="compile-java, compile-copy-resources" description="Compiles the source code"/>
  <!-- =================================================================== -->
  <!-- Helper task to generate source files that have already been checked -->
  <!-- into the repository. This task uses Unicode Character Database      -->
  <!-- files. This task need only be run when the latter files have been   -->
  <!-- updated. This target should never be part of the normal build       -->
  <!-- process. Output is UnicodeClasses.CLASSES_XML                       -->
  <!-- (src/java/org/apache/fop/hyphenation/classes.xml). -->
  <!-- =================================================================== -->
  <target name="codegen-hyphenation-classes">
    <javac destdir="${build.codegen-classes.dir}">
      <src path="${src.codegen.dir}/unicode/java"/>
    </javac>
    <java classname="org.apache.fop.hyphenation.UnicodeClasses" resultproperty="classes.result" classpath="${build.codegen-classes.dir}">
      <arg value="${src.java.dir}/org/apache/fop/hyphenation/classes.xml"/>
    </java>
    <condition property="classes.result.message" value="Generation of classes successful">
      <not>
      <isfailure code="${classes.result}"/>
      </not>
    </condition>
    <condition property="classes.result.message" value="Generation of classes failed">
      <isfailure code="${classes.result}"/>
    </condition>
    <echo message="${classes.result.message}"/>
  </target>
  <!-- =================================================================== -->
  <!-- compiles hyphenation patterns                                       -->
  <!-- =================================================================== -->
  <target name="compile-hyphenation" depends="compile" description="Compiles the hyphenation pattern files">
    <path id="hyph-classpath">
      <path refid="libs-build-classpath"/>
      <pathelement location="${build.classes.dir}"/>
    </path>
    <mkdir dir="${build.classes.dir}/hyph"/>
    <java classname="org.apache.fop.hyphenation.SerializeHyphPattern" fork="true" resultproperty="hyph.result" classpathref="hyph-classpath">
      <arg value="${user.hyph.dir}"/>
      <arg value="${build.classes.dir}/hyph"/>
      <jvmarg value="-Xss${hyph.stacksize}"/>
    </java>
    <condition property="hyph.result.message" value="Hyphenation successful">
      <not>
      <isfailure code="${hyph.result}"/>
      </not>
    </condition>
    <condition property="hyph.result.message" value="Hyphenation failed">
      <isfailure code="${hyph.result}"/>
    </condition>
    <echo message="${hyph.result.message}"/>
  </target>
  <target name="uptodate-jar-hyphenation" depends="compile-hyphenation">
    <uptodate property="jar.hyphenation.uptodate" targetfile="${build.dir}/fop-hyph.jar">
      <srcfiles dir="${build.classes.dir}/hyph"/>
    </uptodate>
  </target>
  <target name="jar-hyphenation" depends="compile-hyphenation,uptodate-jar-hyphenation" description="Generates the hyphenation jar file" unless="jar.hyphenation.uptodate">
    <tstamp>
      <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
    </tstamp>
    <jar jarfile="${build.dir}/fop-hyph.jar" basedir="${build.classes.dir}" includes="hyph/*.hyp">
      <manifest>
        <attribute name="Implementation-Title" value="${Name}"/>
        <attribute name="Implementation-Version" value="${version}"/>
        <attribute name="Implementation-Vendor" value="The Apache Software Foundation (http://xmlgraphics.apache.org/fop/)"/>
        <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
      </manifest>
    </jar>
  </target>
<!-- =================================================================== -->
<!-- main FOP JARs                                                       -->
<!-- =================================================================== -->
  <target name="uptodate-jar-main" depends="compile">
    <uptodate property="jar.main.uptodate" targetfile="${build.dir}/fop.jar">
      <srcfiles dir="${build.classes.dir}"/>
    </uptodate>
  </target>
  <target name="jar-main" depends="compile,uptodate-jar-main" description="Generates the main jar file" unless="jar.main.uptodate">
    <tstamp>
      <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
    </tstamp>
    <pathconvert property="manifest.classpath" dirsep="/" pathsep=" " refid="libs-build-classpath">
      <map from="${basedir}${file.separator}lib${file.separator}" to=""/>
    </pathconvert>
    <jar jarfile="${build.dir}/fop.jar">
      <manifest>
        <attribute name="Main-Class" value="org.apache.fop.cli.Main"/>
        <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
        <section name="org/apache/fop/">
          <attribute name="Specification-Title" value="XSL-FO - Extensible Stylesheet Language"/>
          <attribute name="Specification-Version" value="1.1"/>
          <attribute name="Specification-Vendor" value="World Wide Web Consortium"/>
          <attribute name="Specification-URL" value="http://www.w3.org/TR/xsl"/>
          <attribute name="Implementation-Title" value="${Name}"/>
          <attribute name="Implementation-Version" value="${version}"/>
          <attribute name="Implementation-Vendor" value="The Apache Software Foundation (http://xmlgraphics.apache.org/fop/)"/>
        </section>
      </manifest>
      <metainf dir="${basedir}/.." includes="LICENSE,NOTICE"/>
      <fileset dir="${build.classes.dir}">
        <exclude name="**/tools/Event*.class"/>
        <exclude name="**/tools/*.xsl"/>
      </fileset>
    </jar>
  </target>
  <target name="mvn-jars" depends="mvn-jars-unix,mvn-jars-windows" unless="dev">
    <delete failonerror="false">
      <fileset dir="${basedir}/lib">
        <include name="*.jar"/>
        <exclude name="checkstyle*.jar"/>
        <exclude name="jacocoant*.jar"/>
        <exclude name="twelvemonkeys*.jar"/>
        <exclude name="zxing*.jar"/>
        <exclude name="avalon*.jar"/>
        <exclude name="barcode4j*.jar"/>
        <exclude name="bcprov*.jar"/>
        <exclude name="fop-pdf-images*.jar"/>
        <exclude name="jai_imageio*.jar"/>
        <exclude name="levigo*.jar"/>
      </fileset>
    </delete>
    <copy todir="${basedir}/lib">
      <fileset dir="${basedir}/../fop-core/target/dependency">
        <include name="*.jar"/>
        <exclude name="fop*SNAPSHOT.jar"/>
        <exclude name="ant*.jar"/>
      </fileset>
    </copy>
  </target>
  <target name="mvn-jars-unix" if="isUnix" unless="dev">
    <exec executable="mvn" dir="${basedir}/.." failonerror="true">
      <arg value="clean"/>
      <arg line="${copy.dependencies.arg} dependency:copy-dependencies -DskipTests"/>
    </exec>
  </target>
  <target name="mvn-jars-windows" if="isWindows" unless="dev">
    <exec executable="cmd" dir="${basedir}/.." failonerror="true">
	  <arg value="/c"/>
	  <arg value="mvn"/>    
      <arg value="clean"/>
      <arg line="${copy.dependencies.arg} dependency:copy-dependencies -DskipTests"/>
    </exec>
  </target>
  <target name="uptodate-jar-sandbox" depends="compile">
    <uptodate property="jar.sandbox.uptodate" targetfile="${build.dir}/fop-sandbox.jar">
      <srcfiles dir="${build.sandbox-classes.dir}"/>
    </uptodate>
  </target>
  <target name="jar-sandbox" depends="compile,uptodate-jar-sandbox" description="Generates the sandbox jar file" unless="jar.sandbox.uptodate">
    <tstamp>
      <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
    </tstamp>
    <jar jarfile="${build.dir}/fop-sandbox.jar" basedir="${build.sandbox-classes.dir}">
      <manifest>
        <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
      </manifest>
      <metainf dir="${basedir}/.." includes="LICENSE,NOTICE"/>
    </jar>
  </target>
  <target name="uptodate-jar-sources" depends="codegen">
    <uptodate property="jar.sources.uptodate" targetfile="${build.dir}/fop-sources.jar">
      <srcfiles dir="${build.gensrc.dir}"/>
      <srcfiles dir="${src.java.dir}"/>
    </uptodate>
  </target>
  <target name="jar-sources" depends="codegen" description="Generates a jar file with all the sources" unless="jar.sources.uptodate">
    <tstamp>
      <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
    </tstamp>
    <patternset id="java-only">
      <include name="**/*.java"/>
    </patternset>
    <jar jarfile="${build.dir}/${name}-${version}-sources.jar">
      <fileset dir="${build.gensrc.dir}">
        <patternset refid="java-only"/>
      </fileset>
      <fileset dir="${src.java.dir}">
        <patternset refid="java-only"/>
      </fileset>
      <fileset dir="${events.src.java.dir}">
        <patternset refid="java-only"/>
      </fileset>
      <fileset dir="${util.src.java.dir}">
        <patternset refid="java-only"/>
      </fileset>
      <fileset dir="${basedir}/..">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </fileset>
    </jar>
  </target>
<!-- =================================================================== -->
<!-- Creates the class package                                           -->
<!-- =================================================================== -->
  <target name="package" depends="mvn-jars,jar-main,jar-hyphenation,jar-sandbox" description="Generates the jar files"/>
  <target name="servlet" depends="package" description="Generates the WAR with the sample FOP servlet">
    <echo message="Creating the WAR file"/>
    <war warfile="${build.dir}/fop.war" webxml="${servlet.src.dir}/main/webapp/WEB-INF/web.xml">
      <lib dir="${lib.dir}">
        <include name="commons-logging*.jar"/>
        <include name="batik*.jar"/>
        <include name="commons-io*.jar"/>
        <include name="xmlgraphics*.jar"/>
      </lib>
      <lib dir="${build.dir}">
        <include name="fop.jar"/>
      </lib>
    </war>
  </target>
  <fileset dir="${build.classes.dir}" id="transcoder-classes-files">
    <patternset refid="transcoder-classes"/>
  </fileset>
  <fileset dir="${lib.dir}" id="transcoder-lib-files">
    <include name="commons-io*.jar"/>
    <include name="commons-logging*.jar"/>
    <include name="xmlgraphics-commons*.jar"/>
  </fileset>
  
  <condition property="isWindows">
    <os family="windows" />
  </condition>
  
  <condition property="isUnix">
    <os family="unix" />
  </condition>
  
  <target name="transcoder-pkg" depends="remove-cache,transcoder-pkg-unix" description="Generates the jar for the transcoder package for Batik" if="isWindows">
    <exec executable="cmd" dir="${basedir}/.." failonerror="true">
      <env key="MAVEN_OPTS" value="-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2"/>
	  <arg value="/c"/>
	  <arg value="mvn"/>
      <arg value="clean"/>
      <arg value="install"/>
      <arg value="-DskipTests"/>
      <arg value="-U"/>
    </exec>	
    <copy file="${basedir}/../fop-transcoder/target/fop-transcoder-${version}.jar" tofile="${build.dir}/fop-transcoder.jar"/>
    <copy file="${basedir}/../fop-transcoder-allinone/target/fop-transcoder-allinone-${version}.jar" tofile="${build.dir}/fop-transcoder-allinone.jar"/>
  </target>
  
  <target name="transcoder-pkg-unix" if="isUnix">
    <exec executable="mvn" dir="${basedir}/.." failonerror="true">
      <env key="MAVEN_OPTS" value="-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2"/>
      <arg value="clean"/>
      <arg value="install"/>
      <arg value="-DskipTests"/>
      <arg value="-U"/>
    </exec>
    <copy file="${basedir}/../fop-transcoder/target/fop-transcoder-${version}.jar" tofile="${build.dir}/fop-transcoder.jar"/>
    <copy file="${basedir}/../fop-transcoder-allinone/target/fop-transcoder-allinone-${version}.jar" tofile="${build.dir}/fop-transcoder-allinone.jar"/>
  </target>
  
  <target name="all" depends="package, servlet, transcoder-pkg, junit"/>
<!-- "all" target for us Makefile converts ;-) -->
<!-- =================================================================== -->
<!-- Testing                                                             -->
<!-- =================================================================== -->
  <target name="junit-init" depends="init-avail" if="xmlunit.present">
    <condition property="junit.formatter.brief.use">
      <istrue value="${junit.formatter.brief}"/>
    </condition>
  </target>
  <target name="junit-with-xmlunit" depends="junit-init" if="xmlunit.present">
    <patternset id="test-sources"/>
  </target>
  <target name="junit-without-xmlunit" depends="junit-init" unless="xmlunit.present">
    <patternset id="test-sources">
      <exclude name="**/intermediate/*"/>
    </patternset>
  </target>
  <target name="junit-compile-java" depends="package, transcoder-pkg, junit-with-xmlunit, junit-without-xmlunit" if="junit.present">
    <mkdir dir="${build.unit.tests.dir}"/>
    <mkdir dir="${build.dir}/test-gensrc"/>
    <mkdir dir="${junit.reports.dir}"/>
    <javac destdir="${build.unit.tests.dir}" includeAntRuntime="true">
      <src path="${test.java.dir}"/>
      <patternset refid="test-sources"/>
      <classpath>
        <path refid="libs-tools-build-classpath"/>
        <fileset dir="${build.dir}">
          <include name="fop.jar"/>
        </fileset>
      </classpath>
      <compilerarg value="-Xlint:cast"/>
    </javac>
    <copy todir="${build.unit.tests.dir}">
      <fileset dir="${test.java.dir}">
        <include name="**/*.xsl"/>
        <include name="**/*.txt"/>
        <include name="**/*.afm"/>
        <include name="**/*.fo"/>
        <include name="**/*.svg"/>
      </fileset>
    </copy>
  </target>
  <target name="junit-compile-copy-resources" if="junit.present">
    <eventResourceGenerator 
      destdir="${build.dir}/test-gensrc">
      <fileset dir="${test.java.dir}">
        <include name="**/*.java"/>
      </fileset>
    </eventResourceGenerator>
    <copy todir="${build.unit.tests.dir}">
      <fileset dir="${test.resources.dir}">
        <include name="**/*"/>
      </fileset>
      <fileset dir="${build.dir}/test-gensrc">
        <include name="**/*.xml"/>
      </fileset>
    </copy>
  </target>
  <target name="junit-compile" depends="junit-compile-java, junit-compile-copy-resources" description="Compiles FOP's JUnit tests" if="junit.present"/>
  <target name="junit-transcoder" depends="junit-compile" description="Runs FOP's JUnit transcoder tests" if="junit.present">
    <path id="transcoder-classpath">
      <pathelement location="${build.unit.tests.dir}"/>
      <path refid="libs-tools-build-classpath"/>
      <fileset dir="${build.dir}">
        <include name="fop-transcoder.jar"/>
      </fileset>
    </path>
    <junit-run classpath="transcoder-classpath" title="basic functionality for fop-transcoder.jar" testsuite="org.apache.fop.BasicTranscoderTestSuite" outfile="TEST-transcoder"/>
    <echo message="Running basic functionality tests for fop-transcoder-allinone.jar"/>
    <!-- These are the same tests as in the block above but testing the "allinone" JAR
         instead. Please don't add any additional paths other than the test classes, the
         allinone JAR and the any Batik JARs to the classpath. If this fails, but the
         previous test block succeeded it indicates that the packaging of the allinone
         JAR needs to be updated.
    -->
    <path id="transcoder-all-classpath">
      <pathelement location="${build.unit.tests.dir}"/>
      <path refid="libs-tools-build-classpath"/>
      <fileset dir="build">
        <include name="fop-transcoder-allinone.jar"/>
      </fileset>
      <fileset dir="${lib.dir}">
        <include name="xml-apis*.jar"/>
        <include name="xerces*.jar"/>
        <include name="batik*.jar"/>
      </fileset>
    </path>
    <junit-run classpath="transcoder-all-classpath" title="basic functionality for fop-transcoder-allinone.jar" testsuite="org.apache.fop.BasicTranscoderTestSuite" outfile="TEST-transcoder-allinone"/>
  </target>
  <target name="hyphenation-present" depends="junit-compile" if="junit.present">
    <condition property="hyphenation.present">
      <and>
<!-- All the hyphenation files required by the layout test cases to be listed here -->
        <available resource="hyph/en.hyp" classpathref="libs-run-classpath"/>
        <available resource="hyph/de.hyp" classpathref="libs-run-classpath"/>
      </and>
    </condition>
    <condition property="hyphenation.message" value="Hyphenation Support PRESENT">
      <equals arg1="${hyphenation.present}" arg2="true"/>
    </condition>
    <condition property="hyphenation.message" value="Hyphenation Support NOT Present - Layout tests which require hyphenation are NOT being run!">
      <not>
        <equals arg1="${hyphenation.present}" arg2="true"/>
      </not>
    </condition>
    <echo message="${hyphenation.message}"/>
  </target>
  <path id="standard-junit-classpath">
    <pathelement location="${build.unit.tests.dir}"/>
    <path refid="libs-tools-build-classpath"/>
    <fileset dir="${build.dir}">
      <include name="fop.jar"/>
      <include name="fop-hyph.jar"/>
    </fileset>
  </path>
  <macrodef name="junit-run">
    <attribute name="title"/>
    <attribute name="basedir" default=""/>
    <attribute name="testsuite"/>
    <attribute name="outfile"/>
    <attribute name="classpath" default="standard-junit-classpath"/>
    <sequential>
      <echo message="Running @{title} tests..."/>
      <junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" forkmode="once" 
        errorproperty="fop.junit.error" failureproperty="fop.junit.failure" printsummary="${junit.printsummary}">
        <sysproperty key="basedir" value="${basedir}/@{basedir}"/>
        <sysproperty key="jawa.awt.headless" value="true"/>
        <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
        <formatter type="plain" usefile="true"/>
        <formatter type="xml" usefile="true"/>
        <classpath>
          <path refid="@{classpath}"/>
        </classpath>
        <assertions>
          <enable/>
        </assertions>
        <test name="@{testsuite}" todir="${junit.reports.dir}" outfile="@{outfile}"/>
      </junit>
    </sequential>
  </macrodef>
  <target name="junit-all" depends="junit-compile, junit-transcoder, junit-layout-hyphenation" 
    description="Runs FOP's JUnit basic tests" if="junit.present">
    <junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" forkmode="once" 
      errorproperty="fop.junit.error" failureproperty="fop.junit.failure" printsummary="${junit.printsummary}">
      <sysproperty key="jawa.awt.headless" value="true"/>
      <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
      <formatter type="plain" usefile="true"/>
      <formatter type="xml" usefile="true"/>
      <classpath>
        <path refid="standard-junit-classpath"/>
      </classpath>
      <assertions>
        <enable/>
      </assertions>
      <batchtest todir="${junit.reports.dir}">
        <fileset dir="${build.unit.tests.dir}" includes="**/*TestCase.class"/>
      </batchtest>
    </junit>
  </target>
  <target name="junit-basic" depends="junit-compile" description="Runs FOP's JUnit basic tests" if="junit.present">
    <junit-run title="Standard test suite" testsuite="org.apache.fop.StandardTestSuite" outfile="TEST-standard-tests-suite"/>
  </target>
  <target name="junit-userconfig" depends="junit-compile" if="junit.present" description="Runs FOP's user config JUnit tests">
    <junit-run title="user config" testsuite="org.apache.fop.config.UserConfigTestSuite" outfile="TEST-userconfig"/>
  </target>
  <target name="junit-layout-standard" depends="junit-compile, junit-fotree" if="junit.present" description="Runs FOP's standard JUnit layout tests">
    <junit-run title="standard layout engine" testsuite="org.apache.fop.layoutengine.LayoutEngineTestSuite" outfile="TEST-layoutengine-standard"/>
  </target>
  <target name="junit-layout-hyphenation" depends="hyphenation-present, junit-compile" if="hyphenation.present" description="Runs FOP's JUnit hyphenation layout tests">
    <junit-run title="hyphenation layout engine" testsuite="org.apache.fop.layoutengine.HyphenationLayoutTestCase"
      outfile="TEST-layoutengine-hyphenation"/>
  </target>
  <target name="junit-layout" depends="junit-layout-standard, junit-layout-hyphenation" description="Runs all FOP's JUnit layout tests"/>
  <target name="junit-fotree" depends="junit-compile" description="Runs FOP's FO tree JUnit tests" if="junit.present">
    <junit-run title="fo tree" testsuite="org.apache.fop.fotreetest.FOTreeTestSuite" outfile="TEST-FO-tree"/>
  </target>
  <target name="junit-area-tree-xml-format" depends="junit-compile" description="Runs FOP's area tree XML format JUnit tests" if="xmlunit.present">
    <junit-run title="area tree XML format" testsuite="org.apache.fop.intermediate.AreaTreeXMLFormatTestSuite" outfile="TEST-area-tree-xml-format"/>
  </target>
  <target name="junit-intermediate-layout" depends="junit-compile" if="xmlunit.present">
    <junit-run title="intermediate format from layout tests" 
      testsuite="org.apache.fop.intermediate.LayoutIFTestSuite" 
      outfile="TEST-intermediate-format-from-layout"/>
  </target>

  <target name="junit-intermediate-format" depends="junit-compile,junit-intermediate-layout"
    description="Runs FOP's intermediate format JUnit tests" if="xmlunit.present">
    <junit-run title="intermediate format" 
      testsuite="org.apache.fop.intermediate.IntermediateFormatTestSuite" 
      outfile="TEST-intermediate-format"/>
  </target>
  <target name="junit-events" depends="junit-compile" description="Runs FOP's event JUnit tests" if="junit.present">
    <junit-run title="event" testsuite="org.apache.fop.events.EventProcessingTestCase" outfile="TEST-events"/>
  </target>
  <target name="junit-text-linebreak" depends="junit-compile" description="Runs FOP's JUnit unicode linebreak tests" if="junit.present">
    <junit-run title="Unicode UAX#14 support" testsuite="org.apache.fop.text.linebreak.LineBreakStatusTestCase" outfile="TEST-linebreak"/>
  </target>
  <target name="junit-fonts" depends="junit-compile">
    <echo message="Running tests for the fonts package"/>
    <junit-run title="fonts" testsuite="org.apache.fop.fonts.FOPFontsTestSuite" outfile="TEST-fonts"/>
  </target>
  <target name="junit-render-ps" depends="junit-compile">
    <echo message="Running tests for the render ps package"/>
    <junit-run title="render-ps" testsuite="org.apache.fop.render.ps.RenderPSTestSuite" outfile="TEST-render-ps"/>
  </target>
  <target name="junit-render-pdf" depends="junit-compile">
    <junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/>
  </target>
  <target name="junit-complexscripts" depends="junit-compile">
    <junit-run title="complexscripts" testsuite="org.apache.fop.complexscripts.ComplexScriptsTestSuite" outfile="TEST-complexscripts"/>
  </target>
  <target name="junit-complexscripts-layout" depends="junit-compile" if="junit.present">
    <junit-run title="standard layout engine" testsuite="org.apache.fop.complexscripts.layout.ComplexScriptsLayoutTestSuite" outfile="TEST-complexscripts-layout"/>
  </target>
  <target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, 
    junit-text-linebreak, junit-fotree, junit-fonts, junit-render-pdf, junit-render-ps, 
    junit-complexscripts, junit-complexscripts-layout"/>
  <target name="junit" depends="remove-cache, junit-all" description="Runs all of FOP's JUnit tests" 
    if="junit.present">
    <fail><condition><or><isset property="fop.junit.error"/><isset 
            property="fop.junit.failure"/><not><isset 
              property="hyphenation.present"/></not></or></condition>
NOTE:
**************************************************************************
* One or more of the Junit tests had Failures or Errors or were skipped! *
*         Please check the output above for relevant messages.           *
*    Or use the "junit-reports" target to generate HTML test reports.    *
**************************************************************************
    </fail>
    <echo>All Junit tests passed!</echo>
    <echo>Use the "junit-reports" target to generate HTML test reports</echo>
  </target>
<!-- haven't made this dependent on "junit" as that would rerun all tests -->
  <target name="junit-reports" description="Generates HTML test reports">
    <mkdir dir="${junit.html.reports.dir}"/>
    <junitreport todir="${junit.reports.dir}">
      <fileset dir="${junit.reports.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${junit.html.reports.dir}"/>
    </junitreport>
    <echo>JUnit HTML test reports should be available in ${junit.html.reports.dir}</echo>
  </target>
<!-- =================================================================== -->
<!-- Creates the API documentation                                       -->
<!-- =================================================================== -->
  <target name="javadocs" depends="codegen" description="Generates javadocs">
<!--condition property="javadoc.version.ok">
      <not>
        <or>
          <equals arg1="${ant.java.version}" arg2="1.1"/>
          <equals arg1="${ant.java.version}" arg2="1.2"/>
          <equals arg1="${ant.java.version}" arg2="1.3"/>
        </or>
      </not>
    </condition>
    <fail message="Building FOP javadocs requires at least Java 1.4" unless="javadoc.version.ok"/-->
    <property name="javadoc.public" value="false"/>
    <property name="javadoc.package" value="false"/>
    <property name="javadoc.private" value="false"/>
    <condition property="javadoc.level" value=" (level: private)">
      <equals arg1="${javadoc.private}" arg2="true"/>
    </condition>
    <condition property="javadoc.level" value=" (level: package)">
      <equals arg1="${javadoc.package}" arg2="true"/>
    </condition>
    <condition property="javadoc.level" value=" (level: public)">
      <equals arg1="${javadoc.public}" arg2="true"/>
    </condition>
    <property name="javadoc.level" value=""/>
    <echo message="Producing the javadoc files${javadoc.level}"/>
    <mkdir dir="${build.javadocs.dir}"/>
    <javadoc failonerror="true" source="${javac.source}" destdir="${build.javadocs.dir}"
      packagenames="${javadoc.packages}"
      public="${javadoc.public}" package="${javadoc.package}" private="${javadoc.private}"
      author="true" version="true" use="true"
      windowtitle="${Name} ${version} API"
      doctitle="Apache Formatting Objects Processor (FOP)"
      bottom="Copyright ${year} The Apache Software Foundation. All Rights Reserved."
      overview="${src.java.dir}/org/apache/fop/overview.html"
      maxmemory="256M">
      <header><![CDATA[${name} ${version}]]></header>
      <footer><![CDATA[${name} ${version}]]></footer>
      <classpath>
        <path refid="libs-build-classpath"/>
        <pathelement path="${java.class.path}"/>
      </classpath>
      <sourcepath>
        <pathelement path="${src.java.dir}"/>
        <pathelement path="${src.sandbox.dir}"/>
        <pathelement path="${build.gensrc.dir}"/>
      </sourcepath>
      <tag name="asf.todo" scope="all" description="TODO"/>
      <tag name="event.severity" scope="all" description="Event severity level:"/>
      <group title="Control and Startup">
        <package name="org.apache.fop"/>
        <package name="org.apache.fop.apps"/>
        <package name="org.apache.fop.cli"/>
        <package name="org.apache.fop.configuration"/>
        <package name="org.apache.fop.messaging"/>
        <package name="org.apache.fop.servlet"/>
      </group>
      <group title="XSL-FO Tree">
        <package name="org.apache.fop.fo"/>
        <package name="org.apache.fop.fo.*"/>
        <package name="org.apache.fop.datatypes"/>
        <package name="org.apache.fop.extensions"/>
      </group>
      <group title="Layout">
        <package name="org.apache.fop.layoutmgr"/>
        <package name="org.apache.fop.layoutmgr.*"/>
      </group>
      <group title="Area Tree">
        <package name="org.apache.fop.area"/>
        <package name="org.apache.fop.area.*"/>
        <package name="org.apache.fop.traits"/>
      </group>
      <group title="Paginated Rendering">
        <package name="org.apache.fop.render"/>
        <package name="org.apache.fop.render.*"/>
      </group>
      <group title="Structural Rendering">
        <package name="org.apache.fop.render.rtf"/>
        <package name="org.apache.fop.render.mif"/>
      </group>
      <group title="Fonts">
        <package name="org.apache.fop.fonts"/>
        <package name="org.apache.fop.fonts.*"/>
      </group>
      <group title="Events">
        <package name="org.apache.fop.events"/>
        <package name="org.apache.fop.events.*"/>
      </group>
      <group title="Utility">
        <package name="org.apache.fop.hyphenation"/>
        <package name="org.apache.fop.tools"/>
        <package name="org.apache.fop.tools.*"/>
        <package name="org.apache.fop.image"/>
        <package name="org.apache.fop.image.*"/>
        <package name="org.apache.fop.text.*"/>
        <package name="org.apache.fop.util"/>
        <package name="org.apache.fop.util.*"/>
      </group>
      <group title="AFP library">
        <package name="org.apache.fop.afp"/>
        <package name="org.apache.fop.afp.*"/>
      </group>
      <group title="PDF library">
        <package name="org.apache.fop.pdf"/>
        <package name="org.apache.fop.svg"/>
      </group>
      <group title="RTFLib (formerly JFor) Subpackage Candidate">
        <package name="org.apache.fop.render.rtf.rtflib"/>
        <package name="org.apache.fop.render.rtf.rtflib.*"/>
      </group>
    </javadoc>
  </target>
  <target name="jar-javadocs" depends="javadocs" description="Generates a jar file containing the Javadocs">
    <jar jarfile="${build.dir}/${name}-${version}-javadoc.jar">
      <manifest>
        <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
      </manifest>
      <fileset dir="${build.javadocs.dir}"/>
      <metainf dir="${basedir}/.." includes="LICENSE,NOTICE"/>
    </jar>
  </target>
<!-- =================================================================== -->
<!-- Checkstyle                                                          -->
<!-- =================================================================== -->
  <property name="checkstyle.location" value="${lib-tools}/checkstyle-5.5-all.jar" />
  <property name="checkstyle.config" value="${core.checkstyle.dir}/checkstyle.xml" />
  <property name="checkstyle.suppressions.file" value="${core.checkstyle.dir}/suppressions.xml" />
  <path id="checkstyle-classpath">
    <pathelement location="${checkstyle.location}"/>
  </path>
  <condition property="checkstyle.avail">
    <and>
      <available classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
        <classpath refid="checkstyle-classpath"/>
      </available>
      <available file="${checkstyle.config}"/>
    </and>
  </condition>
  <target name="checkstyle-avail" unless="checkstyle.avail">
    <echo message="Checkstyle support NOT present. Please download it from http://checkstyle.sf.net/ and"/>
    <echo message="... please provide ${checkstyle.location}"/>
    <echo message="... please provide ${checkstyle.config}"/>
  </target>
  <target name="checkstyle" depends="package, checkstyle-avail" if="checkstyle.avail" description="Runs Checkstyle for a code quality report">
    <taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="checkstyle-classpath"/>
    <mkdir dir="${build.dir}"/>
    <checkstyle config="${checkstyle.config}" failonviolation="true" maxWarnings="0">
      <classpath>
        <path refid="checkstyle-classpath"/>
        <pathelement location="${build.classes.dir}"/>
        <pathelement location="${build.sandbox-classes.dir}"/>
        <pathelement location="${build.codegen-classes.dir}"/>
      </classpath>
      <fileset dir="${core.src.dir}" includes="**/*.java"/>
      <fileset dir="${events.src.dir}" includes="**/*.java"/>
      <fileset dir="${sandbox.src.dir}" includes="**/*.java"/>
      <fileset dir="${util.src.dir}" includes="**/*.java"/>
      <fileset dir="${test.dir}" includes="**/*.java"/>
      <formatter type="xml" toFile="${build.dir}/report_checkstyle.xml"/>
      <formatter type="plain"/>
    </checkstyle>
  </target>
<!-- =================================================================== -->
<!-- PMD                                                                 -->
<!-- =================================================================== -->
  <target name="pmd" depends="init" description="Runs PMD for a code quality report">
    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
      <classpath>
        <path refid="libs-build-classpath"/>
        <path refid="libs-tools-build-classpath"/>
      </classpath>
    </taskdef>
    <mkdir dir="${build.dir}"/>
    <pmd shortFilenames="true" targetjdk="${javac.target}">
      <ruleset>basic</ruleset>
      <ruleset>rulesets/migrating_to_14.xml</ruleset>
      <ruleset>sunsecure</ruleset>
      <formatter type="html" toFile="${build.dir}/report_pmd.html"/>
      <fileset dir="${src.java.dir}">
        <include name="**/*.java"/>
      </fileset>
    </pmd>
  </target>
  
  <target name="cpd" depends="init" description="Runs PMD/CDP for a code quality report">
    <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
      <classpath>
        <path refid="libs-build-classpath"/>
        <path refid="libs-tools-build-classpath"/>
      </classpath>
    </taskdef>
     <cpd minimumTokenCount="100" outputFile="${build.dir}/report_cpd.txt">
      <fileset dir="${src.java.dir}">
         <include name="**/*.java"/>
      </fileset>
    </cpd>
  </target>
<!-- =================================================================== -->
<!-- Findbugs                                                            -->
<!-- =================================================================== -->
  <target name="findbugs-maybe-describe-install" unless="findbugs.present">
    <echo message="Please download FINDBUGS from http://findbugs.sf.net/ and set property findbugs.home.dir"/>
    <echo message="in build-local.properties to the top-level directory of the binary distribution."/>
   </target>
  <target name="findbugs-avail">
    <condition property="findbugs.present">
      <and>
        <isset property="findbugs.home.dir"/>
        <available file="${findbugs.home.dir}" type="dir"/>
      </and>
    </condition>
    <condition property="findbugs.message" value="FINDBUGS Support PRESENT">
      <equals arg1="${findbugs.present}" arg2="true"/>
    </condition>
    <condition property="findbugs.message" value="FINDBUGS Support NOT Present">
      <not>
        <equals arg1="${findbugs.present}" arg2="true"/>
      </not>
    </condition>
    <echo message="${findbugs.message}"/>
    <antcall target="findbugs-maybe-describe-install"/>
  </target>
  <target name="findbugs-exec" depends="compile-java" if="findbugs.present">
    <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
      <classpath>
        <fileset dir="${findbugs.home.dir}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
    </taskdef>
    <findbugs home="${findbugs.home.dir}" output="${findbugs.output.format}" reportLevel="low" effort="max"
              outputFile="${build.dir}/report_findbugs.${findbugs.output.extension}" excludeFilter="${core.findbugs.dir}/exclusions.xml" jvmargs="-Xmx1024m" warningsProperty="findbugs.warnings">
      <sourcePath path="${src.java.dir}"/>
      <class location="${build.classes.dir}"/>
      <auxClasspath>
        <path refid="libs-build-classpath"/>
        <path refid="libs-tools-build-classpath"/>
        <path>
          <fileset dir="${ant.library.dir}">
            <include name="ant.jar"/>
            <include name="ant-launcher.jar"/>
          </fileset>
        </path>
      </auxClasspath>
    </findbugs>
    <fail if="findbugs.warnings"/>
  </target>
  <target name="findbugs-xml" depends="findbugs-avail" if="findbugs.present" description="Runs findbugs for a code quality report in XML">
    <property name="findbugs.output.format" value="xml"/>
    <property name="findbugs.output.extension" value="xml"/>
    <antcall target="findbugs-exec"/> 
  </target>
  <target name="findbugs-html" depends="findbugs-avail" if="findbugs.present" description="Runs findbugs for a code quality report in HTML">
    <property name="findbugs.output.format" value="html"/>
    <property name="findbugs.output.extension" value="html"/>
    <antcall target="findbugs-exec"/> 
  </target>
  <target name="findbugs" depends="findbugs-html" description="Runs findbugs for a code quality report in HTML"/>
<!-- =================================================================== -->
<!-- Creates the reports                                                 -->
<!-- =================================================================== -->
  <target name="reports" depends="checkstyle, pmd, cpd, findbugs" description="Runs all configured code quality reports"/>
<!-- =================================================================== -->
<!-- Creates the documentation - (CL20130210 moved to ASF-CMS)           -->
<!-- =================================================================== -->
  
<!-- =================================================================== -->
<!-- Nightly builds                                                      -->
<!-- =================================================================== -->
  <target name="junit-nightly-build" depends="junit-userconfig,junit-text-linebreak,junit-fotree">
    <fail>
      <condition>
        <or>
          <isset property="fop.junit.error"/>
          <isset property="fop.junit.failure"/>
        </or>
      </condition>
NOTE:
**************************************************************************
* One or more of the Junit tests had Failures or Errors or were skipped! *
*         Please check the output above for relevant messages.           *
*    Or use the "junit-reports" target to generate HTML test reports.    *
**************************************************************************
    </fail>
    <echo>All Junit tests passed!</echo>
  </target>
  <target name="nightly-build">
    <echo message="Build process now processed by Jenkins, see https://builds.apache.org/job/xmlgraphics-fop-maven/."/>
  </target>
<!-- =================================================================== -->
<!-- Generate examples                                                   -->
<!-- =================================================================== -->
  <target name="examples" depends="package" description="Generates the example files">
    <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="libs-run-classpath"/>
    <mkdir dir="${build.examples.dir}"/>
    <fop format="${build.property.examples.mime.type}" outdir="${build.examples.dir}" messagelevel="debug" basedir="${fo.examples.dir}" userconfig="${fo.examples.userconfig}" force="${fo.examples.force}">
      <fileset dir="${fo.examples.dir}">
        <include name="${fo.examples.include}"/>
      </fileset>
    </fop>
  </target>

<!-- =================================================================== -->
<!-- Generate unit tests                                                 -->
<!-- =================================================================== -->
  <target name="tests" depends="package" description="Generates the test files">
    <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="libs-run-classpath"/>
    <mkdir dir="${build.tests.dir}"/>
    <fop format="${build.property.tests.mime.type}" xsltfile="${test.dir}/layoutengine/testcase2fo.xsl" outdir="${build.tests.dir}" messagelevel="debug" basedir="${test.dir}" userconfig="${fo.examples.userconfig}" force="${xml.tests.force}">
      <fileset dir="${test.dir}">
        <include name="${xml.tests.include}"/>
      </fileset>
    </fop>
  </target>

<!-- =================================================================== -->
<!-- Helper task to generate source files that have already been         -->
<!-- checked into CVS.  For these files, CVS version is the official one -->
<!-- and may have updates that will *not* be generated by below.  This   -->
<!-- target should never be part of the normal build process.            -->
<!-- =================================================================== -->
  <target name="codegen-fo">
    <style in="${src.codegen.dir}/fo/constants.xml" style="${src.codegen.dir}/fo/constants.xsl" out="Constants.java"/>
    <style in="${src.codegen.dir}/fo/foelements.xml" style="${src.codegen.dir}/fo/property-sets.xsl" out="PropertySets.java"/>
  </target>

  <!-- =================================================================== -->
  <!-- Helper tasks to generate source files that have already been checked -->
  <!-- into the repository.  For these files, the version in the           -->
  <!-- repository is the official one and may have updates that will *not* -->
  <!-- be generated by below. This target should never be part of the      -->
  <!-- normal build process.                                               -->
  <!-- =================================================================== -->
  <target name="codegen-unicode" depends="compile-java">
    <mkdir dir="${build.codegen-classes.dir}"/>
    <javac destdir="${build.codegen-classes.dir}">
      <src path="${src.codegen.dir}/unicode/java"/>
      <classpath>
        <path refid="libs-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
        <pathelement location="${build.codegen-classes.dir}"/>
      </classpath>
    </javac>
    <java classname="org.apache.fop.text.linebreak.GenerateLineBreakUtils" classpath="${build.codegen-classes.dir}">
      <arg line="-o ${src.java.dir}/org/apache/fop/text/linebreak/LineBreakUtils.java"/>
    </java>
  </target>
  <target name="codegen-unicode-bidi" depends="compile-java">
    <mkdir dir="${build.codegen-classes.dir}"/>
    <javac destdir="${build.codegen-classes.dir}" includeAntRuntime="true">
      <src path="${src.codegen.dir}/unicode/java"/>
      <classpath>
        <path refid="libs-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
        <pathelement location="${build.codegen-classes.dir}"/>
      </classpath>
    </javac>
    <java classname="org.apache.fop.complexscripts.bidi.GenerateBidiClass" classpath="${build.codegen-classes.dir}">
      <arg line="-b http://www.unicode.org/Public/6.0.0/ucd/extracted/DerivedBidiClass.txt"/>
      <arg line="-o ${src.java.dir}/org/apache/fop/complexscripts/bidi/BidiClass.java"/>
    </java>
    <delete>
      <fileset dir="${test.java.dir}/org/apache/fop/complexscripts/bidi">
        <include name="**/BidiTestData*.ser"/>
      </fileset>
    </delete>
    <java classname="org.apache.fop.text.bidi.GenerateBidiTestData" classpath="${build.codegen-classes.dir}" fork="yes">
      <arg line="-v"/>
      <arg line="-i"/>
      <arg line="-b http://www.unicode.org/Public/6.0.0/ucd/BidiTest.txt"/>
      <arg line="-d http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt"/>
      <arg line="-o ${test.java.dir}/org/apache/fop/complexscripts/bidi/BidiTestData.java"/>
    </java>
  </target>
  <target name="resgen-complexscripts" depends="compile-java">
    <mkdir dir="${build.unit.tests.dir}"/>
    <javac destdir="${build.unit.tests.dir}" includeAntRuntime="true" memoryMaximumSize="1024m">
      <src path="${test.java.dir}/org/apache/fop/complexscripts/"/>
      <classpath>
        <path refid="libs-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
      </classpath>
    </javac>
    <java classname="org.apache.fop.complexscripts.scripts.arabic.GenerateArabicTestData">
      <classpath>
        <path refid="libs-build-classpath"/>
        <pathelement location="${build.classes.dir}"/>
        <pathelement location="${build.unit.tests.dir}"/>
      </classpath>
      <arg line="-c"/>
    </java>
  </target>
<!-- =================================================================== -->
<!-- Special target for Gump                                             -->
<!-- =================================================================== -->
  <target name="gump"/>
  <target name="gump-test"/>
<!-- =================================================================== -->
<!-- Clean targets                                                       -->
<!-- =================================================================== -->
  <target name="clean" description="Cleans the build directory">
    <delete dir="${build.dir}"/>
  </target>
  <target name="remove-cache" description="Removes the .fop cache directory">
    <delete dir="${user.home}/.fop" />
  </target>
<!-- =================================================================== -->
<!-- Local targets                                                       -->
<!-- =================================================================== -->
  <import file="build-local.targets.xml" optional="true"/>

</project>