aboutsummaryrefslogtreecommitdiffstats
path: root/external
ModeNameSize
d---------globalize183logstatsplain
d---------jquery-1.12.476logstatsplain
d---------jquery-2.2.476logstatsplain
d---------jquery-3.0.076logstatsplain
d---------jquery-3.1.076logstatsplain
d---------jquery-3.1.176logstatsplain
d---------jquery-3.2.076logstatsplain
d---------jquery-3.2.176logstatsplain
d---------jquery-3.3.076logstatsplain
d---------jquery-3.3.176logstatsplain
d---------jquery-3.4.076logstatsplain
d---------jquery-3.4.176logstatsplain
d---------jquery-3.5.076logstatsplain
d---------jquery-3.5.176logstatsplain
d---------jquery-3.6.076logstatsplain
d---------jquery-3.6.176logstatsplain
d---------jquery-3.6.276logstatsplain
d---------jquery-3.6.376logstatsplain
d---------jquery-3.6.476logstatsplain
d---------jquery-3.7.076logstatsplain
d---------jquery-3.7.176logstatsplain
d---------jquery-custom80logstatsplain
d---------jquery-migrate-1.x84logstatsplain
d---------jquery-migrate-3.x84logstatsplain
d---------jquery-mousewheel87logstatsplain
d---------jquery-simulate85logstatsplain
d---------jquery119logstatsplain
d---------qunit155logstatsplain
d---------requirejs38logstatsplain
='n335' href='#n335'>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 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961
<?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.
-->
<!--
    This build was tested with ant 1.9.4 although it will probably work with
    other versions, however at least 1.8.0 is required.


    updated to forrest 0.9:
    To build the documentation you will need to install forrest and set
    the FORREST_HOME environment variable.

    Since POI 4.0 you will need JDK 1.8 or newer to build and run POI.

    Some people may find the tests hang when run through Ant. If this
    happens to you, try giving Ant some more memory when you run it, eg:
          ANT_OPTS="-Xmx1024m" ant test

 -->
<project name="POI Build" default="help" basedir="."
    xmlns:mvn="antlib:org.apache.maven.artifact.ant"
    xmlns:openpgp="antlib:org.apache.commons.openpgp.ant"
    xmlns:staging="antlib:org.sonatype.nexus.ant.staging"
    xmlns:if="ant:if"
    xmlns:unless="ant:unless">

    <description>The Apache POI project Ant build.</description>

    <property name="version.id" value="5.4.0-SNAPSHOT"/>
    <property name="release.rc" value=""/>

    <property environment="env"/>
    <!-- the repository to download jars from -->
    <property name="repository.m2" value="https://repo1.maven.org/maven2"/>
    <property name="repository.pentaho" value="https://nexus.pentaho.org/"/>

    <property name="main.lib" location="${basedir}/lib/main"/>
    <property name="main-tests.lib" location="${basedir}/lib/main-tests"/>
    <property name="ooxml.lib" location="${basedir}/lib/ooxml"/>
    <property name="ooxml-tests.lib" location="${basedir}/lib/ooxml-tests"/>
    <property name="ooxml-provided.lib" location="${basedir}/lib/ooxml-provided"/>
    <property name="ooxml-batik.lib" location="${basedir}/lib/ooxml-batik"/>
    <property name="util.lib" location="${basedir}/lib/util"/>


    <!-- compiler options -->
    <property name="jdk.version.source" value="1.8" description="JDK version of source code"/>
    <property name="jdk.version.class" value="1.8" description="JDK version of generated class files"/>
    <property name="compile.debug" value="true"/>

    <condition property="isIBMVM">
        <contains string="${java.vendor}" substring="IBM" casesensitive="false"/>
    </condition>

    <condition property="isJava8" else="false">
        <equals arg1="${ant.java.version}" arg2="1.8"/>
    </condition>

    <!-- add addOpens parameter for Java 9 and higher -->
    <condition property="addOpens">
        <not><matches pattern="^1\..*" string="${java.version}"/></not>
    </condition>

    <!-- add addOpens parameter for Java 10 -->
    <condition property="addOpens10">
        <matches pattern="^10\..*" string="${java.version}"/>
    </condition>

    <!-- issue warnings if source code contains unmappable characters for encoding ASCII  -->
    <property name="java.source.encoding" value="UTF-8"/>

    <macrodef name="propertyreset">
        <attribute name="name"/>
        <attribute name="value"/>
        <sequential>
            <mkdir dir="poi-excelant/build/poi-ant-contrib"/>
            <javac srcdir="poi-excelant/src/poi-ant-contrib/java" destdir="poi-excelant/build/poi-ant-contrib" includeantruntime="true" excludes="Junit5Progress.java"/>
            <taskdef name="PropertyResetHelper" classname="PropertyReset" classpath="poi-excelant/build/poi-ant-contrib"/>
            <PropertyResetHelper name="@{name}" value="@{value}" />
        </sequential>
    </macrodef>

    <!--
      JVM system properties for running tests,
      user.language and user.country are required as we have locale-sensitive formatters
    -->
    <property name="testpattern" value="Test*"/> <!--note: this excludes BaseTest* -->
    <property name="POI.testdata.path" location="test-data"/>
    <property name="java.awt.headless" value="true"/>
    <property name="java.locale.providers" value="JRE,CLDR"/>
    <property name="additionaljar" value=""/>
    <propertyreset name="user.language" value="en"/>
    <propertyreset name="user.country" value="US"/>
    <condition property="http_proxy" value="${env.http_proxy}" else="">
        <isset property="env.http_proxy"/>
    </condition>
    <!-- Fix for strange woodstox references in gump build -->
    <property name="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
    <property name="tempdir" value="build/tmp"/>

    <!-- Main: -->
    <property name="main.resources.main" value="poi/src/main/resources"/>
    <property name="main.src" location="poi/src/main/java"/>
    <property name="main.src.test" location="poi/src/test/java"/>
    <property name="main.resources.test" location="poi/src/test/resources"/>
    <property name="main.documentation" value="src/documentation"/>
    <property name="main.output.dir" location="poi/build/classes/ant/java"/>
    <property name="main.output.test.dir" location="poi/build/test-classes"/>
    <property name="main.reports.test" location="poi/build/test-results"/>
    <property name="main.testokfile" location="poi/build/testokfile.txt"/>
    <property name="main.output.gen-sources.dir" location="poi/build/generated-sources"/>
    <property name="main.version.template" location="poi/src/main/version/Version.java.template"/>
    <property name="main.version.java" location="${main.output.gen-sources.dir}/org/apache/poi/Version.java"/>

    <!-- Scratchpad: -->
    <property name="scratchpad.resources.main" value="poi-scratchpad/src/main/resources"/>
    <property name="scratchpad.src" location="poi-scratchpad/src/main/java"/>
    <property name="scratchpad.src.test" location="poi-scratchpad/src/test/java"/>
    <property name="scratchpad.resources.test" location="poi-scratchpad/src/main/resources"/>
    <property name="scratchpad.reports.test" location="poi-scratchpad/build/test-results"/>
    <property name="scratchpad.output.dir" location="poi-scratchpad/build/classes/ant/java"/>
    <property name="scratchpad.output.test.dir" location="poi-scratchpad/build/test-classes"/>
    <property name="scratchpad.testokfile" location="poi-scratchpad/build/testokfile.txt"/>

    <!-- Examples: -->
    <property name="examples.src" location="poi-examples/src/main/java"/>
    <property name="examples.output.dir" location="poi-examples/build/classes/ant/java"/>

    <!-- OOXML support: -->
    <property name="ooxml.src" location="poi-ooxml/src/main/java"/>
    <property name="ooxml.resources.main" value="poi-ooxml/src/main/resources"/>
    <property name="ooxml.src.test" location="poi-ooxml/src/test/java"/>
    <property name="ooxml.resources.test" location="poi-ooxml/src/test/resources"/>
    <property name="ooxml.reports.test" location="poi-ooxml/build/test-results"/>
    <property name="ooxml.output.dir" location="poi-ooxml/build/classes/ant/java"/>
    <property name="ooxml.output.test.dir" location="poi-ooxml/build/test-classes"/>
    <property name="ooxml.testokfile" location="poi-ooxml/build/testokfile.txt"/>

    <property name="ooxml.lite.agent" location="build/dist/maven/poi-ooxml-lite-agent/poi-ooxml-lite-agent-${version.id}.jar"/>
    <property name="ooxml.lite.report" location="src/resources/ooxml-lite-report"/>
    <property name="ooxml.lite.jar" location="build/dist/maven/poi-ooxml-lite/poi-ooxml-lite-${version.id}.jar"/>
    <property name="ooxml.lite.includes" value="^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"/>
    <property name="ooxml.lite.output.dir" location="poi-ooxml-lite-agent/build/classes/ant/java"/>


    <!-- Integration testing: -->
    <property name="integration.src.test" location="poi-integration/src/test/java"/>
    <property name="integration.resources.test" location="poi-integration/src/test/resources"/>
    <property name="integration.reports.test" location="poi-integration/build/test-results"/>
    <property name="integration.output.test.dir" location="poi-integration/build/test-classes"/>
    <property name="integration.testokfile" location="poi-integration/build/testokfile.txt"/>

    <!-- Excelant: -->
    <property name="excelant.resource.main" value="poi-excelant/src/main/resources"/>
    <property name="excelant.src" location="poi-excelant/src/main/java"/>
    <property name="excelant.src.test" location="poi-excelant/src/test/java"/>
    <property name="excelant.resources.test" location="poi-excelant/src/test/resources"/>
    <property name="excelant.reports.test" location="poi-excelant/build/test-results"/>
    <property name="excelant.output.dir" location="poi-excelant/build/classes/ant/java"/>
    <property name="excelant.output.test.dir" location="poi-excelant/build/test-classes"/>
    <property name="excelant.testokfile" location="poi-excelant/build/testokfile.txt"/>

    <macrodef name="dependency">
        <attribute name="prefix"/>
        <attribute name="artifact"/>
        <attribute name="usage"/>
        <attribute name="packaging" default="jar"/>
        <attribute name="repo" default="${repository.m2}"/>
        <attribute name="snapshot" default=""/>
        <attribute name="query" default=""/>
        <attribute name="target" default=""/>
        <attribute name="url" default=""/>

        <sequential>
            <local name="groupDir"/>
            <loadresource property="groupDir">
                <string>@{artifact}</string>
                <filterchain>
                    <replaceregex pattern="([^:]+).*" replace="\1"/>
                    <replaceregex pattern="\." replace="/" flags="g"/>
                </filterchain>
            </loadresource>

            <local name="artifactId"/>
            <loadresource property="artifactId">
                <string>@{artifact}</string>
                <filterchain>
                    <replaceregex pattern="[^:]+:([^:]+).*" replace="\1"/>
                </filterchain>
            </loadresource>

            <local name="versionDir"/>
            <loadresource property="versionDir">
                <string>@{artifact}</string>
                <filterchain>
                    <replaceregex pattern="[^:]+:[^:]+:([^:]+).*" replace="\1"/>
                </filterchain>
            </loadresource>

            <local name="classifier"/>
            <loadresource property="classifier">
                <string>@{artifact}</string>
                <filterchain>
                    <replaceregex pattern="[^:]+:[^:]+:[^:]+:?([^:]*)" replace="\1"/>
                    <replaceregex pattern="(.+)" replace="-\1"/>
                </filterchain>
            </loadresource>
            <property name="classifier" value=""/>

            <local name="version"/>
            <property name="version" value="${versionDir}" if:blank="@{snapshot}"/>
            <property name="version" value="@{snapshot}"/>

            <local name="usageDir"/>
            <loadresource property="usageDir">
                <string>@{usage}</string>
                <filterchain>
                    <replaceregex pattern="^([^/])" replace="/lib/\1"/>
                    <prefixlines prefix="${basedir}"/>
                </filterchain>
            </loadresource>

            <local name="jarName"/>
            <property name="jarName" value="${artifactId}-${version}${classifier}.@{packaging}"/>

            <!-- delete old versions -->
            <delete failonerror="false">
                <fileset dir="${usageDir}" excludes="${jarName}">
                    <filename regex="^${artifactId}-[0-9].*${classifier}\.@{packaging}"/>
                </fileset>
            </delete>

            <local name="jarLoc"/>
            <property name="jarLoc" value="${usageDir}/@{target}" unless:blank="@{target}"/>
            <property name="jarLoc" value="${usageDir}/${jarName}"/>

            <local name="urlLoc"/>
            <property name="urlLoc" value="@{url}" unless:blank="@{url}"/>
            <property name="urlLoc" value="@{repo}/${groupDir}/${artifactId}/${versionDir}/${jarName}@{query}"/>

            <property name="@{prefix}.@{packaging}" value="${jarLoc}"/>
            <property name="@{prefix}.url" value="${urlLoc}"/>

            <!-- TODO: add library to a queue for downloading ... -->
        </sequential>
    </macrodef>


    <!-- jars in the /lib directory, see the fetch-jars target-->
    <dependency prefix="main.commons-codec" artifact="commons-codec:commons-codec:1.17.1" usage="main"/>
    <dependency prefix="main.commons-collections4" artifact="org.apache.commons:commons-collections4:4.4" usage="main"/>
    <dependency prefix="main.commons-math3" artifact="org.apache.commons:commons-math3:3.6.1" usage="main"/>
    <dependency prefix="main.commons-io" artifact="commons-io:commons-io:2.17.0" usage="main"/>
    <dependency prefix="main.com.zaxxer" artifact="com.zaxxer:SparseBitSet:1.3" usage="main"/>
    <dependency prefix="main.log4j-api" artifact="org.apache.logging.log4j:log4j-api:2.24.1" usage="main"/>

    <dependency prefix="main.junit-api" artifact="org.junit.jupiter:junit-jupiter-api:5.11.3" usage="main-tests"/>
    <dependency prefix="main.junit-jengine" artifact="org.junit.jupiter:junit-jupiter-engine:5.11.3" usage="main-tests"/>
    <dependency prefix="main.junit-params" artifact="org.junit.jupiter:junit-jupiter-params:5.11.3" usage="main-tests"/>
    <dependency prefix="main.junit-opentest4j" artifact="org.opentest4j:opentest4j:1.2.0" usage="main-tests"/>
    <dependency prefix="main.junit-apiguardian" artifact="org.apiguardian:apiguardian-api:1.1.2" usage="main-tests"/>
    <dependency prefix="main.junit-pcommons" artifact="org.junit.platform:junit-platform-commons:1.11.0" usage="main-tests"/>
    <dependency prefix="main.junit-pengine" artifact="org.junit.platform:junit-platform-engine:1.11.0" usage="main-tests"/>
    <dependency prefix="main.junit-plauncher" artifact="org.junit.platform:junit-platform-launcher:1.11.0" usage="main-tests"/>


    <dependency prefix="main.jmh" artifact="org.openjdk.jmh:jmh-core:1.35" usage="main-tests"/>
    <dependency prefix="main.jmhAnnotation" artifact="org.openjdk.jmh:jmh-generator-annprocess:1.35" usage="main-tests"/>
    <dependency prefix="main.hamcrest" artifact="org.hamcrest:hamcrest:3.0" usage="main-tests"/>
    <dependency prefix="main.xmlunit" artifact="org.xmlunit:xmlunit-core:2.10.0" usage="main-tests"/>
    <dependency prefix="main.mockito" artifact="org.mockito:mockito-core:4.11.0" usage="main-tests"/>
    <dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.15.10" usage="main-tests"/>
    <dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.15.10" usage="main-tests"/>
    <dependency prefix="main.objenesis" artifact="org.objenesis:objenesis:3.1" usage="main-tests"/>
    <dependency prefix="main.log4j-core" artifact="org.apache.logging.log4j:log4j-core:2.24.1" usage="main-tests"/>
    <dependency prefix="main.commons-logging" artifact="commons-logging:commons-logging:1.2" usage="main-tests"/>

    <dependency prefix="main.ant" artifact="org.apache.ant:ant:1.10.15" usage="excelant"/>
    <dependency prefix="main.antlauncher" artifact="org.apache.ant:ant-launcher:1.10.15" usage="excelant"/>

    <!-- xml signature libs - not part of the distribution -->
    <dependency prefix="dsig.xmlsec" artifact="org.apache.santuario:xmlsec:3.0.4" usage="ooxml-provided"/>
    <dependency prefix="dsig.bouncycastle-prov" artifact="org.bouncycastle:bcprov-jdk18on:1.79" usage="ooxml-provided"/>
    <dependency prefix="dsig.bouncycastle-pkix" artifact="org.bouncycastle:bcpkix-jdk18on:1.79" usage="ooxml-provided"/>
    <dependency prefix="dsig.bouncycastle-util" artifact="org.bouncycastle:bcutil-jdk18on:1.79" usage="ooxml-provided"/>
    <!-- only used for signing the release - not used with the ooxml signatures -->
    <dependency prefix="dsig.bouncycastle-bcpg" artifact="org.bouncycastle:bcpg-jdk18on:1.79" usage="util"/>
    <dependency prefix="ooxml.test.stax2" artifact="org.codehaus.woodstox:stax2-api:4.2.1" usage="ooxml-provided"/>

    <!-- svg/batik/pdf libs - not part of the distribution - move batik to its own directory because of JPMS module-path issues -->
    <dependency prefix="svg.xml-apis-ext" artifact="xml-apis:xml-apis-ext:1.3.04" usage="ooxml-batik"/>
    <dependency prefix="svg.xmlgraphics-commons" artifact="org.apache.xmlgraphics:xmlgraphics-commons:2.9" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-anim" artifact="org.apache.xmlgraphics:batik-anim:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-awt-util" artifact="org.apache.xmlgraphics:batik-awt-util:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-bridge" artifact="org.apache.xmlgraphics:batik-bridge:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-codec" artifact="org.apache.xmlgraphics:batik-codec:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-constants" artifact="org.apache.xmlgraphics:batik-constants:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-css" artifact="org.apache.xmlgraphics:batik-css:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-dom" artifact="org.apache.xmlgraphics:batik-dom:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-ext" artifact="org.apache.xmlgraphics:batik-ext:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-gvt" artifact="org.apache.xmlgraphics:batik-gvt:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-i18n" artifact="org.apache.xmlgraphics:batik-i18n:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-parser" artifact="org.apache.xmlgraphics:batik-parser:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-script" artifact="org.apache.xmlgraphics:batik-script:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-shared-resources" artifact="org.apache.xmlgraphics:batik-shared-resources:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-svg-dom" artifact="org.apache.xmlgraphics:batik-svg-dom:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-svggen" artifact="org.apache.xmlgraphics:batik-svggen:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-svgrasterizer" artifact="org.apache.xmlgraphics:batik-svgrasterizer:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-transcoder" artifact="org.apache.xmlgraphics:batik-transcoder:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-util" artifact="org.apache.xmlgraphics:batik-util:1.18" usage="ooxml-batik"/>
    <dependency prefix="svg.batik-xml" artifact="org.apache.xmlgraphics:batik-xml:1.18" usage="ooxml-batik"/>
    <dependency prefix="pdf.pdfbox" artifact="org.apache.pdfbox:pdfbox:3.0.3" usage="ooxml-provided"/>
    <dependency prefix="pdf.pdfbox.io" artifact="org.apache.pdfbox:pdfbox-io:3.0.3" usage="ooxml-provided"/>
    <dependency prefix="pdf.fontbox" artifact="org.apache.pdfbox:fontbox:3.0.3" usage="ooxml-provided"/>
    <dependency prefix="pdf.graphics2d" artifact="de.rototor.pdfbox:graphics2d:3.0.2" usage="ooxml-provided"/>

    <!-- jars in the ooxml-lib directory, see the fetch-ooxml-jars target-->
    <dependency prefix="ooxml.curvesapi" artifact="com.github.virtuald:curvesapi:1.08" usage="ooxml"/>
    <dependency prefix="ooxml.xmlbeans" artifact="org.apache.xmlbeans:xmlbeans:5.2.2" usage="ooxml"/>
    <dependency prefix="ooxml.commons-compress" artifact="org.apache.commons:commons-compress:1.27.1" usage="ooxml"/>
    <dependency prefix="ooxml.commons-lang3" artifact="org.apache.commons:commons-lang3:3.12.0" usage="ooxml"/>

    <!-- jars in the ooxml-test-lib directory, see the fetch-ooxml-jars target-->
    <dependency prefix="ooxml.test.reflections" artifact="org.reflections:reflections:0.10.2" usage="ooxml-tests"/>
    <dependency prefix="ooxml.test.guava" artifact="com.google.guava:guava:33.3.0-jre" usage="ooxml-tests"/>
    <dependency prefix="ooxml.test.javassist" artifact="org.javassist:javassist:3.27.0-GA" usage="ooxml-tests"/>
    <dependency prefix="ooxml.test.slf4j-api" artifact="org.slf4j:slf4j-api:2.0.16" usage="ooxml-tests"/>
    <dependency prefix="ooxml.test.opczip" artifact="com.github.rzymek:opczip:1.2.0" usage="ooxml-tests"/>

    <!-- coverage libs -->
    <dependency prefix="jacoco" artifact="org.jacoco:jacoco:0.8.11" usage="util" packaging="zip"/>
    <dependency prefix="asm" artifact="org.ow2.asm:asm:9.5" usage="util"/>
    <dependency prefix="asm-commons" artifact="org.ow2.asm:asm-commons:9.5" usage="util"/>
    <dependency prefix="asm-tree" artifact="org.ow2.asm:asm-tree:9.5" usage="util"/>

    <!-- license and api checks -->
    <dependency prefix="rat" artifact="org.apache.rat:apache-rat:0.16.1" usage="util"/>
    <dependency prefix="forbidden" artifact="de.thetaphi:forbiddenapis:3.5.1" usage="util"/>

    <!-- See https://www.ecma-international.org/publications/standards/Ecma-376.htm -->
    <!-- "Copy these file(s), free of charge" -->
    <property name="ooxml-schema.output.dir" location="poi-ooxml-full/build/classes/ant/java"/>
    <property name="ooxml-schema.output.test.dir" location="poi-ooxml-full/build/test-classes"/>
    <property name="ooxml-schema.output.gen-sources.dir" location="poi-ooxml-full/build/generated-sources"/>
    <property name="ooxml-schema.output.gen-classes.dir" location="poi-ooxml-full/build/generated-classes"/>
    <property name="ooxml.xsds.izip.1" value="${basedir}/poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/OfficeOpenXML-XMLSchema-Transitional.zip"/>
    <property name="ooxml.xsds.src.dir" location="poi-ooxml-full/build/xsds"/>
    <property name="ooxml.xsds.src.jar" location="build/dist/maven/poi-ooxml-full/poi-ooxml-full-${version.id}-sources.jar"/>
    <property name="ooxml.xsds.jar" location="build/dist/maven/poi-ooxml-full/poi-ooxml-full-${version.id}.jar"/>

    <!-- additional schemas are packed into the poi schemas jar, -->
    <!-- so we don't have to care about a separate versioning of the original ooxml schemas -->
    <property name="ooxml.xsds.izip.2" value="${basedir}/poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/OpenPackagingConventions-XMLSchema.zip"/>
    <property name="ooxml.security.xsd.dir" location="poi-ooxml-full/src/main/xmlschema/org/apache/poi/poifs/crypt"/>
    <property name="ooxml.visio.xsd.dir" location="poi-ooxml-full/src/main/xmlschema/org/apache/poi/xdgf"/>
    <property name="ooxml.schema.xsdconfig.dir" location="poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas"/>

    <!-- Coverage -->
    <property name="coverage.dir" value="build/coverage"/>
    <!-- Exclude some uninteresting classes from coverage-instrumentation as we do not want to measure coverage in those packages anyway -->
    <property name="coverage.excludes" value="org.openxmlformats.*:com.*:org.junit.*:junit.*:org.etsi.*:org.w3.*:org.slf4j.*:org.apache.logging.log4j.*:org.hamcrest.*:org.bouncycastle.*:org.apache.xmlbeans.*:org.apache.tools.*:org.apache.commons.*:org.apache.jcp.*:sun.*:schemaorg_apache_xmlbeans.*"/>

    <property name="file.leak.detector" value="-Dthis.is.a.dummy=true"/>

    <!-- Apache RAT license check properties -->
    <property name="rat.reportdir" value="build/rat"/>
    <property name="rat.report" value="${rat.reportdir}/report.txt"/>

    <!-- build and distro settings -->
    <property name="jar.name" value="apache-poi"/>
    <property name="build.site" location="build/site"/>
    <property name="javadocs.report.dir" location="${build.site}/apidocs/dev"/>
    <property name="dist.dir" location="build/dist"/>
    <property name="halt.on.test.failure" value="true"/>

    <!-- helper jars for pgp signing, building and nexus staging -->
    <dependency prefix="dist.commons-openpgp" artifact="org.apache.commons:commons-openpgp:1.0-SNAPSHOT" usage="util"
        repo="https://repository.apache.org/content/groups/snapshots" snapshot="1.0-20190121.221905-12"/>
    <dependency prefix="dist.nexus-staging" artifact="org.sonatype.nexus.ant:nexus-staging-ant-tasks:1.6.3:uber" usage="util"/>

    <!-- jars required for maven helper targets -->
    <dependency prefix="maven.ant" artifact="org.apache.maven:maven-ant-tasks:2.1.3" usage="util"/>

    <propertyset id="junit.properties">
        <propertyref name="POI.testdata.path"/>
        <propertyref name="java.awt.headless"/>
        <propertyref name="http_proxy"/>
        <propertyref name="additionaljar"/>
        <propertyref name="user.language"/>
        <propertyref name="user.country"/>
        <propertyref name="javax.xml.stream.XMLInputFactory"/>
        <!-- required for Java 9 compilation -->
        <propertyref name="java.locale.providers"/>
        <!-- to detect if we are running on slow Gump VM -->
        <propertyref name="version.id"/>
        <propertyref name="scratchpad.ignore"/>
    </propertyset>

    <path id="main.classpath">
        <pathelement location="${main.commons-codec.jar}"/>
        <pathelement location="${main.commons-collections4.jar}"/>
        <pathelement location="${main.commons-math3.jar}"/>
        <pathelement location="${main.commons-io.jar}"/>
        <pathelement location="${main.com.zaxxer.jar}"/>
        <pathelement location="${main.log4j-api.jar}"/>
    </path>

    <!-- some libraries should only be required for compiling/running tests -->
    <path id="test.jar.classpath">
        <pathelement location="${main.junit-api.jar}"/>
        <pathelement location="${main.junit-jengine.jar}"/>
        <pathelement location="${main.junit-params.jar}"/>
        <pathelement location="${main.junit-plauncher.jar}"/>
        <pathelement location="${main.junit-pengine.jar}"/>
        <pathelement location="${main.junit-pcommons.jar}"/>
        <pathelement location="${main.junit-opentest4j.jar}"/>
        <pathelement location="${main.junit-apiguardian.jar}"/>
        <pathelement location="${main.jmh.jar}"/>
        <pathelement location="${main.jmhAnnotation.jar}"/>
        <pathelement location="${main.hamcrest.jar}"/>
        <pathelement location="${main.xmlunit.jar}"/>
        <pathelement location="${main.mockito.jar}"/>
        <pathelement location="${main.byte-buddy.jar}"/>
        <pathelement location="${main.byte-buddy-agent.jar}"/>
        <pathelement location="${main.objenesis.jar}"/>
        <pathelement location="${main.log4j-core.jar}"/>
        <pathelement location="${main.commons-logging.jar}"/>
    </path>

    <path id="scratchpad.classpath">
        <path refid="main.classpath"/>
        <pathelement location="${main.output.dir}"/>
    </path>

    <path id="ooxml.xmlsec.classpath">
        <pathelement location="${dsig.xmlsec.jar}"/>
        <pathelement location="${dsig.bouncycastle-prov.jar}"/>
        <pathelement location="${dsig.bouncycastle-pkix.jar}"/>
        <pathelement location="${dsig.bouncycastle-util.jar}"/>
    </path>

    <path id="ooxml.base.classpath">
        <pathelement location="${ooxml.curvesapi.jar}"/>
        <pathelement location="${ooxml.xmlbeans.jar}"/>
        <pathelement location="${ooxml.commons-compress.jar}"/>
        <pathelement location="${ooxml.commons-lang3.jar}"/>
        <path refid="main.classpath"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${ooxml.test.guava.jar}"/>
        <pathelement location="${ooxml.test.opczip.jar}"/>
        <!-- classes are omitted on test cases outside the xml-dsign area to avoid classpath poisoning -->
        <!--path refid="ooxml.xmlsec.classpath"/-->
        <!-- Used only for ExtractorFactory, see #57963 -->
        <pathelement location="${scratchpad.output.dir}" unless:true="${scratchpad.ignore}"/>
    </path>

    <path id="batik.classpath">
        <pathelement location="${svg.batik-anim.jar}"/>
        <pathelement location="${svg.batik-awt-util.jar}"/>
        <pathelement location="${svg.batik-bridge.jar}"/>
        <pathelement location="${svg.batik-codec.jar}"/>
        <pathelement location="${svg.batik-constants.jar}"/>
        <pathelement location="${svg.batik-css.jar}"/>
        <pathelement location="${svg.batik-dom.jar}"/>
        <pathelement location="${svg.batik-ext.jar}"/>
        <pathelement location="${svg.batik-gvt.jar}"/>
        <pathelement location="${svg.batik-i18n.jar}"/>
        <pathelement location="${svg.batik-parser.jar}"/>
        <pathelement location="${svg.batik-script.jar}"/>
        <pathelement location="${svg.batik-shared-resources.jar}"/>
        <pathelement location="${svg.batik-svg-dom.jar}"/>
        <pathelement location="${svg.batik-svggen.jar}"/>
        <pathelement location="${svg.batik-svgrasterizer.jar}"/>
        <pathelement location="${svg.batik-transcoder.jar}"/>
        <pathelement location="${svg.batik-util.jar}"/>
        <pathelement location="${svg.batik-xml.jar}"/>
        <!-- causes module conflicts with JDK 11+: pathelement location="${svg.xml-apis-ext.jar}"/-->
        <pathelement location="${svg.xmlgraphics-commons.jar}"/>
    </path>

    <path id="pdfbox.classpath">
        <pathelement location="${pdf.pdfbox.jar}"/>
        <pathelement location="${pdf.pdfbox.io.jar}"/>
        <pathelement location="${pdf.fontbox.jar}"/>
        <pathelement location="${pdf.graphics2d.jar}"/>
    </path>

    <path id="ooxml.classpath">
        <pathelement location="${ooxml.xsds.jar}"/>
        <path refid="ooxml.base.classpath"/>
        <path refid="batik.classpath"/>
        <path refid="pdfbox.classpath"/>
    </path>

    <path id="ooxml.lite.verify.classpath">
        <pathelement location="build/dist/maven/poi-ooxml-lite/poi-ooxml-lite-${version.id}.jar"/>
        <path refid="ooxml.base.classpath"/>
    </path>

    <path id="test.ooxml.reflections.classpath">
        <pathelement location="${ooxml.test.reflections.jar}"/>
        <pathelement location="${ooxml.test.guava.jar}"/>
        <pathelement location="${ooxml.test.javassist.jar}"/>
    </path>

    <path id="test.ooxml.lite.verify.classpath">
        <path refid="ooxml.lite.verify.classpath"/>
        <path refid="ooxml.xmlsec.classpath"/>
        <path refid="test.jar.classpath"/>
        <pathelement location="${ooxml.output.dir}"/>
        <pathelement location="${ooxml.output.test.dir}"/>
        <pathelement location="${main.output.test.dir}"/>
        <pathelement location="${additionaljar}"/>
    </path>

    <path id="examples.classpath">
        <path refid="main.classpath"/>
        <pathelement location="${main.output.dir}"/>
        <pathelement location="${scratchpad.output.dir}" unless:true="${scratchpad.ignore}"/>
    </path>

    <path id="excelant.classpath">
        <path refid="ooxml.classpath"/>
        <pathelement location="${main.ant.jar}"/>
        <pathelement location="${ooxml.output.dir}"/>
    </path>

    <path id="javadoc.classpath">
        <path refid="main.classpath"/>
        <path refid="scratchpad.classpath"/>
        <path refid="ooxml.classpath"/>
        <path refid="ooxml.xmlsec.classpath"/>
        <path refid="test.jar.classpath"/>
        <pathelement location="${main.log4j-api.jar}"/>
        <path path="${env.CLASSPATH}"/>
        <path path="${svg.xml-apis-ext.jar}"/>
    </path>

    <patternset id="exclude-scratchpad-test">
        <exclude name="**/TestExtractorFactory.class"/>
        <exclude name="**/TestEmbedOLEPackage.class"/>
        <exclude name="**/TestHxxFEncryption.class"/>
    </patternset>

    <!-- Prints POI's Ant usage help -->
    <target name="help" description="Prints Apache POI's Ant usage help">
      <echo>
  This is POI ${version.id}
  Java Version ${ant.java.version}/${java.version}, isJava8: ${isJava8}
  Timestamp ${DSTAMP}
  The main targets of interest are:
    - clean       Erase all build work products (ie. everything in the build directory)
    - compile     Compile all files from main, ooxml and scratchpad
    - test        Run all unit tests from main, ooxml and scratchpad
    - jar         Produce jar files
    - assemble    Produce the zipped distribution files
    - site        Generate all documentation (Requires Apache Forrest)
    - dist        Create a distribution (Requires Apache Forrest)
        </echo>
    </target>

    <tstamp>
        <format property="tstamp.year" pattern="yyyy"/>
    </tstamp>

    <target name="init" depends="fetch-jars,fetch-ooxml-jars" description="Initialization run before other targets.">
        <mkdir dir="build"/>
        <mkdir dir="${main.output.dir}"/>
        <mkdir dir="${main.output.test.dir}"/>
        <mkdir dir="${main.reports.test}"/>
        <mkdir dir="${scratchpad.output.dir}"/>
        <mkdir dir="${scratchpad.output.test.dir}"/>
        <mkdir dir="${scratchpad.reports.test}"/>
        <mkdir dir="${ooxml.output.dir}"/>
        <mkdir dir="${ooxml.output.test.dir}"/>
        <mkdir dir="${ooxml-schema.output.dir}"/>
        <mkdir dir="${ooxml-schema.output.test.dir}"/>
        <mkdir dir="${ooxml-schema.output.gen-sources.dir}"/>
        <mkdir dir="${ooxml-schema.output.gen-classes.dir}"/>
        <mkdir dir="${ooxml.reports.test}"/>
        <mkdir dir="${excelant.output.dir}"/>
        <mkdir dir="${excelant.output.test.dir}"/>
        <mkdir dir="${excelant.reports.test}"/>
        <mkdir dir="${examples.output.dir}"/>
        <mkdir dir="${integration.output.test.dir}"/>
        <mkdir dir="${integration.reports.test}"/>
        <mkdir dir="${dist.dir}"/>
        <mkdir dir="${build.site}"/>

        <echo message="Using Ant: ${ant.version} from ${ant.home}, Ant detected Java ${ant.java.version} (may be different than actual Java sometimes...)" />
        <echo message="Using Java: ${java.version}/${java.runtime.version}/${java.vm.version}/${java.vm.name} from ${java.vm.vendor} on ${os.name}: ${os.version}" />
        <echo message="Building Apache POI version ${version.id} and RC: ${release.rc}, isJava8: ${isJava8}" />
        <echo if:true="${isJava8}">Compiling for Java 8</echo>
        <echo unless:true="${isJava8}">Compiling for Java 9+</echo>

        <loadresource property="RELEASE_TAG">
            <string>REL_${version.id}</string>
            <filterchain>
                <replaceregex pattern="\W" replace="_" flags="g"/>
            </filterchain>
        </loadresource>
    </target>

    <target name="clean" description="Remove generated artefacts">
        <delete dir="build"/>
        <delete dir="poi-examples/build"/>
        <delete dir="poi-excelant/build"/>
        <delete dir="poi-integration/build"/>
        <delete dir="poi/build"/>
        <delete dir="poi-ooxml/build"/>
        <delete dir="poi-ooxml-full/build"/>
        <delete dir="poi-scratchpad/build"/>
    </target>

    <macrodef name="downloadfile">
        <attribute name="src"/>
        <attribute name="dest"/>
        <sequential>
            <local name="destdir"/>
            <dirname property="destdir" file="@{dest}"/>
            <mkdir dir="${destdir}"/>
            <get src="@{src}" dest="@{dest}" skipexisting="true"/>
        </sequential>
    </macrodef>

    <target name="check-jars">
        <!-- remove previous versions of third-party jars to prevent them from lingering around,
            we often had hard-to-find build/CI-problems because of these! -->
        <mkdir dir="${main.lib}"/>
        <mkdir dir="${ooxml.lib}"/>
        <mkdir dir="${ooxml-tests.lib}"/>

        <!-- remove jars from previous versions, but not the current version -->
        <delete dir="compile-lib" failonerror="false"/>
        <delete dir="ooxml-lib" failonerror="false"/>
        <delete dir="ooxml-testlib" failonerror="false"/>
        <delete verbose="true" failonerror="false">
            <fileset dir="${basedir}/lib" includes="*.jar"/>
            <fileset dir="${basedir}/lib/excelant">
                <include name="ant*-1.10.1.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/main">
                <include name="log4j-1.2*.jar"/>
                <include name="log4j-api-2.14*.jar"/>
                <include name="log4j-api-2.15*.jar"/>
                <include name="log4j-api-2.16*.jar"/>
                <include name="log4j-api-2.17*.jar"/>
                <include name="commons-logging-1.2.jar"/>
                <include name="*slf4j*.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/main-tests">
                <include name="byte-buddy-*1.12*.jar"/>
                <include name="mockito-core-3*.jar"/>
                <include name="mockito-core-4.0*.jar"/>
                <include name="mockito-core-4.2*.jar"/>
                <include name="mockito-core-4.5*.jar"/>
                <include name="mockito-core-4.6*.jar"/>
                <include name="mockito-core-4.8*.jar"/>
                <include name="hamcrest-core*"/>
                <include name="junit-4*.jar"/>
                <include name="*slf4j*.jar"/>
                <include name="junit-jupiter-*-5.8.*.jar"/>
                <include name="junit-jupiter-*-5.7.*.jar"/>
                <include name="junit-platform-*-1.7.*.jar"/>
                <include name="junit-platform-*-1.8.*.jar"/>
                <include name="log4j-core-2.14*.jar"/>
                <include name="log4j-core-2.15*.jar"/>
                <include name="log4j-core-2.16*.jar"/>
                <include name="log4j-core-2.17*.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/ooxml">
                <include name="xmlbeans-3*.jar"/>
                <include name="xmlbeans-4*.jar"/>
                <include name="xmlbeans-5.0*.jar"/>
                <include name="xmlbeans-5.1.0.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/ooxml-provided">
                <include name="bc*-1.6*.jar"/>
                <include name="bc*-1.70.jar"/>
                <include name="bc*-jdk15on*.jar"/>
                <include name="batik*.jar"/>
                <include name="slf4j*-1.*.jar"/>
                <include name="xmlsec-2*.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/ooxml-tests">
                <include name="guava-20.0.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/util">
                <include name="asm*7.2.jar"/>
                <include name="asm*9.0.jar"/>
                <include name="asm*9.3.jar"/>
                <include name="org.jacoco.*-0.8.5.*.jar"/>
                <include name="org.jacoco.*-0.8.6.*.jar"/>
                <include name="org.jacoco.*-0.8.8.*.jar"/>
                <include name="org.jacoco.*-0.8.10.*.jar"/>
                <include name="forbiddenapis-3.1.jar"/>
                <include name="forbiddenapis-3.4.jar"/>
            </fileset>
            <fileset dir="${basedir}/lib/util">
                <include name="jacoco-0.8.5.zip"/>
                <include name="jacoco-0.8.6.zip"/>
                <include name="jacoco-0.8.8.zip"/>
                <include name="jacoco-0.8.10.zip"/>
            </fileset>
            <fileset dir="${basedir}/lib">
                <include name="jacoco-*.zip"/>
            </fileset>
            <fileset dir="${basedir}/lib/excelant">
                <include name="ant*1.10.1.jar"/>
            </fileset>
        </delete>

        <condition property="jars.present">
            <or>
                <and>
                    <available file="${main.commons-codec.jar}"/>
                    <available file="${main.junit-api.jar}"/>
                    <available file="${main.junit-jengine.jar}"/>
                    <available file="${main.junit-params.jar}"/>
                    <available file="${main.junit-plauncher.jar}"/>
                    <available file="${main.junit-pengine.jar}"/>
                    <available file="${main.junit-pcommons.jar}"/>
                    <available file="${main.junit-opentest4j.jar}"/>
                    <available file="${main.junit-apiguardian.jar}"/>
                    <available file="${main.jmh.jar}"/>
                    <available file="${main.jmhAnnotation.jar}"/>
                    <available file="${main.hamcrest.jar}"/>
                    <available file="${main.xmlunit.jar}"/>
                    <available file="${main.mockito.jar}"/>
                    <available file="${main.byte-buddy.jar}"/>
                    <available file="${main.byte-buddy-agent.jar}"/>
                    <available file="${main.objenesis.jar}"/>
                    <available file="${main.ant.jar}"/>
                    <available file="${main.antlauncher.jar}"/>
                    <available file="${main.log4j-api.jar}"/>
                    <available file="${main.log4j-core.jar}"/>
                    <available file="${asm.jar}"/>
                    <available file="${asm-commons.jar}"/>
                    <available file="${asm-tree.jar}"/>
                    <available file="${jacoco.zip}"/>
                    <available file="${rat.jar}"/>
                    <available file="${forbidden.jar}"/>
                    <available file="${dsig.bouncycastle-prov.jar}"/>
                    <available file="${dsig.bouncycastle-pkix.jar}"/>
                    <available file="${dsig.bouncycastle-util.jar}"/>
                    <available file="${dsig.xmlsec.jar}"/>
                    <available file="${main.commons-collections4.jar}"/>
                    <available file="${main.commons-math3.jar}"/>
                    <available file="${main.commons-io.jar}"/>
                    <available file="${main.com.zaxxer.jar}"/>

                    <!-- we had some CI failures when the extracted files for JaCoCo were missing somehow... -->
                    <available file="${util.lib}/jacocoagent.jar"/>
                </and>
                <isset property="disconnected"/>
            </or>
        </condition>
    </target>

    <target name="fetch-jars" depends="check-jars" unless="jars.present"
            description="Fetches needed JAR files from the Internet">
        <mkdir dir="${main.lib}"/>
        <downloadfile src="${main.commons-logging.url}" dest="${main.commons-logging.jar}"/>
        <downloadfile src="${main.commons-codec.url}" dest="${main.commons-codec.jar}"/>
        <downloadfile src="${main.junit-api.url}" dest="${main.junit-api.jar}"/>
        <downloadfile src="${main.junit-jengine.url}" dest="${main.junit-jengine.jar}"/>
        <downloadfile src="${main.junit-params.url}" dest="${main.junit-params.jar}"/>
        <downloadfile src="${main.junit-plauncher.url}" dest="${main.junit-plauncher.jar}"/>
        <downloadfile src="${main.junit-pengine.url}" dest="${main.junit-pengine.jar}"/>
        <downloadfile src="${main.junit-pcommons.url}" dest="${main.junit-pcommons.jar}"/>
        <downloadfile src="${main.junit-opentest4j.url}" dest="${main.junit-opentest4j.jar}"/>
        <downloadfile src="${main.junit-apiguardian.url}" dest="${main.junit-apiguardian.jar}"/>
        <downloadfile src="${main.jmh.url}" dest="${main.jmh.jar}"/>
        <downloadfile src="${main.jmhAnnotation.url}" dest="${main.jmhAnnotation.jar}"/>
        <downloadfile src="${main.hamcrest.url}" dest="${main.hamcrest.jar}"/>
        <downloadfile src="${main.xmlunit.url}" dest="${main.xmlunit.jar}"/>
        <downloadfile src="${main.mockito.url}" dest="${main.mockito.jar}"/>
        <downloadfile src="${main.byte-buddy.url}" dest="${main.byte-buddy.jar}"/>
        <downloadfile src="${main.byte-buddy-agent.url}" dest="${main.byte-buddy-agent.jar}"/>
        <downloadfile src="${main.objenesis.url}" dest="${main.objenesis.jar}"/>
        <downloadfile src="${main.ant.url}" dest="${main.ant.jar}"/>
        <downloadfile src="${main.antlauncher.url}" dest="${main.antlauncher.jar}"/>
        <downloadfile src="${main.log4j-api.url}" dest="${main.log4j-api.jar}"/>
        <downloadfile src="${main.log4j-core.url}" dest="${main.log4j-core.jar}"/>
        <downloadfile src="${asm.url}" dest="${asm.jar}"/>
        <downloadfile src="${asm-commons.url}" dest="${asm-commons.jar}"/>
        <downloadfile src="${asm-tree.url}" dest="${asm-tree.jar}"/>
        <downloadfile src="${jacoco.url}" dest="${jacoco.zip}"/>
        <downloadfile src="${main.commons-collections4.url}" dest="${main.commons-collections4.jar}"/>
        <downloadfile src="${main.commons-math3.url}" dest="${main.commons-math3.jar}"/>
        <downloadfile src="${main.commons-io.url}" dest="${main.commons-io.jar}"/>
        <downloadfile src="${main.com.zaxxer.url}" dest="${main.com.zaxxer.jar}"/>
        <unzip src="${jacoco.zip}" dest="${util.lib}">
            <patternset>
                <include name="lib/*.jar"/>
            </patternset>
            <mapper type="flatten"/>
        </unzip>
        <downloadfile src="${rat.url}" dest="${rat.jar}"/>
        <downloadfile src="${forbidden.url}" dest="${forbidden.jar}"/>
        <downloadfile src="${dsig.bouncycastle-prov.url}" dest="${dsig.bouncycastle-prov.jar}"/>
        <downloadfile src="${dsig.bouncycastle-pkix.url}" dest="${dsig.bouncycastle-pkix.jar}"/>
        <downloadfile src="${dsig.bouncycastle-util.url}" dest="${dsig.bouncycastle-util.jar}"/>
        <downloadfile src="${dsig.xmlsec.url}" dest="${dsig.xmlsec.jar}"/>
    </target>

    <target name="check-ooxml-jars">
        <condition property="ooxml.jars.present">
            <or>
                <and>
                    <available file="${ooxml.curvesapi.jar}"/>
                    <available file="${ooxml.xmlbeans.jar}"/>
                    <available file="${ooxml.commons-compress.jar}"/>
                    <available file="${ooxml.commons-lang3.jar}"/>
                    <available file="${ooxml.test.reflections.jar}"/>
                    <available file="${ooxml.test.guava.jar}"/>
                    <available file="${ooxml.test.javassist.jar}"/>
                    <available file="${ooxml.test.slf4j-api.jar}"/>
                    <available file="${ooxml.test.opczip.jar}"/>
                    <available file="${ooxml.test.stax2.jar}"/>
                    <available file="${svg.xml-apis-ext.jar}"/>
                    <available file="${svg.batik-anim.jar}"/>
                    <available file="${svg.batik-awt-util.jar}"/>
                    <available file="${svg.batik-bridge.jar}"/>
                    <available file="${svg.batik-codec.jar}"/>
                    <available file="${svg.batik-constants.jar}"/>
                    <available file="${svg.batik-css.jar}"/>
                    <available file="${svg.batik-dom.jar}"/>
                    <available file="${svg.batik-ext.jar}"/>
                    <available file="${svg.batik-gvt.jar}"/>
                    <available file="${svg.batik-i18n.jar}"/>
                    <available file="${svg.batik-parser.jar}"/>
                    <available file="${svg.batik-script.jar}"/>
                    <available file="${svg.batik-shared-resources.jar}"/>
                    <available file="${svg.batik-svg-dom.jar}"/>
                    <available file="${svg.batik-svggen.jar}"/>
                    <available file="${svg.batik-svgrasterizer.jar}"/>
                    <available file="${svg.batik-transcoder.jar}"/>
                    <available file="${svg.batik-util.jar}"/>
                    <available file="${svg.batik-xml.jar}"/>
                    <available file="${svg.xmlgraphics-commons.jar}"/>
                    <available file="${pdf.pdfbox.jar}"/>
                    <available file="${pdf.pdfbox.io.jar}"/>
                    <available file="${pdf.fontbox.jar}"/>
                    <available file="${pdf.graphics2d.jar}"/>
                </and>
                <isset property="disconnected"/>
            </or>
        </condition>
    </target>
    <target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present">
        <mkdir dir="${ooxml.lib}"/>
        <mkdir dir="${ooxml-tests.lib}"/>
        <downloadfile src="${ooxml.curvesapi.url}" dest="${ooxml.curvesapi.jar}"/>
        <downloadfile src="${ooxml.xmlbeans.url}" dest="${ooxml.xmlbeans.jar}"/>
        <downloadfile src="${ooxml.commons-compress.url}" dest="${ooxml.commons-compress.jar}"/>
        <downloadfile src="${ooxml.commons-lang3.url}" dest="${ooxml.commons-lang3.jar}"/>
        <downloadfile src="${ooxml.test.reflections.url}" dest="${ooxml.test.reflections.jar}"/>
        <downloadfile src="${ooxml.test.guava.url}" dest="${ooxml.test.guava.jar}"/>
        <downloadfile src="${ooxml.test.javassist.url}" dest="${ooxml.test.javassist.jar}"/>
        <downloadfile src="${ooxml.test.slf4j-api.url}" dest="${ooxml.test.slf4j-api.jar}"/>
        <downloadfile src="${ooxml.test.opczip.url}" dest="${ooxml.test.opczip.jar}"/>
        <downloadfile src="${ooxml.test.stax2.url}" dest="${ooxml.test.stax2.jar}"/>
        <downloadfile src="${svg.batik-anim.url}" dest="${svg.batik-anim.jar}"/>
        <downloadfile src="${svg.batik-awt-util.url}" dest="${svg.batik-awt-util.jar}"/>
        <downloadfile src="${svg.batik-bridge.url}" dest="${svg.batik-bridge.jar}"/>
        <downloadfile src="${svg.batik-codec.url}" dest="${svg.batik-codec.jar}"/>
        <downloadfile src="${svg.batik-constants.url}" dest="${svg.batik-constants.jar}"/>
        <downloadfile src="${svg.batik-css.url}" dest="${svg.batik-css.jar}"/>
        <downloadfile src="${svg.batik-dom.url}" dest="${svg.batik-dom.jar}"/>
        <downloadfile src="${svg.batik-ext.url}" dest="${svg.batik-ext.jar}"/>
        <downloadfile src="${svg.batik-gvt.url}" dest="${svg.batik-gvt.jar}"/>
        <downloadfile src="${svg.batik-i18n.url}" dest="${svg.batik-i18n.jar}"/>
        <downloadfile src="${svg.batik-parser.url}" dest="${svg.batik-parser.jar}"/>
        <downloadfile src="${svg.batik-script.url}" dest="${svg.batik-script.jar}"/>
        <downloadfile src="${svg.batik-shared-resources.url}" dest="${svg.batik-shared-resources.jar}"/>
        <downloadfile src="${svg.batik-svg-dom.url}" dest="${svg.batik-svg-dom.jar}"/>
        <downloadfile src="${svg.batik-svggen.url}" dest="${svg.batik-svggen.jar}"/>
        <downloadfile src="${svg.batik-svgrasterizer.url}" dest="${svg.batik-svgrasterizer.jar}"/>
        <downloadfile src="${svg.batik-transcoder.url}" dest="${svg.batik-transcoder.jar}"/>
        <downloadfile src="${svg.batik-util.url}" dest="${svg.batik-util.jar}"/>
        <downloadfile src="${svg.batik-xml.url}" dest="${svg.batik-xml.jar}"/>
        <downloadfile src="${svg.xml-apis-ext.url}" dest="${svg.xml-apis-ext.jar}"/>
        <downloadfile src="${svg.xmlgraphics-commons.url}" dest="${svg.xmlgraphics-commons.jar}"/>
        <downloadfile src="${pdf.pdfbox.url}" dest="${pdf.pdfbox.jar}"/>
        <downloadfile src="${pdf.pdfbox.io.url}" dest="${pdf.pdfbox.io.jar}"/>
        <downloadfile src="${pdf.fontbox.url}" dest="${pdf.fontbox.jar}"/>
        <downloadfile src="${pdf.graphics2d.url}" dest="${pdf.graphics2d.jar}"/>
    </target>

    <target name="check-compiled-ooxml-xsds">
        <condition property="ooxml-compiled-xsds.present">
            <and>
                <available file="${ooxml.xsds.jar}"/>
                <available file="${ooxml.xsds.src.jar}"/>
            </and>
        </condition>
    </target>

    <target name="compile-ooxml-xsds"
        depends="init,check-compiled-ooxml-xsds"
        unless="ooxml-compiled-xsds.present"
        description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">

        <local name="ooxml.memory"/>

        <!-- We need a fair amount of memory to compile the xml schema, -->
        <!-- but limit it in case it goes wrong! -->
        <!-- Pick the right amount based on 32 vs 64 bit jvm -->
        <condition property="ooxml.memory" value="1536m" else="1024m">
            <equals arg1="${sun.arch.data.model}" arg2="64" />
        </condition>

        <mkdir dir="${ooxml.xsds.src.dir}"/>

        <copy todir="${ooxml.xsds.src.dir}">
            <zipfileset src="${ooxml.xsds.izip.1}"/>
            <fileset dir="${ooxml.visio.xsd.dir}"/>
            <fileset dir="${ooxml.schema.xsdconfig.dir}" includes="ooxmlSchemas.xsdconfig,markup-compatibility.xsd,vmlDrawing.xsd"/>
            <fileset dir="${ooxml.schema.xsdconfig.dir}" includes="dml-drawing.xsd,word10.xsd,word12.xsd,XAdES*.xsd,xlThreaded*.xsd,xmldsig*.xsd"/>
            <zipfileset src="${ooxml.xsds.izip.2}" includes="opc-digSig.xsd,opc-relationships.xsd"/>
            <fileset dir="${ooxml.security.xsd.dir}" includes="signatureInfo.xsd"/>
        </copy>

        <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean">
            <classpath>
                <path location="${ooxml.xmlbeans.jar}"/>
                <path location="${main.log4j-api.jar}"/>
                <path location="${main.log4j-core.jar}"/>
            </classpath>
        </taskdef>

        <xmlbean
            schema="${ooxml.xsds.src.dir}"
            srcgendir="${ooxml-schema.output.gen-sources.dir}"
            classgendir="${ooxml-schema.output.gen-classes.dir}"
            destfile="${ooxml.xsds.src.dir}.jar"
            srconly="true"
            failonerror="true"
            fork="true"
            memoryMaximumSize="${ooxml.memory}"
            typesystemname="ooxml"
            repackage="org.apache.xmlbeans.metadata:org.apache.poi.schemas.ooxml">
            <classpath>
                <path location="${ooxml.xmlbeans.jar}"/>
            </classpath>
        </xmlbean>

        <javac release="8"
               target="${jdk.version.class}"
               source="${jdk.version.source}"
               srcdir="${ooxml-schema.output.gen-sources.dir}"
               destdir="${ooxml-schema.output.dir}"
               encoding="${java.source.encoding}"
               fork="yes"
               debug="${compile.debug}"
               memoryMaximumSize="${ooxml.memory}"
               includeantruntime="false">
            <classpath refid="ooxml.classpath"/>
            <classpath>
                <pathelement path="${ooxml-schema.output.gen-classes.dir}"/>
            </classpath>
        </javac>

        <javac release="9"
               srcdir="${basedir}/poi-ooxml-full/src/main/java9"
               destdir="${basedir}/poi-ooxml-full/src/main/java9"
               includeantruntime="false"
               fork="true"
               modulepath="lib/ooxml"
               unless:true="${isJava8}">
            <compilerarg line="--patch-module org.apache.poi.ooxml.schemas=${ooxml-schema.output.dir}${path.separator}${ooxml-schema.output.gen-classes.dir}"/>
        </javac>

        <mkdir dir="build/dist/maven/poi-ooxml-full"/>

        <jar destfile="${ooxml.xsds.jar}">
            <fileset dir="${ooxml-schema.output.dir}"/>
            <fileset dir="${ooxml-schema.output.gen-classes.dir}"/>
            <zipfileset dir="${basedir}/poi-ooxml-full/src/main/java9" prefix="META-INF/versions/9" excludes="*.java"/>
            <metainf dir="legal/" excludes="HEADER"/>
            <manifest>
                <attribute name="Multi-Release" value="true"/>
                <attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml.schemas"/>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Specification-Title" value="Apache POI OOXML Schemas"/>
                <attribute name="Specification-Version" value="${version.id}"/>
                <attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
                <attribute name="Implementation-Title" value="Apache POI OOXML Schemas"/>
                <attribute name="Implementation-Version" value="${version.id}"/>
                <attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
                <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
            </manifest>
        </jar>

        <jar destfile="${ooxml.xsds.src.jar}">
            <fileset dir="${ooxml-schema.output.gen-sources.dir}"/>
            <zipfileset dir="${basedir}/poi-ooxml-full/src/main/java9" prefix="META-INF/versions/9/" excludes="*.class"/>
            <metainf dir="legal" excludes="HEADER"/>
        </jar>
    </target>

    <target name="compile" depends="init, compile-main,
            compile-scratchpad, compile-examples, compile-excelant"
            description="Compiles the POI main classes, scratchpad and examples"/>

    <macrodef name="compile-jar">
        <attribute name="module"/>
        <attribute name="java"/>
        <attribute name="classes"/>
        <attribute name="test" default=""/>
        <attribute name="test-classes" default=""/>
        <attribute name="version" default="${version.id}"/>
        <element name="lib"/>
        <element name="resources" optional="true"/>
        <element name="test-resources" optional="true"/>
        <sequential>
            <local name="cp_java"/>
            <pathconvert property="cp_java" pathsep=",">
                <path><lib/></path>
                <filtermapper>
                    <replacestring from="${basedir}" to=""/>
                    <replaceregex pattern="^." replace=""/>
                    <suffixlines suffix="${file.separator}*.jar"/>
                </filtermapper>
            </pathconvert>

            <local name="maven-name"/>
            <loadresource property="maven-name">
                <string>@{module}</string>
                <filterchain>
                    <prefixlines prefix="poi-"/>
                    <replacestring from="poi-poi" to="poi"/>
                </filterchain>
            </loadresource>

            <echo message="Building classes for @{module}"/>

            <!-- compile the sources -->
            <javac
                   target="${jdk.version.class}"
                   source="${jdk.version.source}"
                   destdir="@{classes}"
                   srcdir="@{java}"
                   debug="${compile.debug}"
                   encoding="${java.source.encoding}"
                   fork="yes"
                   includeantruntime="false">
                <classpath>
                    <fileset dir="${basedir}" includes="${cp_java}"/>
                </classpath>
            </javac>

            <local name="module-name"/>
            <loadresource property="module-name">
                <string>@{module}</string>
                <filterchain>
                    <replacestring from="poi-" to=""/>
                </filterchain>
            </loadresource>

            <echo message="Building java9+ classes for @{module}"/>

            <!-- compile jigsaw files to sources, so we don't forget to update/provide them for Java 8 builds -->
            <javac release="9"
                   srcdir="${basedir}/@{module}/src/main/java9"
                   destdir="${basedir}/@{module}/src/main/java9"
                   includeantruntime="false"
                   fork="true"
                   unless:true="${isJava8}">
                <compilerarg line="--patch-module org.apache.poi.${module-name}=@{classes}"/>
                <modulepath>
                    <lib/>
                </modulepath>
            </javac>

            <mkdir dir="build/dist/maven/${maven-name}"/>

            <echo message="Building jar for @{module}, module-name: ${module-name} with isJava8: ${isJava8}"/>

            <!-- create classes jar -->
            <jar destfile="build/dist/maven/${maven-name}/${maven-name}-@{version}.jar">
                <fileset dir="@{classes}"/>
                <resources/>
                <zipfileset dir="${basedir}/@{module}/src/main/java9"
                            prefix="META-INF/versions/9"
                            excludes="*.java"/>
                <metainf dir="legal/" excludes="HEADER"/>
                <manifest>
                    <attribute name="Multi-Release" value="true"/>
                    <attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
                    <attribute name="Built-By" value="${user.name}"/>
                    <attribute name="Specification-Title" value="Apache POI"/>
                    <attribute name="Specification-Version" value="${version.id}"/>
                    <attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
                    <attribute name="Implementation-Title" value="Apache POI"/>
                    <attribute name="Implementation-Version" value="${version.id}"/>
                    <attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
                    <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
                </manifest>
            </jar>

            <!-- compile the tests -->
            <javac release="8"
                   target="${jdk.version.class}"
                   source="${jdk.version.source}"
                   destdir="@{test-classes}"
                   srcdir="@{test}"
                   debug="${compile.debug}"
                   encoding="${java.source.encoding}"
                   fork="yes"
                   includeantruntime="false" unless:blank="@{test}">
                <classpath>
                    <fileset dir="${basedir}" includes="${cp_java}"/>
                    <pathelement path="build/dist/maven/${maven-name}/${maven-name}-@{version}.jar"/>
                </classpath>
            </javac>

            <!-- again, generate jigsaw files to sources ... -->
            <local name="merged"/>
            <pathconvert property="merged">
                <path location="@{classes}"/>
                <path location="@{test-classes}"/>
            </pathconvert>

            <javac release="9"
                   srcdir="${basedir}/@{module}/src/test/java9"
                   destdir="${basedir}/@{module}/src/test/java9"
                   includeantruntime="false"
                   fork="true"
                   unless:true="${isJava8}" unless:blank="@{test}">
                <compilerarg line="--patch-module org.apache.poi.${module-name}=${merged}"/>
                <modulepath>
                    <lib/>
                </modulepath>
            </javac>

            <echo message="Building test-jar for @{module}, module-name: ${module-name} with isJava8: ${isJava8}"/>

            <!-- create test classes jar - using the module-info of the tests -->
            <jar destfile="build/dist/maven/${maven-name}-tests/${maven-name}-@{version}-tests.jar" unless:blank="@{test}">
                <fileset dir="@{classes}"/>
                <fileset dir="@{test-classes}">
                    <exclude name="org/apache/poi/ooxml/lite/**"/>
                </fileset>
                <resources/>
                <test-resources/>
                <zipfileset dir="${basedir}/@{module}/src/test/java9" prefix="META-INF/versions/9" excludes="*.java"/>
                <metainf dir="legal/" excludes="HEADER"/>
                <manifest>
                    <attribute name="Multi-Release" value="true"/>
                    <attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
                    <attribute name="Built-By" value="${user.name}"/>
                    <attribute name="Specification-Title" value="Apache POI"/>
                    <attribute name="Specification-Version" value="${version.id}"/>
                    <attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
                    <attribute name="Implementation-Title" value="Apache POI"/>
                    <attribute name="Implementation-Version" value="${version.id}"/>
                    <attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
                    <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
                </manifest>
            </jar>

            <!-- create the sources jar -->
            <jar destfile="build/dist/maven/${maven-name}/${maven-name}-@{version}-sources.jar">
                <fileset dir="@{java}"/>
                <metainf dir="legal/" excludes="HEADER"/>
                <manifest>
                    <attribute name="Built-By" value="${user.name}"/>
                    <attribute name="Specification-Title" value="Apache POI"/>
                    <attribute name="Specification-Version" value="${version.id}"/>
                    <attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
                    <attribute name="Implementation-Title" value="Apache POI"/>
                    <attribute name="Implementation-Version" value="${version.id}"/>
                    <attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
                    <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
                </manifest>
            </jar>
        </sequential>
    </macrodef>

    <target name="compile-main" depends="init, compile-version">
        <compile-jar module="poi"
            java="${main.src}" classes="${main.output.dir}"
            test="${main.src.test}" test-classes="${main.output.test.dir}">
            <lib>
                <pathelement path="lib/main"/>
                <pathelement path="lib/main-tests"/>
                <pathelement path="lib/excelant"/>
            </lib>
            <resources>
                <fileset dir="${main.resources.main}"/>
            </resources>
            <test-resources>
                <fileset dir="${main.resources.test}" />
            </test-resources>
        </compile-jar>
    </target>

    <target name="compile-scratchpad" depends="compile-main">
        <compile-jar module="poi-scratchpad"
             java="${scratchpad.src}" classes="${scratchpad.output.dir}"
             test="${scratchpad.src.test}" test-classes="${scratchpad.output.test.dir}">
            <lib>
                <pathelement path="build/dist/maven/poi-tests"/>
                <pathelement path="lib/main"/>
                <pathelement path="lib/main-tests"/>
            </lib>
            <resources>
                <fileset dir="${scratchpad.resources.main}"/>
            </resources>
            <test-resources>
                <fileset dir="${scratchpad.resources.test}" />
            </test-resources>
        </compile-jar>
    </target>

    <target name="compile-examples" depends="compile-main,compile-scratchpad,compile-ooxml">
        <compile-jar module="poi-examples"
                     java="${examples.src}" classes="${examples.output.dir}">
            <lib>
                <pathelement path="build/dist/maven/poi-ooxml-full"/>
                <pathelement path="build/dist/maven/poi-tests"/>
                <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
                <pathelement path="build/dist/maven/poi-ooxml-tests"/>
                <pathelement path="lib/main"/>
                <pathelement path="lib/ooxml"/>
            </lib>
        </compile-jar>
    </target>

    <target name="compile-ooxml" depends="compile-main,compile-scratchpad,compile-ooxml-xsds">
        <compile-jar module="poi-ooxml"
             java="${ooxml.src}" classes="${ooxml.output.dir}"
             test="${ooxml.src.test}" test-classes="${ooxml.output.test.dir}">
            <lib>
                <pathelement path="build/dist/maven/poi-tests"/>
                <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
                <pathelement path="build/dist/maven/poi-ooxml-full"/>
                <pathelement path="lib/main"/>
                <pathelement path="lib/main-tests"/>
                <pathelement path="lib/ooxml"/>
                <pathelement path="lib/ooxml-provided"/>
                <pathelement path="lib/ooxml-tests"/>
                <pathelement path="lib/ooxml-batik"/>
            </lib>
            <resources>
                <fileset dir="${ooxml.resources.main}"/>
            </resources>
        </compile-jar>

        <!-- create ooxml-lite-agent jar -->
        <mkdir dir="${ooxml.lite.output.dir}"/>
        <javac release="8"
               srcdir="${basedir}/poi-ooxml-lite-agent/src/main/java"
               destdir="${ooxml.lite.output.dir}"
               includeantruntime="false"
               fork="true">
            <classpath>
                <fileset dir="${basedir}/lib/main-tests" includes="*.jar"/>
                <fileset dir="${basedir}/lib/ooxml" includes="*.jar"/>
            </classpath>
        </javac>

        <javac release="9"
               srcdir="${basedir}/poi-ooxml-lite-agent/src/main/java9"
               destdir="${basedir}/poi-ooxml-lite-agent/src/main/java9"
               includeantruntime="false"
               fork="true"
               modulepath="${basedir}/lib/main-tests"
               unless:true="${isJava8}">
            <compilerarg line="--patch-module org.apache.poi.ooxml_lite=${ooxml.output.test.dir}${path.separator}${ooxml.lite.output.dir}"/>
        </javac>

        <jar destfile="${ooxml.lite.agent}">
            <fileset dir="${ooxml.lite.output.dir}"/>
            <zipfileset dir="${basedir}/poi-ooxml-lite-agent/src/main/java9" prefix="META-INF/versions/9" excludes="*.java"/>
            <manifest>
                <attribute name="Multi-Release" value="true"/>
                <attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml_lite"/>
                <attribute name="Premain-Class" value="org.apache.poi.ooxml.lite.OOXMLLiteAgent"/>
                <!-- attribute name="Can-Retransform-Classes" value="true"/ -->
            </manifest>
        </jar>
    </target>

    <macrodef name="poiunit" xmlns:jacoco="antlib:org.jacoco.ant">
        <attribute name="failureproperty"/>
        <attribute name="heap" default="512"/>
        <attribute name="showoutput" default="false"/>
        <attribute name="jacocodest" default="build/jacoco-dest.exec"/>
        <attribute name="modulepath-ref"/>
        <attribute name="module1" default=""/>
        <attribute name="module2" default=""/>
        <attribute name="module3" default=""/>
        <attribute name="module4" default=""/>
        <attribute name="outputDir"/>
        <element name="elements" implicit="true"/>
        <sequential>
            <local name="no.jit.sherlock"/>
            <!-- see http://www-01.ibm.com/support/docview.wss?uid=swg21294023 on how to determine the method strings -->
            <loadresource property="no.jit.sherlock">
                <string>
                    sun/java2d/pipe/AAShapePipe.renderTiles(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;Lsun/java2d/pipe/AATileGenerator;[I)V
                    sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V
                    java/awt/TexturePaintContext.getRaster(IIII)Ljava/awt/image/Raster;
                </string>
                <filterchain>
                    <trim/>
                    <ignoreblank/>
                    <prefixlines prefix=",exclude={"/>
                    <suffixlines suffix="}"/>
                    <striplinebreaks/>
                </filterchain>
            </loadresource>

            <path id="junit-jars">
                <pathelement location="${main.junit-api.jar}"/>
                <pathelement location="${main.junit-jengine.jar}"/>
                <pathelement location="${main.junit-params.jar}"/>
                <pathelement location="${main.junit-opentest4j.jar}"/>
                <pathelement location="${main.junit-apiguardian.jar}"/>
                <pathelement location="${main.junit-pcommons.jar}"/>
                <pathelement location="${main.junit-pengine.jar}"/>
                <pathelement location="${main.junit-plauncher.jar}"/>
            </path>


            <mkdir dir="poi-excelant/build/poi-ant-contrib"/>
            <javac srcdir="poi-excelant/src/poi-ant-contrib/java" destdir="poi-excelant/build/poi-ant-contrib"
                   includeantruntime="true" includes="Junit5Progress.java" classpathref="junit-jars"/>


            <local name="ooxml.lite.agent.exists"/>
            <available property="ooxml.lite.agent.exists" file="${ooxml.lite.agent}"/>

            <local name="cp_java"/>
            <pathconvert property="cp_java" pathsep=",">
                <path refid="@{modulepath-ref}"/>
                <filtermapper>
                    <replacestring from="${basedir}" to=""/>
                    <replaceregex pattern="^." replace=""/>
                    <suffixlines suffix="${file.separator}*.jar"/>
                </filtermapper>
            </pathconvert>

            <local name="use_module1"/>
            <local name="use_module2"/>
            <local name="use_module3"/>
            <local name="use_module4"/>
            <condition property="use_module1" value="true" unless:true="${isJava8}">
                <length string="@{module1}" when="greater" length="0"/>
            </condition>
            <condition property="use_module2" value="true" unless:true="${isJava8}">
                <length string="@{module2}" when="greater" length="0"/>
            </condition>
            <condition property="use_module3" value="true" unless:true="${isJava8}">
                <length string="@{module3}" when="greater" length="0"/>
            </condition>
            <condition property="use_module4" value="true" unless:true="${isJava8}">
                <length string="@{module4}" when="greater" length="0"/>
            </condition>

            <!-- As of 2018, JaCoCo is managing expectations and stay on Java 5 and therefore don't support junitlauncher -->
            <!-- https://github.com/jacoco/jacoco/issues/673  ... m( -->

            <jacoco:agent property="jacocoagent" enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="@{jacocodest}"/>

            <junitlauncher printsummary="false" haltonfailure="${halt.on.test.failure}" failureproperty="@{failureproperty}">
                <classpath>
                    <path refid="junit-jars" if:true="${isJava8}"/>
                    <fileset dir="${basedir}" includes="${cp_java}" if:true="${isJava8}"/>
                    <pathelement location="poi-excelant/build/poi-ant-contrib"/>
                </classpath>

                <testclasses outputDir="@{outputDir}">
                    <fork>
                        <syspropertyset refid="junit.properties"/>
                        <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
                        <jvmarg value="-Xmx@{heap}M"/>
                        <jvmarg value="-ea"/>

                        <!-- some "add-opens" and other properties are needed when running with Java 9 or newer -->
                        <sysproperty key="sun.reflect.debugModuleAccessChecks" value="true" if:true="${addOpens}" />
                        <sysproperty key="com.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize" value="true" if:true="${addOpens}" />
                        <jvmarg value="--illegal-access=warn" if:true="${addOpens}" />
                        <jvmarg value="-javaagent:${ooxml.lite.agent}=${ooxml.lite.report}|${ooxml.lite.includes}" if:true="${ooxml.lite.agent.exists}"/>
                        <jvmarg line="${jacocoagent}"/>

                        <!-- jvmarg value="-Duser.timezone=UTC"/ -->
                        <jvmarg value="${file.leak.detector}" />
                        <jvmarg value="-Djunit.jupiter.execution.parallel.enabled=true" />
                        <jvmarg value="-Djunit.jupiter.execution.parallel.config.strategy=fixed" />
                        <jvmarg value="-Djunit.jupiter.execution.parallel.config.fixed.parallelism=3" />
                        <jvmarg value="-Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log${no.jit.sherlock}" if:true="${isIBMVM}"/>

<!--                        <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5000"/>-->
<!--                        <jvmarg value="&#45;&#45;show-module-resolution"/>-->


                        <modulepath refid="@{modulepath-ref}" unless:true="${isJava8}"/>

                        <!--jvmarg line="-verbose:module"/-->
                        <jvmarg line="--add-opens java.base/java.lang=net.bytebuddy" unless:true="${isJava8}"/>

                        <jvmarg line="--add-modules org.junit.platform.launcher" unless:true="${isJava8}"/>
                        <jvmarg line="--add-modules org.junit.jupiter.params" unless:true="${isJava8}"/>
                        <jvmarg line="--add-modules org.apache.poi.@{module1}" if:set="use_module1"/>
                        <jvmarg line="--add-modules org.apache.poi.@{module2}" if:set="use_module2"/>
                        <jvmarg line="--add-modules @{module3}" if:set="use_module3"/>
                        <jvmarg line="--add-modules @{module4}" if:set="use_module4"/>
                    </fork>

                    <listener classname="Junit5Progress" />
                    <listener type="legacy-plain" sendSysOut="true" outputDir="@{outputDir}"/>
                    <listener type="legacy-xml" sendSysOut="true" sendSysErr="true" outputDir="@{outputDir}"/>
                    <elements/>
                </testclasses>
            </junitlauncher>
        </sequential>
    </macrodef>

    <target name="retest-ooxml" depends="jar"
        description="run ooxml tests with poi-ooxml-lite">
        <path id="restest.modules">
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml-lite"/>
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
            <pathelement path="lib/ooxml"/>
            <pathelement path="lib/ooxml-provided"/>
            <pathelement path="lib/ooxml-tests"/>
        </path>

        <poiunit failureproperty="ooxml.test.failed" heap="768" modulepath-ref="restest.modules"
            module1="ooxml" module2="scratchpad" module3="org.bouncycastle.pkix" module4="org.slf4j"
            outputDir="${ooxml.reports.test}">
            <zipfileset src="build/dist/maven/poi-ooxml-tests/poi-ooxml-${version.id}-tests.jar">
                <include name="**/${testpattern}.class"/>
                <exclude name="**/*$*.class"/>
                <exclude name="**/TestUnfixedBugs.class"/>
                <exclude name="**/All*Tests.class"/>
                <exclude name="**/TestSignatureInfo.class"/>
                <exclude name="**/${testexcludepattern}.class"/>
                <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
            </zipfileset>
        </poiunit>
    </target>

    <target name="compile-excelant" depends="compile-main,compile-ooxml">
        <compile-jar module="poi-excelant"
            java="${excelant.src}" classes="${excelant.output.dir}"
            test="${excelant.src.test}" test-classes="${excelant.output.test.dir}">
            <lib>
                <pathelement path="build/dist/maven/poi-tests"/>
                <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
                <pathelement path="build/dist/maven/poi-ooxml-tests"/>
                <pathelement path="build/dist/maven/poi-ooxml-full"/>
                <pathelement path="lib/main"/>
                <pathelement path="lib/main-tests"/>
                <pathelement path="lib/excelant"/>
                <pathelement path="lib/ooxml"/>
            </lib>
            <resources>
                <fileset dir="${excelant.resource.main}"/>
            </resources>
        </compile-jar>
    </target>

    <target name="compile-integration" depends="compile-scratchpad, compile-main, compile-ooxml, compile-examples">
        <javac release="8"
               target="${jdk.version.class}"
               source="${jdk.version.source}"
               destdir="${integration.output.test.dir}"
               srcdir="${integration.src.test}"
               debug="${compile.debug}"
               encoding="${java.source.encoding}"
               fork="yes"
               includeantruntime="false">
            <classpath>
                <path refid="scratchpad.classpath"/>
                <path refid="ooxml.classpath"/>
                <path refid="test.jar.classpath"/>
                <pathelement location="${ooxml.output.dir}"/>
                <pathelement location="${ooxml.output.test.dir}"/>
                <pathelement location="${main.output.test.dir}"/>
                <pathelement location="${examples.output.dir}"/>
                <pathelement location="${main.ant.jar}"/>
                <pathelement location="${scratchpad.output.dir}"/>
                <pathelement location="${integration.resources.test}"/>
            </classpath>
            <exclude name="**/HeapDump**" if:true="${isIBMVM}"/>
        </javac>


        <mkdir dir="${integration.output.test.dir}/META-INF/versions/9"/>

        <javac release="9"
               srcdir="${basedir}/poi-integration/src/test/java9"
               destdir="${integration.output.test.dir}/META-INF/versions/9"
               includeantruntime="false"
               fork="true"
               unless:true="${isJava8}">
            <compilerarg line="--patch-module org.apache.poi.stress=${integration.output.test.dir}"/>
            <modulepath>
                <pathelement path="build/dist/maven/poi-ooxml-full"/>
                <pathelement path="build/dist/maven/poi"/>
                <pathelement path="build/dist/maven/poi-ooxml"/>
                <pathelement path="build/dist/maven/poi-scratchpad"/>
                <pathelement path="build/dist/maven/poi-examples"/>
                <pathelement path="${main.lib}"/>
                <pathelement path="${main-tests.lib}"/>
                <pathelement path="${ooxml.lib}"/>
                <pathelement path="${ooxml-provided.lib}"/>
            </modulepath>
        </javac>

        <manifest file="poi-integration/build/poi-manifest.mf">
            <attribute name="Multi-Release" value="true"/>
            <attribute name="Automatic-Module-Name" value="org.apache.poi.stress"/>
        </manifest>

        <jar destfile="build/dist/maven/poi-integration/poi-integration-${version.id}.jar"
             basedir="${integration.output.test.dir}"
             manifest="poi-integration/build/poi-manifest.mf"/>
    </target>

    <target name="-version-java-check">
        <!-- recompile Version.java from the template whenever source or the version in build.xml changes -->
        <uptodate property="version.java.notRequired" targetfile="${main.output.dir}/org/apache/poi/Version.class">
            <srcfiles file="poi/src/main/version/Version.java.template"/>
            <srcfiles file="build.xml"/>
        </uptodate>
    </target>

    <target name="compile-version"
            unless="version.java.notRequired"
            depends="init, -version-java-check"
            description="Compiles the version class">
        <!-- Generate the .java file -->
        <local name="version.dir"/>
        <dirname property="version.dir" file="${main.version.java}"/>
        <mkdir dir="${version.dir}"/>
        <delete file="${main.version.java}"/>
        <copy file="${main.version.template}" tofile="${main.version.java}" overwrite="true">
            <filterset>
                <filter token="VERSION" value="${version.id}"/>
                <filter token="DSTAMP" value="${DSTAMP}"/>
            </filterset>
        </copy>

        <!-- Compile -->
        <javac target="${jdk.version.class}" source="${jdk.version.source}"
               failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
               srcdir="${main.output.gen-sources.dir}"
               encoding="${java.source.encoding}" includeantruntime="false">
        </javac>
    </target>

    <target name="jacocotask" depends="">
        <echo message="Coverage reporting: ${coverage.enabled}"/>
        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
            <classpath>
                <fileset dir="${util.lib}">
                    <include name="org.jacoco*.jar" />
                    <include name="asm-*.jar" />
                </fileset>
            </classpath>
        </taskdef>
    </target>

    <!-- Section: test (execute junit tests on test suites) -->
    <target name="test" depends="compile,jacocotask,test-main,test-scratchpad,test-ooxml,test-excelant"
            description="Tests main, scratchpad and ooxml"/>
    <target name="test-all" depends="test,test-integration,test-ooxml-lite,testcoveragereport"
            description="Tests main, scratchpad, ooxml, ooxml-lite, and coveragereport"/>

    <target name="testcoveragereport" depends="init,jacocotask" description="create test-report" xmlns:jacoco="antlib:org.jacoco.ant" if="coverage.enabled">
        <delete dir="${coverage.dir}"/>
        <mkdir dir="${coverage.dir}"/>
        <mkdir dir="${main.output.dir}"/>
        <mkdir dir="${scratchpad.output.dir}"/>
        <mkdir dir="${ooxml.output.dir}"/>
        <mkdir dir="${excelant.output.dir}"/>

        <jacoco:report>
            <executiondata>
                <fileset dir="build">
                    <include name="*.exec"/>
                </fileset>
            </executiondata>

            <structure name="Apache POI">
                <group name="Main">
                    <classfiles>
                        <fileset dir="${main.output.dir}">
                            <!-- exclude some generated classes -->
                            <exclude name="org/apache/poi/sl/draw/binding/*.class"/>
                            <!-- exclude large test-class -->
                            <exclude name="org/apache/poi/hssf/usermodel/DummyGraphics2d.class"/>
                        </fileset>
                    </classfiles>
                    <sourcefiles encoding="UTF-8">
                        <fileset dir="${main.src}"/>
                    </sourcefiles>
                </group>
                <group name="Scratchpad">
                    <classfiles>
                        <fileset dir="${scratchpad.output.dir}">
                            <!-- exclude some generated classes -->
                            <exclude name="org/apache/poi/hwpf/model/types/*.class"/>
                            <exclude name="org/apache/poi/hdf/model/hdftypes/definitions/*.class"/>
                        </fileset>
                    </classfiles>
                    <sourcefiles encoding="UTF-8">
                        <fileset dir="${scratchpad.src}"/>
                    </sourcefiles>
                </group>
                <group name="OOXML">
                    <classfiles>
                        <fileset dir="${ooxml.output.dir}"/>
                        <!-- there are no actual POI classes in build/ooxml-lite-classes, only generated code... -->
                    </classfiles>
                    <sourcefiles encoding="UTF-8">
                        <fileset dir="${ooxml.src}"/>
                        <!--fileset dir="${ooxml.lite.src}"/-->
                    </sourcefiles>
                </group>
                <group name="Excelant">
                    <classfiles>
                        <fileset dir="${excelant.output.dir}"/>
                    </classfiles>
                    <sourcefiles encoding="UTF-8">
                        <fileset dir="${excelant.src}"/>
                    </sourcefiles>
                </group>
                <!--group name="Examples">
                    <classfiles>
                        <fileset dir="${examples.output.dir}"/>
                    </classfiles>
                    <sourcefiles encoding="UTF-8">
                        <fileset dir="${examples.src}"/>
                    </sourcefiles>
                </group-->
            </structure>

            <html destdir="${coverage.dir}"/>
            <xml destfile="${coverage.dir}/coverage.xml"/>
        </jacoco:report>

        <echo message="Coverage results are available at ${coverage.dir}/index.html, ${coverage.dir}/coverage.xml" />
    </target>

    <!-- Section: test-main -->
    <target name="-test-main-check">
        <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
            <srcfiles dir="${main.src}"/>
            <srcfiles dir="${main.src.test}"/>
        </uptodate>
    </target>

    <target name="test-main" unless="main.test.notRequired"
            depends="compile-main, -test-main-check,jacocotask"
            description="tests POI classes that deal with the Microsoft Office binary (BIFF8) file formats (excludes OOXML)">

        <path id="test-main.modules">
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
        </path>

        <poiunit failureproperty="main.test.failed" heap="256" showoutput="true" jacocodest="build/jacoco-main.exec"
                 modulepath-ref="test-main.modules" module1="poi" outputDir="${main.reports.test}">
            <zipfileset src="build/dist/maven/poi-tests/poi-${version.id}-tests.jar">
                <include name="**/${testpattern}.class"/>
                <exclude name="**/*$*.class"/>
                <exclude name="**/All*Tests.class"/>
                <exclude name="**/TestUnfixedBugs.class"/>
                <exclude name="**/TestcaseRecordInputStream.class"/>
                <exclude name="**/${testexcludepattern}.class"/>
                <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
            </zipfileset>
        </poiunit>

        <delete file="${main.testokfile}"/>
        <antcall target="-test-main-write-testfile"/>
    </target>

    <target name="test-report" depends="init">
        <mkdir dir="build/report"/>
        <junitreport todir="build/report">
          <fileset dir=".">
            <include name="**/build/test-results/**/TEST-*.xml"/>
          </fileset>
          <report format="frames" todir="build/report"/>
        </junitreport>
        <echo message="Published results from tests at build/report/index.html"/>
    </target>

    <target name="-test-property-check" unless="testcase">
        <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
        <fail/>
    </target>

    <target name="-test-main-write-testfile" unless="main.test.failed">
        <echo file="${main.testokfile}" append="false" message="testok"/>
    </target>

    <!-- Section: test-scratchpad -->
    <target name="-test-scratchpad-check">
        <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
            <srcfiles dir="${scratchpad.src}"/>
            <srcfiles dir="${scratchpad.src.test}"/>
        </uptodate>
    </target>


    <target name="test-scratchpad" depends="jacocotask,compile-scratchpad,-test-scratchpad-check,test-scratchpad-download-resources"
            unless="scratchpad.test.notRequired"
            description="test non-OOXML scratchpad classes">

        <path id="test-scratchpad.modules">
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
        </path>

        <poiunit failureproperty="scratchpad.test.failed" heap="512" jacocodest="build/jacoco-scratchpad.exec"
                 modulepath-ref="test-scratchpad.modules" module1="scratchpad" outputDir="${scratchpad.reports.test}">
            <zipfileset src="build/dist/maven/poi-scratchpad-tests/poi-scratchpad-${version.id}-tests.jar">
                <include name="**/${testpattern}.class"/>
                <exclude name="**/*$*.class"/>
                <exclude name="**/All*Tests.class"/>
                <exclude name="**/${testexcludepattern}.class"/>
                <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
            </zipfileset>
        </poiunit>
        <delete file="${scratchpad.testokfile}"/>
        <antcall target="-test-scratchpad-write-testfile"/>
    </target>

    <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
        <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
    </target>

    <!-- Section: test-ooxml -->
    <target name="-test-ooxml-check">
        <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
            <srcfiles dir="${ooxml.src}"/>
            <srcfiles dir="${ooxml.src.test}"/>
        </uptodate>
    </target>

    <macrodef name="ooxml-test-runner" xmlns:jacoco="antlib:org.jacoco.ant">
        <attribute name="modulepath-ref"/>
        <attribute name="type"/>
        <sequential>
            <poiunit failureproperty="ooxml.test.failed" heap="768" jacocodest="build/jacoco-@{type}.exec"
                     modulepath-ref="@{modulepath-ref}" module1="ooxml" module2="scratchpad" module3="org.bouncycastle.pkix"
                     module4="org.slf4j" outputDir="${ooxml.reports.test}">
                <zipfileset src="build/dist/maven/poi-ooxml-tests/poi-ooxml-${version.id}-tests.jar">
                    <include name="**/${testpattern}.class"/>
                    <exclude name="**/*$*.class"/>
                    <exclude name="**/All*Tests.class"/>
                    <exclude name="**/TestUnfixedBugs.class"/>
                    <exclude name="**/${testexcludepattern}.class"/>
                    <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
                </zipfileset>
            </poiunit>
        </sequential>
    </macrodef>

    <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check,jacocotask" unless="ooxml.test.notRequired"
            description="test OOXML classes">
        <path id="test-ooxml.modules">
            <!-- full schema -->
            <pathelement path="build/dist/maven/poi-ooxml-full"/>
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml-tests"/>
            <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
            <pathelement path="lib/ooxml"/>
            <pathelement path="lib/ooxml-provided"/>
            <pathelement path="lib/ooxml-tests"/>
        </path>

        <ooxml-test-runner modulepath-ref="test-ooxml.modules" type="ooxml"/>
        <delete file="${ooxml.testokfile}"/>
        <antcall target="-test-ooxml-write-testfile"/>
    </target>

    <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
        <echo file="${ooxml.testokfile}" append="false" message="testok"/>
    </target>

    <!-- Section: test-integration -->
    <target name="-test-integration-check">
        <uptodate property="integration.test.notRequired" targetfile="${integration.testokfile}">
            <srcfiles dir="${integration.src.test}"/>
        </uptodate>
    </target>

    <target name="test-integration" depends="compile-integration,-test-integration-check,jacocotask"
            unless="integration.test.notRequired">
        <delete dir="build" includes="test-integration.log*"/>

        <path id="test-integration.modules">
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml"/>
            <pathelement path="build/dist/maven/poi-scratchpad"/>
            <pathelement path="build/dist/maven/poi-examples"/>
            <pathelement path="build/dist/maven/poi-ooxml-full"/>
            <pathelement path="build/dist/maven/poi-integration"/>
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
            <pathelement path="lib/ooxml"/>
            <pathelement path="lib/ooxml-provided"/>
            <pathelement path="lib/ooxml-tests"/>
        </path>

        <poiunit failureproperty="integration.test.failed" heap="1512" showoutput="true" jacocodest="build/jacoco-integration.exec"
                 modulepath-ref="test-integration.modules" module1="stress" outputDir="${integration.reports.test}">
            <zipfileset src="build/dist/maven/poi-integration/poi-integration-${version.id}.jar">
                <include name="**/${testpattern}.class"/>
                <exclude name="**/*$*.class"/>
                <exclude name="**/${testexcludepattern}.class"/>
                <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
            </zipfileset>
        </poiunit>
        <delete file="${integration.testokfile}"/>
        <antcall target="-test-integration-write-testfile"/>
    </target>

    <target name="-test-integration-write-testfile" unless="integration.test.failed">
        <echo file="${integration.testokfile}" append="false" message="testok"/>
    </target>

    <!-- the ooxml lite agent collects referenced schema files while other junit tests are run, -->
    <!-- therefore its best to compile the ooxml lite jar after all usual tests are done -->
    <target name="compile-ooxml-lite" depends="test-ooxml">
        <echo message="Create ooxml-lite schemas"/>
        <local name="lite.exports"/>
        <loadresource property="lite.exports">
            <file file="${ooxml.lite.report}.clazz"/>
            <filterchain>
                <tokenfilter>
                    <replaceregex pattern="[/\\][^/\\]+$" replace=""/>
                    <replaceregex pattern="[/\\]" replace="." flags="g"/>
                </tokenfilter>
                <linecontainsregexp negate="true" regexp="\.impl$"/>
                <sortfilter/>
                <uniqfilter/>
                <prefixlines prefix="    exports "/>
                <suffixlines suffix=";"/>
            </filterchain>
        </loadresource>

        <local name="full.schema"/>
        <loadresource property="full.schema">
            <file file="${basedir}/poi-ooxml-full/src/main/java9/module-info.java"/>
            <filterchain>
                <linecontains negate="true" matchany="true">
                    <contains value="exports"/>
                    <contains value="}"/>
                </linecontains>
            </filterchain>
        </loadresource>

        <echo output="${basedir}/poi-ooxml-lite/src/main/java9/module-info.java">${full.schema}${lite.exports}}</echo>

        <javac release="9"
               srcdir="${basedir}/poi-ooxml-lite/src/main/java9"
               destdir="${basedir}/poi-ooxml-lite/src/main/java9"
               includeantruntime="false"
               fork="true"
               unless:true="${isJava8}">
            <compilerarg line="--patch-module org.apache.poi.ooxml.schemas=${ooxml.xsds.jar}"/>
            <modulepath>
                <pathelement path="lib/ooxml"/>
            </modulepath>
        </javac>

        <copy file="${ooxml.lite.report}.clazz" tofile="${ooxml.lite.report}.clazz1" overwrite="true">
            <filterchain>
                <sortfilter/>
                <suffixlines suffix="$*.class"/>
            </filterchain>
        </copy>

        <copy file="${ooxml.lite.report}.clazz" tofile="${ooxml.lite.report}.clazz2" overwrite="true">
            <filterchain>
                <sortfilter/>
                <suffixlines suffix=".class"/>
            </filterchain>
        </copy>

        <copy file="${ooxml.lite.report}.xsb" tofile="${ooxml.lite.report}.xsb2" overwrite="true">
            <filterchain>
                <sortfilter/>
                <prefixlines prefix="org/apache/poi/schemas/ooxml/system/ooxml/"/>
                <suffixlines suffix=".xsb"/>
            </filterchain>
        </copy>

        <mkdir dir="build/dist/maven/poi-ooxml-lite"/>

        <jar destfile="${ooxml.lite.jar}" duplicate="fail">
            <zipfileset dir="${basedir}/poi-ooxml-lite/src/main/java9" prefix="META-INF/versions/9" excludes="*.java"/>
            <zipfileset src="${ooxml.xsds.jar}">
                <patternset>
                    <includesfile name="${ooxml.lite.report}.clazz1"/>
                    <includesfile name="${ooxml.lite.report}.clazz2"/>
                    <includesfile name="${ooxml.lite.report}.xsb2"/>
<!--                    <include name="org/apache/poi/schemas/ooxml/system/ooxml/*.xsb"/>-->
                    <include name="org/apache/poi/schemas/ooxml/element/**/*.xsb"/>
                </patternset>
            </zipfileset>
            <manifest>
                <attribute name="Multi-Release" value="true"/>
                <attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml.schemas"/>
            </manifest>
        </jar>

        <delete file="${ooxml.lite.report}.clazz1"/>
        <delete file="${ooxml.lite.report}.clazz2"/>
        <delete file="${ooxml.lite.report}.xsb2"/>
    </target>

    <target name="test-ooxml-lite" depends="jacocotask,compile-ooxml-lite">
        <delete file="${ooxml.testokfile}"/>
        <echo message="Running ooxml tests against 'poi-ooxml-lite'"/>

        <path id="test-ooxml-lite.modules">
            <!-- lite schema -->
            <pathelement path="build/dist/maven/poi-ooxml-lite"/>
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml-tests"/>
            <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
            <pathelement path="lib/ooxml"/>
            <pathelement path="lib/ooxml-provided"/>
            <pathelement path="lib/ooxml-tests"/>
        </path>


        <ooxml-test-runner modulepath-ref="test-ooxml-lite.modules" type="ooxml-lite"/>
    </target>

    <!-- Section: test-excelant -->
    <target name="-test-excelant-check">
        <uptodate property="excelant.test.notRequired" targetfile="${excelant.testokfile}">
            <srcfiles dir="${excelant.src}"/>
            <srcfiles dir="${excelant.src.test}"/>
        </uptodate>
    </target>

    <target name="-test-excelant-write-testfile" unless="excelant.test.failed">
        <echo file="${excelant.testokfile}" append="false" message="testok"/>
    </target>

    <target name="test-excelant" depends="compile-excelant,compile-ooxml-lite,-test-excelant-check,jacocotask"
            unless="excelant.test.notRequired">

        <path id="test-excelant.modules">
            <pathelement path="lib/main"/>
            <pathelement path="lib/main-tests"/>
            <pathelement path="lib/ooxml"/>
            <pathelement path="lib/ooxml-tests"/>
            <pathelement path="lib/ooxml-provided"/>
            <pathelement path="lib/excelant"/>
            <pathelement path="build/dist/maven/poi-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml-tests"/>
            <pathelement path="build/dist/maven/poi-ooxml-lite"/>
            <pathelement path="build/dist/maven/poi-scratchpad-tests"/>
            <pathelement path="build/dist/maven/poi-excelant-tests"/>
        </path>

        <poiunit failureproperty="excelant.test.failed" jacocodest="build/jacoco-excelant.exec"
                 modulepath-ref="test-excelant.modules" module1="excelant" outputDir="${excelant.reports.test}">
            <zipfileset src="build/dist/maven/poi-excelant-tests/poi-excelant-${version.id}-tests.jar">
                <include name="**/${testpattern}.class"/>
                <exclude name="**/*$*.class"/>
                <exclude name="**/${testexcludepattern}.class"/>
                <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
            </zipfileset>
        </poiunit>
        <delete file="${excelant.testokfile}"/>
        <antcall target="-test-excelant-write-testfile"/>
    </target>

    <!-- GENERATE DOCUMENTATION -->

    <!-- Section: docs -->
    <target name="-check-docs">
        <echo message="Checking if documentation recreation is necessary, i.e. if any file at ${main.documentation} is newer than ${build.site}/index.html"/>
        <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
            <srcfiles dir="${main.documentation}" />
        </uptodate>
        <echo message="Had result: ${main.docs.notRequired}"/>
    </target>

    <target name="-check-forrest-installed" unless="env.FORREST_HOME">
        <echo>Please install Apache Forrest (see
            &lt;https://forrest.apache.org/index.html&gt;) and set the
            FORREST_HOME environment variable!
        </echo>
        <fail message="Apache Forrest is not installed."/>
    </target>

    <target name="docs" depends="init, -check-forrest-installed, -check-docs, javadocs, -forrest-docs"
            unless="main.docs.notRequired"
            description="Builds the POI website" />

    <target name="site" depends="-forrest-docs"/>

    <target name="-forrest-docs" depends="-check-forrest-installed, -check-docs"
            unless="main.docs.notRequired" description="Builds the HTML pages of the POI website">
        <echo message="Using Apache Forrest from ${env.FORREST_HOME}"/>

        <echo message="Adjusting http -> https in forrset itself"/>
        <replace dir="${env.FORREST_HOME}"
                 token="'http://'"
                 value="'https://'"
                 summary="true"
                 includes="**/*.xsl"/>

        <exec executable="${env.FORREST_HOME}/bin/forrest" osfamily="unix"/>
        <exec executable="cmd" osfamily="windows">
            <arg value="/c"/>
            <arg value="${env.FORREST_HOME}/bin/forrest.bat"/>
        </exec>

        <echo>Broken links:</echo>
        <echo file="${build.site}/../tmp/brokenlinks.xml"/>

        <!-- Apache Forrest is dead, so we cannot expect fixes there
            however it does not handle "https" in "credits" currently
            if the *.xml file is in a sub-directory, see Apache Forrest
            code at main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl:350

            So we need to replace the links afterwards to have a fully "https"
            website and avoid browser warning about a "mixed content"
            website -->
        <echo>Fix https in ${build.site}</echo>
        <replace dir="${build.site}"
            token="http://www.apache.org/events/current-event-125x125.png"
            value="https://www.apache.org/events/current-event-125x125.png"
            summary="true"
            includes="**/*.html"/>
        <replace dir="${build.site}"
            token="http://www.google.com/search"
            value="https://www.google.com/search"
            summary="true"
            includes="**/*.html"/>
        <replace dir="${build.site}"
            token="http://validator.w3.org"
            value="https://validator.w3.org"
            summary="true"
            includes="**/*.html"/>
        <replace dir="${build.site}"
            token="http://jigsaw.w3.org"
            value="https://jigsaw.w3.org"
            summary="true"
            includes="**/*.html"/>

        <fixcrlf srcdir="${build.site}" includes="**/*.html,**/*.css" eol="unix" eof="remove" />

        <touch>
            <fileset dir="${build.site}"/>
        </touch>
    </target>

    <!-- Generates the latest/development API documentation. -->
    <target name="javadocs"
            description="Generates the API documentation">
        <echo message="Generating latest Javadocs in ${javadocs.report.dir}"/>
        <javadoc verbose="false" author="true" destdir="${javadocs.report.dir}"
                 windowtitle="POI API Documentation" use="true" version="true"
                 maxmemory="384M" additionalparam="-notimestamp" locale="en_US"
                 classpathref="javadoc.classpath">
            <packageset dir="${main.src}" defaultexcludes="yes">
                <include name="org/apache/poi/**"/>
            </packageset>
            <packageset dir="${scratchpad.src}" defaultexcludes="yes">
                <include name="org/apache/poi/**"/>
                <exclude name="org/apache/poi/hdf/**"/>
            </packageset>
            <packageset dir="${ooxml.src}" defaultexcludes="yes">
                <include name="org/apache/poi/**"/>
            </packageset>

            <arg value="--add-modules=java.xml.bind" if:true="${addOpens10}"/>

            <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
            <bottom>
                <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
        its licensors, as applicable.</i>]]>
            </bottom>
            <group>
                <title>DDF - Dreadful Drawing Format</title>
                <package name="org.apache.poi.ddf*"/>
            </group>
            <group>
                <title>XDDF - Open Office XML Dreadful Drawing Format</title>
                <package name="org.apache.poi.xddf*"/>
            </group>

            <group>
                <title>HPSF - Horrible Property Set Format</title>
                <package name="org.apache.poi.hpsf*"/>
            </group>

            <group>
                <title>SS - Common Spreadsheet Format</title>
                <package name="org.apache.poi.ss*"/>
            </group>
            <group>
                <title>HSSF - Horrible Spreadsheet Format</title>
                <package name="org.apache.poi.hssf*"/>
            </group>
            <group>
                <title>XSSF - Open Office XML Spreadsheet Format</title>
                <package name="org.apache.poi.xssf*"/>
            </group>

            <group>
                <title>SL - Common Slideshow Format</title>
                <package name="org.apache.poi.sl*"/>
            </group>
            <group>
                <title>HSLF - Horrible Slideshow Format</title>
                <package name="org.apache.poi.hslf*"/>
            </group>
            <group>
                <title>XSLF - Open Office XML Slideshow Format</title>
                <package name="org.apache.poi.xslf*"/>
            </group>

            <group>
                <title>HWPF - Horrible Word Processor Format</title>
                <package name="org.apache.poi.hwpf*"/>
            </group>
            <group>
                <title>XWPF - Open Office XML Word Processor Format</title>
                <package name="org.apache.poi.xwpf*"/>
            </group>

            <group>
                <title>HDGF - Horrible Diagram Format</title>
                <package name="org.apache.poi.hdgf*"/>
            </group>
            <group>
                <title>XDGF - Open Office XML Diagram Format</title>
                <package name="org.apache.poi.xdgf*"/>
            </group>

            <group>
                <title>POIFS - POI File System</title>
                <package name="org.apache.poi.poifs*"/>
            </group>
            <group>
                <title>Utilities</title>
                <package name="org.apache.poi.util*"/>
                <package name="org.apache.poi.ooxml.util*"/>
            </group>
            <group>
                <title>Common</title>
                <package name="org.apache.poi.common*"/>
            </group>
            <group>
                <title>Extractor</title>
                <package name="org.apache.poi.extractor*"/>
                <package name="org.apache.poi.ooxml.extractor*"/>
            </group>
            <group>
                <title>Examples</title>
                <package name="org.apache.poi.examples*"/>
            </group>
        </javadoc>
    </target>

    <macrodef name="maven-jar">
        <attribute name="src"/>
        <attribute name="module"/>
        <element name="elements" implicit="true" optional="true"/>

        <sequential>
            <local name="destfile"/>
            <pathconvert property="destfile" targetos="unix">
                <path><pathelement path="@{src}"/></path>
                <mapper>
                    <chainedmapper>
                        <filtermapper>
                            <replaceregex pattern=".jar" replace="" flags="g"/>
<!--                            <replaceregex pattern="ooxml-lite" replace="ooxml-schemas" flags="g"/>-->
                            <replaceregex pattern="(.java|.src)$$" replace="-sources"/>
                            <replaceregex pattern=".*(?:build|src).?(.*)?" replace="\1"/>
                            <replaceregex pattern="(.*)(-classes|-sources)" replace="poi-\1/poi-\1-${version.id}\2"/>
                            <replaceregex pattern="^(classes|sources)$$" replace="poi/poi-${version.id}-\1"/>
                            <replaceregex pattern="-classes" replace=""/>
                        </filtermapper>
                    </chainedmapper>
                </mapper>
            </pathconvert>

            <local name="isjar"/>
            <condition property="isjar">
                <contains string="@{src}" substring=".jar"/>
            </condition>

            <mkdir dir="@{src}/META-INF/versions/9"/>

            <local name="module-name"/>
            <loadresource property="module-name">
                <string>@{module}</string>
                <filterchain>
                    <replacestring from="poi-" to=""/>
                </filterchain>
            </loadresource>

            <echo message="Building maven-jar for @{module}, module-name: ${module-name} with isJava8: ${isJava8} and src: @{src}"/>

            <javac release="9"
                   srcdir="${basedir}/@{module}/src/main/java9"
                   destdir="@{src}/META-INF/versions/9"
                   includeantruntime="false"
                   fork="true"
                   modulepath="${main.lib}"
                   unless:true="${isJava8}">
                <compilerarg line="--patch-module org.apache.poi.${module-name}=@{src}"/>
                <elements/>
            </javac>

            <jar destfile="build/dist/maven/${destfile}.jar">
                <fileset dir="@{src}" unless:true="${isjar}"/>
                <zipfileset src="@{src}" if:true="${isjar}"/>
                <metainf dir="legal/" excludes="HEADER"/>
                <manifest>
                    <attribute name="Multi-Release" value="true"/>
                    <attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
                    <attribute name="Built-By" value="${user.name}"/>
                    <attribute name="Specification-Title" value="Apache POI"/>
                    <attribute name="Specification-Version" value="${version.id}"/>
                    <attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
                    <attribute name="Implementation-Title" value="Apache POI"/>
                    <attribute name="Implementation-Version" value="${version.id}"/>
                    <attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
                    <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
                </manifest>
            </jar>
        </sequential>
    </macrodef>

    <target name="jar" depends="compile, compile-ooxml-lite" description="Creates jar files for distribution">
    </target>

    <target name="-do-jar-check-javadocs-package-list">
        <condition property="javadocs.package-list.present">
            <available file="${javadocs.report.dir}/package-list"/>
        </condition>
    </target>

    <target name="-do-jar-create-javadocs-package-list"
        depends="-do-jar-check-javadocs-package-list"
        unless="javadocs.package-list.present">
        <antcall target="javadocs"/>
    </target>

    <target name="jar-javadocs" description="JavaDocs for Maven" depends="compile,-do-jar-create-javadocs-package-list">
        <property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/>

        <manifest file="build/poi-manifest.mf">
            <attribute name="Multi-Release" value="true"/>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title" value="Apache POI"/>
            <attribute name="Specification-Version" value="${version.id}"/>
            <attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
            <attribute name="Implementation-Title" value="Apache POI"/>
            <attribute name="Implementation-Version" value="${version.id}"/>
            <attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
            <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
        </manifest>

        <!-- Build and package the main javadocs -->
        <maven-javadocs src="${main.src}" dest="${jar.name}"/>
        <!-- Build and package the scratchpad javadocs -->
        <maven-javadocs src="${scratchpad.src}" dest="${jar.name}-scratchpad"/>
        <!-- Build and package the ooxml javadocs -->
        <maven-javadocs src="${ooxml.src}" dest="${jar.name}-ooxml"/>
    </target>

    <macrodef name="maven-javadocs">
        <attribute name="src"/>
        <attribute name="dest"/>
        <sequential>
            <echo message="Building @{dest} javadocs from @{src}" />
            <local name="build.maven.javadocs"/>
            <property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/>
            <delete dir="${build.maven.javadocs}"/>
            <mkdir dir="${build.maven.javadocs}"/>
            <javadoc verbose="false" author="false" destdir="${build.maven.javadocs}"
                     windowtitle="POI API Documentation" use="false" version="false"
                     maxmemory="384M" additionalparam="-notimestamp -quiet" locale="en_US"
                     classpathref="javadoc.classpath">
                <packageset dir="@{src}" defaultexcludes="yes">
                    <include name="org/apache/poi/**"/>
                </packageset>
                <link offline="true" href="https://poi.apache.org/apidocs/dev" packagelistLoc="${javadocs.report.dir}"/>
            </javadoc>
            <jar destfile="${dist.dir}/maven/@{dest}/@{dest}-${version.id}-javadoc.jar"
                 manifest="build/poi-manifest.mf">
                <fileset dir="${build.maven.javadocs}"/>
                <metainf dir="legal/" excludes="HEADER"/>
            </jar>
        </sequential>
    </macrodef>

    <target name="release-notes" depends="init">
        <copy file="src/documentation/RELEASE-NOTES.txt" todir="build/dist/" overwrite="true">
            <filterset>
                <filter token="VERSION" value="${version.id}"/>
                <filter token="DSTAMP"  value="${DSTAMP}"/>
                <filter token="RELEASE_TAG" value="${RELEASE_TAG}"/>
            </filterset>
        </copy>
    </target>

    <target name="assemble" depends="jar,jar-javadocs" description="Produce the zipped distribution files">
        <property name="zipdir" value="${jar.name}-${version.id}"/>

        <mappedresources id="legal-files" cache="true">
            <fileset dir="legal" excludes="HEADER"/>
            <globmapper from="*" to="${zipdir}/*"/>
        </mappedresources>

        <!-- patterns to exclude from source assemblies -->
        <union id="src-files" cache="true">
            <mappedresources refid="legal-files"/>
            <mappedresources cache="true">
                <fileset dir="." excludes="*/build/**,build/**,
                      dist*/**,
                      lib/**,
                      bin/**,
                      out/**,
                      tmp/**,
                      gradle/**,
                      compile-lib/**,
                      ooxml-lib/**,
                      ooxml-testlib/**,
                      scripts/**,
                      TEST*,
                      gradlew,
                      gradlew.bat
                      *.ipr,
                      **/*.iml,
                      *.iws,
                      *.lnk,
                      *.rdf,
                      *.swp,
                      *.launch,
                      *.log,
                      .gradle/**,
                      .idea/**,
                      .settings/**,
                      .classpath,
                      .settings/**,
                      .project"/>
                <globmapper from="*" to="${zipdir}/*"/>
            </mappedresources>
        </union>

        <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
            <union refid="src-files"/>
        </zip>

        <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz" longfile="gnu" compression="gzip">
            <union refid="src-files"/>
        </tar>

        <echo>Distribution located in ${dist.dir}</echo>
        <echo>Use "ant dist-checksum" to create sha256/sha512 checksums and GPG signatures</echo>
    </target>

    <target name="osgi">
       <echo message="Building OSGi bundle via Maven" />
       <mvn:mvn pom="osgi/pom.xml">
          <arg value="-Dpoi.version=${version.id}" />
          <arg value="install" />
       </mvn:mvn>
    </target>

    <target name="dist" depends="clean, compile, test-all, rat-check, forbidden-apis-check, docs, jar, release-notes, assemble"
            description="Creates the entire distribution into build/dist, from scratch">
    </target>

    <!-- continuous integration targets -->
    <target name="jenkins"
        depends="replaceVersion, compile, test-all, jar, javadocs, assemble, findbugs, release-notes, rat-check, forbidden-apis-check, help, maventask"
        description="Target run by Jenkins on a continuous basis. Builds and tests POI, generates artifacts and documentation, and searches for problems."/>

    <target name="maventask" depends="init">
        <downloadfile src="${maven.ant.url}" dest="${maven.ant.jar}"/>

        <path id="maven-ant-tasks.classpath">
            <pathelement location="${maven.ant.jar}"/>
        </path>

        <taskdef uri="antlib:org.apache.maven.artifact.ant" resource="org/apache/maven/artifact/ant/antlib.xml">
            <classpath refid="maven-ant-tasks.classpath"/>
        </taskdef>
    </target>

    <target name="rat-check" depends="init" description="Runs the Apache Creadur Rat check against the source code, to spot any files which are missing the correct license headers">
        <mkdir dir="${rat.reportdir}" />

        <typedef resource="org/apache/rat/anttasks/antlib.xml"
             uri="antlib:org.apache.rat.anttasks"
             classpath="${rat.jar}" />
        <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}">
            <fileset dir="poi-examples/src" excludes="main/java/org/apache/poi/**/*-chart-data.txt"/>
            <fileset dir="poi-excelant/src"/>
            <fileset dir="poi-integration/src"/>
            <fileset dir="poi/src">
                <exclude name="main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml" />
            </fileset>
            <fileset dir="poi-ooxml/src">
                <exclude name="main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml" />
                <exclude name="main/resources/org/apache/poi/xslf/usermodel/empty.pptx" />
                <exclude name="main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml" />
            </fileset>
            <fileset dir="poi-ooxml-full/src">
                <exclude name="main/xmlschema/org/apache/poi/xdgf/visio.xsd" />
                <exclude name="main/xmlschema/org/apache/poi/schemas/*.xsd" />
                <exclude name="main/xmlschema/org/apache/poi/schemas/*.zip" />
            </fileset>
            <fileset dir="poi-scratchpad/src"/>

            <fileset dir="src">
                <exclude name="documentation/*.txt" />
                <exclude name="documentation/content/xdocs/dtd/" />
                <exclude name="documentation/content/xdocs/entity/" />
                <exclude name="documentation/resources/images/pb-poi.cdr"/>
                <exclude name="resources/ooxml-lite-report.*"/>
            </fileset>
        </rat:report>

        <!-- remove clutter to compact build output -->
        <!-- replaceregexp doesn't work within loadfile ... -->
        <replaceregexp file="${rat.report}" match="\s+Printing headers for files without AL header.++" replace="" flags="s"/>

        <loadfile property="rat.reportcontent" srcFile="${rat.report}">
            <filterchain>
                <linecontainsregexp negate="true">
                    <regexp pattern="^\s+(AL|B|N)\s+"/>
                </linecontainsregexp>
            </filterchain>
        </loadfile>
        <echo>${rat.reportcontent}</echo>

        <!-- fail the build if at least one note is in the report -->
        <fail><condition><matches pattern="[1-9][0-9]* Unknown Licens" string="${rat.reportcontent}"/></condition></fail>
    </target>

    <!-- Runs the Forbidden APIs checker against the source code, to -->
    <!--  spot any cases where we've accidently used methods we shouldn't -->
    <!-- See https://github.com/policeman-tools/forbidden-apis for details -->
    <!--  of the checks that this can do -->
    <target name="forbidden-apis-check" depends="init, compile, compile-integration">
        <taskdef name="forbiddenapis"
                 classname="de.thetaphi.forbiddenapis.ant.AntTask"
                 classpath="${forbidden.jar}"/>

        <path id="forbiddenapis.classpath">
            <fileset dir="lib/main" includes="*.jar"/>
            <fileset dir="lib/main-tests" includes="*.jar"/>
            <fileset dir="lib/ooxml" includes="*.jar"/>
            <fileset dir="lib/ooxml-batik" includes="xml-apis-ext*.jar"/>
            <fileset dir="lib/ooxml-tests" includes="*.jar"/>
            <fileset dir="lib/ooxml-provided" includes="*.jar"/>
            <fileset dir="lib/excelant" includes="*.jar"/>
            <pathelement location="${ooxml.xsds.jar}"/>
            <pathelement location="build/dist/maven/poi-tests/poi-${version.id}-tests.jar"/>
            <pathelement location="build/dist/maven/poi-examples/poi-examples-${version.id}.jar"/>
            <path path="${env.CLASSPATH}"/>
            <path refid="batik.classpath"/>
        </path>

        <!-- forbiddenapis bundled signatures max supported version is 14 -->
        <condition property="forbiddenVersion" value="14">
            <javaversion atleast="15"/>
        </condition>
        <property name="forbiddenVersion" value="${ant.java.version}"/>

        <!-- first check rules that apply to all the source code -->
        <forbiddenapis
                 classpathref="forbiddenapis.classpath"
                 suppressAnnotation="org.apache.poi.util.SuppressForbidden"
                 targetVersion="${forbiddenVersion}"
            >
            <bundledsignatures name="jdk-unsafe"/>
            <bundledsignatures name="jdk-deprecated"/>
            <bundledsignatures name="jdk-internal"/>
            <bundledsignatures name="jdk-non-portable"/>
            <bundledsignatures name="jdk-reflection"/>
            <!--
            <bundledsignatures name="jdk-system-out"/>
            -->
            <signaturesFileset file="src/resources/devtools/forbidden-signatures.txt"/>
            <!-- use the plain test-/classes instead of the dist-zips, otherwise forbidden-apis is soo slow ... -->
            <fileset dir="${main.output.dir}"/>
            <fileset dir="${main.output.test.dir}"/>
            <fileset dir="${scratchpad.output.dir}"/>
            <fileset dir="${scratchpad.output.test.dir}"/>
            <fileset dir="${examples.output.dir}"/>
            <fileset dir="${ooxml.output.dir}"/>
            <fileset dir="${ooxml.output.test.dir}"/>
            <fileset dir="${excelant.output.dir}"/>
            <fileset dir="${excelant.output.test.dir}"/>
            <fileset dir="${integration.output.test.dir}"/>
        </forbiddenapis>

        <!-- then check some advanced rules which we only apply to the core code and not tests or examples -->
        <forbiddenapis
                 classpathref="forbiddenapis.classpath"
                 suppressAnnotation="org.apache.poi.util.SuppressForbidden"
                 targetVersion="${forbiddenVersion}"
            >
            <signaturesFileset file="src/resources/devtools/forbidden-signatures-prod.txt"/>
            <!-- sources -->
            <fileset dir="${main.output.dir}"/>
            <fileset dir="${ooxml.output.dir}"/>
            <fileset dir="${scratchpad.output.dir}"/>
            <fileset dir="${excelant.output.dir}"/>
        </forbiddenapis>
    </target>

    <!-- disabling findbugs until jenkins is updated to a current IBM JDK
         see https://stackoverflow.com/a/48561534/2066598
         this should be replaced by spotbugs when available in the jenkins warnings plugin -->
    <target name="findbugs" depends="jar" unless="${isIBMVM}">
        <property name="spotbugs.home" value="build/findbugs" />
        <property name="spotbugs.lib" value="/build/findbugs/lib" />

        <!-- findbugs successor, spotbugs ... need to use the dependencies used in the spotbugs release. -->
        <!-- compare with the entries found in the MANIFEST.MF of spotbugs.jar -->
        <dependency prefix="spotbugs" artifact="com.github.spotbugs:spotbugs:4.7.3" usage="${spotbugs.lib}" target="spotbugs.jar"/>
        <dependency prefix="spotbugs-ant" artifact="com.github.spotbugs:spotbugs-ant:4.7.3" usage="${spotbugs.lib}" target="spotbugs-ant.jar"/>
        <dependency prefix="spotbugs-anno" artifact="com.github.spotbugs:spotbugs-annotations:4.7.3" usage="${spotbugs.lib}" target="spotbugs-annotations.jar"/>
        <dependency prefix="spotbugs.asm" artifact="org.ow2.asm:asm:9.5" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.asm-analysis" artifact="org.ow2.asm:asm-analysis:9.5" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.asm-commons" artifact="org.ow2.asm:asm-commons:9.5" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.asm-tree" artifact="org.ow2.asm:asm-tree:9.5" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.asm-util" artifact="org.ow2.asm:asm-util:9.5" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.jsr305" artifact="com.google.code.findbugs:jsr305:3.0.2" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.dom4j" artifact="org.dom4j:dom4j:2.1.3" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.jaxen" artifact="jaxen:jaxen:1.2.0" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.bcel" artifact="org.apache.bcel:bcel:6.5.0" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.slf4j-api" artifact="org.slf4j:slf4j-api:2.0.0" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.commons-text" artifact="org.apache.commons:commons-text:1.11.0" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.commons-codec" artifact="commons-codec:commons-codec:1.17.1" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.commons-logging" artifact="commons-logging:commons-logging:1.2" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.jcip-annotations" artifact="net.jcip:jcip-annotations:1.0" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.icu4j" artifact="com.ibm.icu:icu4j:68.2" usage="${spotbugs.lib}" target="icu4j-68.2.jar"/>
        <dependency prefix="spotbugs.log4j-api" artifact="org.apache.logging.log4j:log4j-api:2.24.1" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.log4j-core" artifact="org.apache.logging.log4j:log4j-core:2.24.1" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.log4j-slf4j18-impl" artifact="org.apache.logging.log4j:log4j-slf4j2-impl:2.24.1" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.saxon" artifact="net.sf.saxon:Saxon-HE:12.5" usage="${spotbugs.lib}"/>
        <dependency prefix="spotbugs.xmlresolver" artifact="org.xmlresolver:xmlresolver:4.2.0" usage="${spotbugs.lib}"/>

        <mkdir dir="${basedir}${spotbugs.lib}/config"/>

        <downloadfile src="${spotbugs.url}" dest="${spotbugs.jar}"/>
        <downloadfile src="${spotbugs-ant.url}" dest="${spotbugs-ant.jar}"/>
        <downloadfile src="${spotbugs-anno.url}" dest="${spotbugs-anno.jar}"/>
        <downloadfile src="${spotbugs.dom4j.url}" dest="${spotbugs.dom4j.jar}"/>
        <downloadfile src="${spotbugs.jaxen.url}" dest="${spotbugs.jaxen.jar}"/>
        <downloadfile src="${spotbugs.bcel.url}" dest="${spotbugs.bcel.jar}"/>
        <downloadfile src="${spotbugs.slf4j-api.url}" dest="${spotbugs.slf4j-api.jar}"/>
        <downloadfile src="${spotbugs.commons-text.url}" dest="${spotbugs.commons-text.jar}"/>
        <downloadfile src="${spotbugs.commons-codec.url}" dest="${spotbugs.commons-codec.jar}"/>
        <downloadfile src="${spotbugs.commons-logging.url}" dest="${spotbugs.commons-logging.jar}"/>
        <downloadfile src="${spotbugs.jcip-annotations.url}" dest="${spotbugs.jcip-annotations.jar}"/>
        <downloadfile src="${spotbugs.jsr305.url}" dest="${spotbugs.jsr305.jar}"/>
        <downloadfile src="${spotbugs.asm.url}" dest="${spotbugs.asm.jar}"/>
        <downloadfile src="${spotbugs.asm-analysis.url}" dest="${spotbugs.asm-analysis.jar}"/>
        <downloadfile src="${spotbugs.asm-commons.url}" dest="${spotbugs.asm-commons.jar}"/>
        <downloadfile src="${spotbugs.asm-tree.url}" dest="${spotbugs.asm-tree.jar}"/>
        <downloadfile src="${spotbugs.asm-util.url}" dest="${spotbugs.asm-util.jar}"/>
        <downloadfile src="${spotbugs.log4j-api.url}" dest="${spotbugs.log4j-api.jar}"/>
        <downloadfile src="${spotbugs.log4j-core.url}" dest="${spotbugs.log4j-core.jar}"/>
        <downloadfile src="${spotbugs.log4j-slf4j18-impl.url}" dest="${spotbugs.log4j-slf4j18-impl.jar}"/>
        <downloadfile src="${spotbugs.saxon.url}" dest="${spotbugs.saxon.jar}"/>
        <downloadfile src="${spotbugs.xmlresolver.url}" dest="${spotbugs.xmlresolver.jar}"/>
        <downloadfile src="${spotbugs.icu4j.url}" dest="${spotbugs.icu4j.jar}"/>

        <taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties">
            <classpath>
                <pathelement location="${spotbugs-ant.jar}"/>
            </classpath>
        </taskdef>

        <echo file="${basedir}${spotbugs.lib}/config/log4j2.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
            <Configuration status="WARN">
                <Appenders>
                    <Console name="Console" target="SYSTEM_OUT">
                        <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
                    </Console>
                </Appenders>
                <Loggers>
                    <Root level="error">
                        <AppenderRef ref="Console"/>
                    </Root>
                </Loggers>
            </Configuration>
        ]]></echo>

        <spotbugs home="${spotbugs.home}"
           output="xml:withMessages"
           outputFile="build/findbugs.xml"
           effort="max"
           failOnError="true"
           excludeFilter="src/resources/devtools/findbugs-filters.xml">
            <fileset dir="${dist.dir}/maven">
                <include name="poi/poi-${version.id}.jar"/>
                <include name="poi-scratchpad/poi-scratchpad-${version.id}.jar"/>
                <include name="poi-ooxml/poi-ooxml-${version.id}.jar"/>
                <include name="poi-excelant/poi-excelant-${version.id}.jar"/>
            </fileset>
            <auxClasspath path="${dsig.bouncycastle-pkix.jar}" />
            <auxClasspath path="${dsig.bouncycastle-prov.jar}" />
            <auxClasspath path="${dsig.bouncycastle-util.jar}" />
            <auxClasspath path="${dsig.xmlsec.jar}" />
            <auxClasspath path="${ooxml.xsds.jar}" />
            <auxClasspath path="${ooxml.curvesapi.jar}" />
            <auxClasspath path="${ooxml.xmlbeans.jar}" />
            <auxClasspath path="${ooxml.commons-compress.jar}" />
            <auxClasspath path="${ooxml.commons-lang3.jar}" />
            <auxClasspath path="${main.commons-collections4.jar}" />
            <auxClasspath path="${main.commons-math3.jar}" />
            <auxClasspath path="${main.commons-io.jar}" />
            <auxClasspath path="${main.commons-codec.jar}" />
            <auxClasspath path="${main.commons-logging.jar}" />
            <auxClasspath path="${main.log4j-api.jar}" />
            <auxClasspath path="${main.log4j-core.jar}" />
            <auxClasspath path="${main.junit-api.jar}" />
            <auxClasspath path="${main.junit-jengine.jar}" />
            <auxClasspath path="${main.junit-params.jar}" />
            <auxClasspath path="${main.junit-plauncher.jar}" />
            <auxClasspath path="${main.junit-pengine.jar}" />
            <auxClasspath path="${main.junit-pcommons.jar}" />
            <auxClasspath path="${main.junit-opentest4j.jar}" />
            <auxClasspath path="${main.junit-apiguardian.jar}" />
            <auxClasspath path="${main.jmh.jar}"/>
            <auxClasspath path="${main.jmhAnnotation.jar}"/>
            <auxClasspath path="${main.ant.jar}" />
            <auxClasspath path="${main.com.zaxxer.jar}" />
            <auxClasspath path="${svg.batik-anim.jar}"/>
            <auxClasspath path="${svg.batik-awt-util.jar}"/>
            <auxClasspath path="${svg.batik-bridge.jar}"/>
            <auxClasspath path="${svg.batik-codec.jar}"/>
            <auxClasspath path="${svg.batik-constants.jar}"/>
            <auxClasspath path="${svg.batik-css.jar}"/>
            <auxClasspath path="${svg.batik-dom.jar}"/>
            <auxClasspath path="${svg.batik-ext.jar}"/>
            <auxClasspath path="${svg.batik-gvt.jar}"/>
            <auxClasspath path="${svg.batik-i18n.jar}"/>
            <auxClasspath path="${svg.batik-parser.jar}"/>
            <auxClasspath path="${svg.batik-script.jar}"/>
            <auxClasspath path="${svg.batik-shared-resources.jar}"/>
            <auxClasspath path="${svg.batik-svg-dom.jar}"/>
            <auxClasspath path="${svg.batik-svggen.jar}"/>
            <auxClasspath path="${svg.batik-svgrasterizer.jar}"/>
            <auxClasspath path="${svg.batik-transcoder.jar}"/>
            <auxClasspath path="${svg.batik-util.jar}"/>
            <auxClasspath path="${svg.batik-xml.jar}"/>
            <auxClasspath path="${svg.xml-apis-ext.jar}"/>
            <auxClasspath path="${svg.xmlgraphics-commons.jar}"/>
            <auxClasspath path="${pdf.pdfbox.jar}"/>
            <auxClasspath path="${pdf.pdfbox.io.jar}"/>
            <auxClasspath path="${pdf.fontbox.jar}"/>
            <auxClasspath path="${pdf.graphics2d.jar}"/>
            <sourcePath path="poi/src/main/java" />
            <sourcePath path="poi-excelant/src/main/java" />
            <sourcePath path="poi-examples/src/main/java" />
            <sourcePath path="poi-ooxml/src/main/java" />
            <sourcePath path="poi-scratchpad/src/main/java" />
        </spotbugs>

        <!-- instead of calling findbugs again, we simply transform the xml -->
        <makeurl file="${basedir}${spotbugs.lib}/spotbugs.jar" property="findbugs.jarurl"/>
        <!-- although there's a findbugs history task too, it doesn't make much sense to provide it, -->
        <!-- as the build directory (i.e. the old findbugs.xml) is deleted regularly -->
        <xslt basedir="build" destdir="build" includes="findbugs.xml" force="true">
            <style>
                <url url="jar:${findbugs.jarurl}!/fancy.xsl"/>
            </style>
            <classpath>
                <pathelement location="${spotbugs.saxon.jar}"/>
                <pathelement location="${spotbugs.xmlresolver.jar}"/>
            </classpath>
            <factory name="net.sf.saxon.TransformerFactoryImpl"/>
        </xslt>
    </target>


    <target name="test-scratchpad-download-resources">
        <!-- disable font downloading until TestFontRendering works on all platforms -->
        <!-- ... eventually copy the files into the resource dirs ... -->
        <!--
        <mkdir dir="build/scratchpad-test-resources"/>

        <antcall target="downloadfile">
            <param name="sourcefile" value="https://sourceforge.net/projects/monafont/files/monafont/monafont-2.90/monafont-ttf-2.90.zip/download"/>
            <param name="destfile" value="build/scratchpad-test-resources/monafont-ttf-2.90.zip"/>
        </antcall>

        <unzip src="build/scratchpad-test-resources/monafont-ttf-2.90.zip"
               dest="build/scratchpad-test-resources">
            <patternset>
                <include name="mona.ttf"/>
            </patternset>
        </unzip>

        <antcall target="downloadfile">
            <param name="sourcefile" value="https://googlefontdirectory.googlecode.com/hg-history/c5955de4df3e40f6ab705bbccbd1f5ad93998287/cabin/Cabin-Regular.ttf"/>
            <param name="destfile" value="build/scratchpad-test-resources/Cabin-Regular.ttf"/>
        </antcall>
        -->
    </target>

    <target name="dist-checksum" depends="load-maven-server-settings">
        <fileset id="dist-archives" dir="${dist.dir}" includes="**/*.jar,**/*.pom,**/*.zip,**/*.tar.gz"/>

        <checksum algorithm="sha1" format="MD5SUM">
            <fileset refid="dist-archives"/>
        </checksum>
        <checksum algorithm="md5" format="MD5SUM">
            <fileset refid="dist-archives"/>
        </checksum>
        <checksum algorithm="SHA-256" fileext=".sha256" format="MD5SUM">
            <fileset refid="dist-archives"/>
        </checksum>
        <checksum algorithm="SHA-512" fileext=".sha512" format="MD5SUM">
            <fileset refid="dist-archives"/>
        </checksum>

        <fixcrlf srcDir="${dist.dir}" includes="**/*.md5,**/*.sha1,**/*.sha256,**/*.sha512" eol="unix"/>

        <downloadfile src="${dsig.bouncycastle-bcpg.url}" dest="${dsig.bouncycastle-bcpg.jar}"/>
        <downloadfile src="${dist.commons-openpgp.url}" dest="${dist.commons-openpgp.jar}"/>

        <taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant">
            <classpath>
                <pathelement path="${dist.commons-openpgp.jar}"/>
                <pathelement path="${dsig.bouncycastle-prov.jar}"/>
                <pathelement path="${dsig.bouncycastle-bcpg.jar}"/>
            </classpath>
        </taskdef>

        <openpgp:signer secring="${settings.poi-signing.privateKey}"
            pubring="${settings.poi-signing.publicKey}"
            password="${settings.poi-signing.passphrase}" keyid="${settings.poi-signing.username}"
            asciiarmor="true">
            <fileset refid="dist-archives"/>
        </openpgp:signer>
    </target>

    <target name="-update-build.xml">
        <replaceregexp byline="true">
            <regexp pattern="(&lt;property name=&quot;version.id&quot; value=&quot;)[^&quot;]+(&quot;/>)"/>
            <substitution expression="\1${version_id}\2"/>
            <fileset dir=".">
                <include name="build.xml"/>
            </fileset>
        </replaceregexp>
        <fixcrlf srcdir="." includes="build.xml" eol="unix" eof="remove" />
    </target>

    <!--
        Configure gpg settings in local maven settings.xml
        see release-guide.txt for more details
    -->
    <target name="load-maven-server-settings">
        <xslt in="${user.home}/.m2/settings.xml" out="build/tmp/signing.properties">
            <style>
                <string><![CDATA[
                    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mvn="http://maven.apache.org/SETTINGS/1.0.0">
                        <xsl:output method="text" version="1.0" encoding="ISO-8859-1"/>
                        <xsl:template match="@*|text()"/>
                        <xsl:template match="//mvn:server[contains('poi-signing|apache-id',mvn:id/text())]/*[name(.)!='id']">
                            <xsl:value-of select="concat('settings.',../mvn:id,'.',name(.),'=',translate(text(),'\','/'),'&#010;')"/>
                        </xsl:template>
                    </xsl:stylesheet>
                ]]></string>
            </style>
        </xslt>

        <loadproperties srcFile="build/tmp/signing.properties"/>
        <pathconvert property="settings.poi-signing.publicKey">
            <path><pathelement path="${settings.poi-signing.privateKey}"/></path>
            <mapper><filtermapper><replacestring from="secring" to="pubring"/></filtermapper></mapper>
        </pathconvert>
    </target>

    <macrodef name="loadChecksum">
        <attribute name="url"/>
        <attribute name="property"/>
        <sequential>
            <loadresource property="@{property}">
                <url url="@{url}"/>
                <filterchain>
                    <striplinebreaks/>
                    <replaceregex pattern=" .*" replace=""/>
                </filterchain>
            </loadresource>
        </sequential>
    </macrodef>

    <macrodef name="download-line">
        <attribute name="prop"/>
        <attribute name="dist"/>
        <attribute name="pack"/>
        <sequential>
            <local name="baseurl"/>
            <property name="baseurl" value="https://downloads.apache.org/poi/release"/>

            <local name="basedyn"/>
            <property name="basedyn" value="https://www.apache.org/dyn/closer.lua/poi/release"/>

            <delete file="build/loadFilesize.txt"/>
            <record name="build/loadFilesize.txt" action="start" loglevel="verbose" append="false"/>
            <http url="${baseurl}/@{dist}/poi-@{dist}-${version.id}-${file_date}.@{pack}" method="HEAD" expected="200" printrequestheaders="false" printresponseheaders="false"/>
            <record name="build/loadFilesize.txt" action="stop"/>
            <local name="fileSize"/>
            <loadfile property="fileSize" srcFile="build/loadFilesize.txt">
                <filterchain>
                    <tokenfilter>
                        <containsstring contains="Content-Length"/>
                        <replaceregex pattern=".* ([0-9]+)$" replace="\1" flags="gi"/>
                    </tokenfilter>
                    <striplinebreaks/>
                </filterchain>
            </loadfile>

            <taskdef name="bytes2mega" classname="Bytes2Mega" classpath="poi-excelant/build/poi-ant-contrib"/>
            <local name="fileSizeMb"/>
            <bytes2mega property="fileSizeMb" bytes="${fileSize}"/>

            <property name="@{prop}"><![CDATA[<li>
          <a href="${basedyn}/@{dist}/poi-@{dist}-${version.id}-${file_date}.@{pack}">poi-@{dist}-${version.id}-${file_date}.@{pack}</a>
          (${fileSizeMb} MB, <a href="${baseurl}/@{dist}/poi-@{dist}-${version.id}-${file_date}.@{pack}.asc">signature (.asc)</a>,
          checksum: <a href="${baseurl}/@{dist}/poi-@{dist}-${version.id}-${file_date}.@{pack}.sha256">SHA-256</a>,
          <a href="${baseurl}/@{dist}/poi-@{dist}-${version.id}-${file_date}.@{pack}.sha512">SHA-512</a>)
        </li>]]></property>
        </sequential>
    </macrodef>

    <!-- TODO: currently this only saves a copy and paste snippet to a file ...
         would be nice if it really changes changes.xml and download.xml
         Doesn't work with Java6 - the https urls can't be accessed via loadChecksum
     -->
    <target name="update-download">
        <downloadfile src="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/missing-link/ml-ant-http-1.1.3.zip" dest="${util.lib}/ml-ant-http-1.1.3.zip"/>
        <unzip src="${util.lib}/ml-ant-http-1.1.3.zip" dest="${util.lib}">
            <patternset>
                <include name="ml-ant-http-1.1.3.jar"/>
            </patternset>
        </unzip>
        <taskdef name="http" classname="org.missinglink.ant.task.http.HttpClientTask">
            <classpath>
                <path location="${util.lib}/ml-ant-http-1.1.3.jar"/>
            </classpath>
        </taskdef>

        <tstamp>
            <format property="rel_date" pattern="dd MMMM yyyy" locale="US"/>
            <format property="file_date" pattern="yyyyMMdd" locale="US"/>
        </tstamp>

        <local name="li1"/>
        <local name="li2"/>
        <local name="li3"/>
        <local name="li4"/>
        <download-line prop="li1" dist="bin" pack="tar.gz"/>
        <download-line prop="li2" dist="bin" pack="zip"/>
        <download-line prop="li3" dist="src" pack="tar.gz"/>
        <download-line prop="li4" dist="src" pack="zip"/>

<echo file="download-snipplet.xml"><![CDATA[
    <section id="POI-${version.id}"><title>${rel_date} - POI ${version.id} available</title>
      <p>The Apache POI team is pleased to announce the release of ${version.id}.
         Featured are a handful of new areas of functionality and numerous bug fixes.</p>
      <p>A summary of changes is available in the
        <a href="https://www.apache.org/dyn/closer.lua/poi/dev/RELEASE-NOTES-${version.id}.txt">Release Notes</a>.
        A full list of changes is available in the <a href="site:changes">change log</a>.
        People interested should also follow the <a href="site:mailinglists">dev list</a>
        to track progress.</p>
      <p>
        The POI source release as well as the pre-built binary deployment packages are listed below.
        Pre-built versions of all <a href="site:components">POI components</a>
        are available in the central Maven repository under Group ID "org.apache.poi" and Version
        "${version.id}".
      </p>
      <section id="POI-${version.id}-bin"><title>Binary Distribution</title>
      <ul>
        ${li1}
        ${li2}
      </ul>
      </section>
      <section id="POI-${version.id}-src"><title>Source Distribution</title>
      <ul>
        ${li3}
        ${li4}
      </ul>
      </section>
    </section>
]]></echo>
    </target>

    <target name="test-env" description="tests if ant is available on the jenkins worker">
      <echo>Using Ant: ${ant.version} from ${ant.home}</echo>
    </target>

    <target name="replaceVersion" description="Apply the version from build.xml in all other places">
        <replaceregexp
               match=" version = '[0-9.]+(?:-SNAPSHOT)?'"
               replace=" version = '${version.id}'">
            <fileset dir=".">
                <include name="build.gradle"/>
            </fileset>
        </replaceregexp>
        <replaceregexp
               match="&lt;poi.version>[0-9.]+(?:-SNAPSHOT)?&lt;/poi.version>"
               replace="&lt;poi.version>${version.id}&lt;/poi.version>">
            <fileset dir=".">
                <include name="osgi/pom.xml"/>
            </fileset>
        </replaceregexp>
    </target>
</project>