Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 3410 lines (2857 sloc) 139.686 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 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 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410
<?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.
-->

<project default="buildsource" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">

<!-- Set Properties -->


  <!-- User settings -->
  <property environment="env"/>
  <property file="local.properties"/>

  <property file="${user.home}/ant.properties"/>
  <!-- Set property lib dir -->
  <property name="properties.dir" value="${basedir}/tools/ant/properties"/>
  <!-- Significant dirs -->
  <property file="${properties.dir}/dirs.properties"/>
  <!-- Compiler settings -->
  <property file="${properties.dir}/sane${sanity}.properties"/>

<!-- These properties are used by the Release build process. -->
  <condition property="isWindows">
    <os family="windows"/>
  </condition>

  <condition property="isUnix">
    <not>
      <os family="windows"/>
    </not>
  </condition>

<!-- Targets -->

  <target
      name="buildsource"
      depends="checkCompilerLevel,init,prebuild,setCompilerProperties,jdbc4stubs,felixStubs,engine,storeless,tools,drda,client,optional,build,versioninfo,localeinfo,binscripts"
      description="Compile the product source (does not build the tests)."
  />
  <target
      name="all"
      depends="buildsource,demo,testing,pptesting,runmessagecheck"
      description="Compile all of the source, including tests as well as production code."
  />

<!-- ==================================================================== -->
<!-- Initialize targets -->
<!-- ==================================================================== -->

  <target name="init" unless="init.done" depends="setInitialProperties">

    <antcall target="install_junit"/>
    <tstamp/>
    <mkdir dir="${out.dir}"/>
    <antcall target="make-generated-dirs"/>
    <antcall target="make-release-dirs"/>

    <!-- Create the emtpy dir that we put in the boot classpath to
prevent the default Java runtime libraries from being loaded.
-->
    <mkdir dir="${empty}"/>

    <!-- generate sanity state.properties if one does not exist -->
    <available property="state.available" file="${state.file}"/>
    <antcall target="ensuresanitystate"/>
    <property file="${state.file}"/>
    <property file="${properties.dir}/sane${sanity}.properties"/>
    <antcall target="setissane"/>
    <property name="init.done" value="true"/>
  </target>

   <target name="make-generated-dirs">

    <mkdir dir="${generated.dir}"/>
    <mkdir dir="${generated.bin.dir}"/>
    <mkdir dir="${generated.src.dir}"/>
    <mkdir dir="${generated.sanity.dir}"/>
    <mkdir dir="${generated.ij.dir}"/>
    <mkdir dir="${generated.sql.dir}"/>
    <mkdir dir="${generated.engine.locale.dir}"/>
    <mkdir dir="${generated.cache.dir}"/>
    <mkdir dir="${generated.toursdb.dir}"/>

   </target>

   <target name="make-release-dirs">

    <mkdir dir="${release.base}"/>
    <mkdir dir="${release.dir}"/>
    <mkdir dir="${snapshot.dir}"/>

   </target>

  <target name="setissane">
    <condition property="is.sane">
      <equals arg1="${sanity}" arg2="true"/>
    </condition>
  </target>

  <target name="ensuresanitystate" unless="state.available">
    <antcall target="evaluate.sane"/>
  </target>
  <target name="evaluate.sane">
    <condition property="generate.sane">
      <or>
        <equals arg1="${sane}" arg2="true"/>
        <not>
          <isset property="sane"/>
        </not>
      </or>
    </condition>
    <antcall target="ensuresanitystate.sane"/>
    <antcall target="ensuresanitystate.insane"/>
  </target>
  <target name="ensuresanitystate.sane" if="generate.sane">
    <antcall target="sane"/>
  </target>
  <target name="ensuresanitystate.insane" unless="generate.sane">
    <antcall target="insane"/>
  </target>

  <target name="showenv" depends="init" unless="showenv.done">
    <echo level="info" message=""/>
    <echo level="info" message="Ant environment:"/>
    <echo level="info" message=" Base Directory: ${basedir}"/>
    <echo level="info" message=" Build output: ${out.dir}"/>
    <echo level="info" message=" Compiler: ${build.compiler}"/>
    <echo level="info" message=" Sane = ${sane}"/>
    <echo level="info" message=" Proceed = ${proceed}"/>
    <echo level="info" message=""/>
    <property name="showenv.done" value="true"/>
  </target>

  <!-- Make sure compiler level is Java 6 level or higher -->
  <target name="checkCompilerLevel">

    <!--
Allow compilation of JDBC4 classes at 1.6 level if compiler supports it.
If we can find the following class, then we assume that the compiler
is at least Java 6 level.
-->
    <available property="compilerAtCorrectLevel" classname="java.sql.Wrapper"/>
    <fail unless="compilerAtCorrectLevel" message="Compiler level must be Java 6 or later."/>

    <property name="compilerLevel16" value="1.6"/>

    <javac source="1.6" srcdir="${basedir}" failonerror="false"
           includeantruntime="false">
      <include name="${dummy.src}"/>
    </javac>

    <antcall target="checkVMLevel"/>
    
  </target>

  <!-- checkVMLevel:
This target determines to some degree the JVM version used to run ant.
The resulting properties will indicate the VM level, and may for instance
be checked before running junit tests requiring a certain JVM version.
-->
  <target name="checkVMLevel">
    <!-- The java.lang.ManagementFactory class was new in J2SE 5.0 -->
    <available classname="java.lang.management.ManagementFactory" property="vmLevelIsAtLeast1.5"/>
    <available classname="java.sql.Wrapper" property="vmLevelIsAtLeast1.6" value="true"/>
    <available classname="java.sql.PseudoColumnUsage" property="vmLevelIsAtLeast1.7"/>
    <available classname="java.sql.SQLType" property="vmLevelIsAtLeast1.8" value="true"/>
  </target>

<!-- ==================================================================== -->
<!-- Download junit 3.8.2 -->
<!-- ==================================================================== -->


   <!-- You can override this property in local.properties to fetch from an alternative location -->
   <property name="junit.url" value="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar"/>
   <target name="junit_check">
       <!-- check if junit is set, if set, if junit.jar is really there, if not, error out -->
       <fail message="junit property is set to ${junit}, but there is no junit.jar there.">
           <condition>
               <and>
                   <isset property="junit"/>
                   <not>
                       <available file="${junit}"/>
                   </not>
               </and>
           </condition>
       </fail>
       <condition property="junitfile" value="${junit}">
           <and>
               <isset property="junit"/>
           </and>
       </condition>
       <condition property="junitfile" value="${basedir}/tools/java/junit.jar">
           <not>
               <isset property="junit"/>
           </not>
       </condition>
       <available file="${junitfile}" property="junit.exists"/>
   </target>

   <target name="install_junit" depends="junit_check" unless="junit.exists" description="installs junit.jar into derby">
       <get src="${junit.url}" dest="${basedir}/tools/java/junit.jar" verbose="true" ignoreerrors="true"/>
   </target>

<!-- ==================================================================== -->
<!-- Build version info files -->
<!-- ==================================================================== -->

  <target name="versioninfo" depends="ckversioninfo,writeversioninfo"/>

  <target name="ckversioninfo">
    <condition property="versioninfo.available">
      <and>
        <available file="${out.dir}/org/apache/derby/info/DBMS.properties"/>
        <available file="${out.dir}/org/apache/derby/info/tools.properties"/>
        <available file="${out.dir}/org/apache/derby/info/net.properties"/>
        <available file="${out.dir}/org/apache/derby/info/dnc.properties"/>
      </and>
    </condition>
  </target>

  <target name="writeversioninfo" unless="versioninfo.available">
    <mkdir dir="${out.dir}/org/apache/derby/info/"/>

    <antcall target="infowriter">
      <param name="info.buildnumber" value="1"/>
      <param name="info.iname" value="Apache Derby Embedded Engine"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="codeline"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/DBMS.properties"/>
    </antcall>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="1"/>
      <param name="info.iname" value="Apache Derby Tools"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="codeline"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/tools.properties"/>
    </antcall>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="1"/>
      <param name="info.iname" value="Apache Derby Network Server"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="codeline"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/net.properties"/>
    </antcall>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="1"/>
      <param name="info.iname" value="Apache Derby Network Client"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="codeline"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/dnc.properties"/>
    </antcall>
  </target>

  <target name="cleanversion">
    <delete file="${out.dir}/org/apache/derby/info/DBMS.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/tools.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/net.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/dnc.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/tsting.properties"/>
  </target>

  <!-- Set the ant variables which identify the compiler classpaths. -->
  <target name="setCompilerProperties" unless="compilerPropsAlreadySet" depends="prebuild">

    <antcall target="printCompilerProperties"> <param name="checkEvent" value="Before setting properties: "/> </antcall>

    <taskdef
      name="setJdkProperties"
      classname="org.apache.derbyPreBuild.PropertySetter"
      classpath="${out.dir}"
    />

    <!--
After setting the JDK properties, we expect that java16compile.classpath,
java17compile.classpath, or java18compile.classpath will be set.
If none of these are set, then PropertySetter aborts the build.
-->
    <setJdkProperties/>

    <property file="${properties.dir}/defaultcompiler.properties"/>
    <property file="${properties.dir}/${build.compiler}.properties"/>
    <!-- Compile-time classpath`< properties files -->
    <property file="${properties.dir}/extrapath.properties"/>


    <!--
If a Java 6 JDK isn't present, then use the Java 7 environment to build the JDBC 4 support
-->
    <condition property="java17compile.classpath" value="${out.jdbc4.dir}:${java18compile.classpath}">
          <isset property="java18compile.classpath"/>
    </condition>
    <property name="java16compile.classpath" value="${java17compile.classpath}"/>

    <!--
If a Java 7 JDK isn't present, then use the Java 6 environment.
-->
    <property name="java17compile.classpath" value="${java16compile.classpath}"/>

    <!--
If a Java 8 JDK isn't present, then use the Java 7 environment.
-->
    <property name="java18compile.classpath" value="${java17compile.classpath}"/>

    <property file="${properties.dir}/compilepath.properties"/>
    <!-- Release and version info -->
    <property file="${properties.dir}/release.properties"/>

    <!--
The lowest common denominator compile path for Derby. We expect that
the bulk of the Derby product will run on Java SE 6.
-->
    <property name="compile.classpath" value="${java16compile.classpath}"/>

    <property name="compilerPropsAlreadySet" value="true"/>
    <antcall target="printCompilerProperties"> <param name="checkEvent" value="After setting properties: "/> </antcall>


  </target>

  <!-- Set the initial properties for this build script. This duplicates the property setting block in setCompilerProperties. Once we make setCompilerProperties mandatory, this target should be removed. -->
  <target name="setInitialProperties" if="dontAutosetProps">

    <property file="${properties.dir}/defaultcompiler.properties"/>
    <property file="${properties.dir}/${build.compiler}.properties"/>
    <!-- Compile-time classpath`< properties files -->
    <property file="${properties.dir}/extrapath.properties"/>
    <property file="${properties.dir}/compilepath.properties"/>
    <!-- Release and version info -->
    <property file="${properties.dir}/release.properties"/>

  </target>

  <target name="printCompilerProperties" if="printCompilerProperties">

    <echo message="${checkEvent} compilerPropsAlreadySet = ${compilerPropsAlreadySet}"/>
    <echo message="${checkEvent} compilerLevel16 = ${compilerLevel16}"/>
    <echo message="${checkEvent} compile.classpath = ${compile.classpath}"/>
    <echo message="${checkEvent} j16lib = ${j16lib}"/>
    <echo message="${checkEvent} java16compile.classpath = ${java16compile.classpath}"/>
    <echo message="${checkEvent} j17lib = ${j17lib}"/>
    <echo message="${checkEvent} java17compile.classpath = ${java17compile.classpath}"/>
    <echo message="${checkEvent} j18lib = ${j18lib}"/>
    <echo message="${checkEvent} java18compile.classpath = ${java18compile.classpath}"/>

  </target>

<!-- ==================================================================== -->
<!-- Info writer build target -->
<!-- ==================================================================== -->

  <target name="infowriter">
    <propertyfile file="${info.file}" comment="${copyright.comment}">
      <entry key="derby.version.major" value="${major}"/>
      <entry key="derby.version.minor" value="${minor}"/>
      <entry key="derby.version.maint" value="${maint}"/>
      <entry key="derby.version.drdamaint" value="${drdamaint}"/>
      <entry key="derby.build.number" value="${info.buildnumber}"/>
      <entry key="derby.product.technology.name" value="${info.iname}"/>
      <entry key="derby.product.external.name" value="${info.ename}"/>
      <entry key="derby.product.external.version" value="${eversion}"/>
      <entry key="derby.version.beta" value="${beta}"/>
      <entry key="derby.product.vendor" value="${vendor}"/>
      <entry key="derby.product.file" value="${info.productfile}"/>
    </propertyfile>
  </target>

    <!--
Create the release properties file and check it in

Args:

bumpID true or false, depending on whether you want to increment the last digit of the release id (defaults to false)
-->
  <target name="writeAndCheckinReleaseProperties" depends="writeRelProps,promptforsvncredentials">

    <!-- Check in the new release id. -->
    <antcall target="checkinfile">
       <param name="checkinComment" value="Derby release ID set to: ${derby.release.id.new}"/>
       <param name="fileName" value="${releasePropertyFile}"/>
    </antcall>
    
  </target>

    <!--
Create the release properties file.

Args:

bumpID true or false, depending on whether you want to increment the last digit of the release id (defaults to false)
-->
  <target name="writeRelProps" depends="init,prebuild,promptforreleaseid">

    <taskdef
      name="writeAndCheckinReleaseProperties"
      classname="org.apache.derbyPreBuild.ReleaseProperties"
      classpath="${out.dir}"
    />

    <property name="releasePropertyFile" value="${properties.dir}/release.properties"/>
    <property name="bumpID" value="false"/>

    <writeAndCheckinReleaseProperties
      releaseID="${derby.release.id}"
      releasePropertiesFileName="${releasePropertyFile}"
      bump="${bumpID}"
    />

    <!--
If we were asked to bump the release id, then the actual release id
will be different from the original id passed into this target.
-->
    <echo message="Derby release ID set to: ${derby.release.id.new}"/>
    
  </target>

<!-- ==================================================================== -->
<!-- Locale info writer build target -->
<!-- ==================================================================== -->

  <target name="buildlocaleinfo">
    <antcall target="localeinfowriter">
      <param name="info.buildnumber" value="1"/>
      <param name="info.iname" value="_${locale.iname}"/>
      <param name="info.ename" value="${locale.ename}"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/locale_${locale.iname}.properties"/>
    </antcall>
  </target>

  <target name="localeinfowriter">
    <propertyfile file="${info.file}" comment="${copyright.comment}">
      <entry key="derby.locale.version.major" value="${major}"/>
      <entry key="derby.locale.version.minor" value="${minor}"/>
      <entry key="derby.locale.version.maint" value="${maint}"/>
      <entry key="derby.locale.build.number" value="${info.buildnumber}"/>
      <entry key="derby.locale.technology.name" value="${info.iname}"/>
      <entry key="derby.locale.external.name" value="${info.ename}"/>
      <entry key="derby.version.beta" value="${beta}"/>
      <entry key="derby.locale.vendor" value="${vendor}"/>
      <entry key="derby.product.file" value="${info.productfile}"/>
    </propertyfile>
  </target>

 
<!-- ==================================================================== -->
<!-- Build Locale info -->
<!-- ==================================================================== -->

  <target name="localeinfo"
          depends="checklocaleinfo,checkmessages"
          unless="localeinfo.available">

    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="cs"/>
      <param name="locale.ename" value="Czech/International [cs]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="de_DE"/>
      <param name="locale.ename" value="German/Germany [de_DE]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="es"/>
      <param name="locale.ename" value="Spanish/International [es]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="fr"/>
      <param name="locale.ename" value="French/International [fr]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="hu"/>
      <param name="locale.ename" value="Hungarian/International [hu]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="it"/>
      <param name="locale.ename" value="Italian/International [it]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="ja_JP"/>
      <param name="locale.ename" value="Japanese/Japan [ja_JP]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="ko_KR"/>
      <param name="locale.ename" value="Korean/Korea [ko_KR]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="pl"/>
      <param name="locale.ename" value="Polish/International [pl]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="pt_BR"/>
      <param name="locale.ename" value="Portuguese/Brazil [pt_BR]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="ru"/>
      <param name="locale.ename" value="Russian/International [ru]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="zh_CN"/>
      <param name="locale.ename" value="Simplified_Chinese/PR_China [zh_CN]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
    <antcall target="buildlocaleinfo">
      <param name="locale.iname" value="zh_TW"/>
      <param name="locale.ename" value="Chinese/Taiwan_Traditional [zh_TW]"/>
      <param name="info.buildnumber" value="1"/>
      <param name="info.productfile" value="codeline"/>
    </antcall>
  </target>

  <target name="checklocaleinfo">
    <condition property="localeinfo.available">
      <and>
        <available file="${out.dir}/org/apache/derby/info/locale_cs.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_de_DE.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_es.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_fr.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_hu.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_it.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_ja_JP.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_ko_KR.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_pl.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_pt_BR.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_ru.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_zh_CN.properties"/>
        <available file="${out.dir}/org/apache/derby/info/locale_zh_TW.properties"/>
      </and>
    </condition>
  </target>

  <target name="cleanlocale">
    <delete file="${out.dir}/org/apache/derby/info/locale_cs.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_de_DE.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_es.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_fr.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_hu.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_it.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_ja_JP.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_ko_KR.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_pl.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_pt_BR.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_ru.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_zh_CN.properties"/>
    <delete file="${out.dir}/org/apache/derby/info/locale_zh_TW.properties"/>
  </target>

  <target name="checkmessages" depends="checkmessages-done"
          unless="checkmessages.done">
    <java classname="org.apache.derbyBuild.MessageVetter"
          classpath="${out.dir}"
          failonerror="true">
      <arg file="${out.dir}/org/apache/derby/loc"/>
      <arg file="${out.dir}/org/apache/derby/loc/drda"/>
    </java>
    <touch file="${generated.dir}/checkmessages.done"/>
  </target>

  <target name="checkmessages-done">
    <uptodate property="checkmessages.done"
              targetfile="${generated.dir}/checkmessages.done">
      <srcresources>
        <fileset dir="${out.dir}/org/apache/derby/loc"
                 includes="*.properties"/>
        <fileset dir="${out.dir}/org/apache/derby/loc/drda"
                 includes="*.properties"/>
      </srcresources>
    </uptodate>
  </target>

<!-- ==================================================================== -->
<!-- Derby Engine build target -->
<!-- ==================================================================== -->

  <target name="engine" depends="shared,state">
    <ant dir="${derby.engine.src.dir}"/>
    <antcall target="build"/>
    <ant dir="${derby.engine.dir}/loc"/>
    <antcall target="class_size_catalog"/>
  </target>
<target name="engine_169_opt" depends="engine">
<ant dir="${derby.engine.src.dir}" target="engine_169_opt"/>
</target>

  <target name="tools" depends="engine">
    <ant dir="${derby.tools.src.dir}"/>
  </target>

  <target name="optional" depends="engine">
    <ant dir="${derby.optional.src.dir}"/>
  </target>

  <target name="storeless" depends="engine">
   <ant dir="${derby.storeless.src.dir}"/>
  </target>

  <target name="shared" depends="init,state">
    <ant dir="${derby.shared.src.dir}"/>
  </target>
  
  <target name="drda" depends="engine">
    <ant dir="${derby.drda.src.dir}"/>
    <ant dir="${derby.tools.src.dir}" target="tools_run"/>
  </target>

  <target name="client" depends="engine,shared">
    <ant dir="${derby.client.src.dir}"/>
  </target>

  <target name="prebuild">
    <mkdir dir="${out.dir}"/>
    <ant dir="${derby.build.src.dir}/org/apache/derbyPreBuild"/>
  </target>

  <target name="build">
    <ant dir="${derby.build.src.dir}"/>
  </target>

  <target name="demo" depends="buildsource,vti-demo">
    <ant dir="${derby.demo.src.dir}"/>
  </target>

  <target name="vti-demo" depends="buildsource">
    <ant dir="${derby.demo.src.dir}" target="compile-vtidemo"/>
  </target>

  <target name="testing" depends="buildsource,demo,buildtestinginfo">
    <ant dir="${derby.testing.src.dir}"/>
  </target>

  <target name="build-test-jars" description="Build jar files used in tests." depends="buildsource" >

    <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/lang" target="build-test-jars" />

  </target>

  <!-- Build the package private tests -->
  <target name="pptesting" depends="testing">
    <ant dir="${derby.testing.src.dir}/org/apache/derby"/>
  </target>

  <!-- Run the MessageBundleTest -->
  <target name="runmessagecheck">
    <java fork="true"
       classname="org.apache.derbyBuild.MessageBundleTest"
     failonerror="true"
       classpath="${out.dir}"
     />
  </target>

<!-- ==================================================================== -->
<!-- Build SanityState.java -->
<!-- ==================================================================== -->

  <target name="getstate">
    <condition property="needstate">
      <or>
        <not>
          <equals arg1="${sane}" arg2="${sanity}"/>
        </not>
        <not>
          <available file="${generated.sanity.dir}/SanityState.java"/>
        </not>
      </or>
    </condition>
  </target>

  <property name="state.file" value="${generated.sanity.dir}/state.properties"/>
  <property file="${state.file}"/>

  <!-- Build SanityState.java -->
  <target name="state" if="needstate" depends="showenv,getstate">
    <echo level="info" message=" Generating SanityState.java..."/>
    <property name="sane" value="true"/>
    <filter token="SANE" value="${sane}"/>
    <copy file="${sanity.dir}/SanityState.tmpl"
          tofile="${generated.sanity.dir}/SanityState.java"
          overwrite="yes" filtering="on"/>
    <property name="header" value="Generated file - do not modify!"/>
    <propertyfile file="${state.file}" comment="${header}">
      <entry key="sanity" value="${sane}" type="string"/>
    </propertyfile>
    <delete dir="${sanity.out.dir}"/>
  </target>

<!-- =================================================================== -->
<!-- Remove SanityState.java file -->
<!-- =================================================================== -->
  <target name="cleanstate">
    <delete dir="${generated.sanity.dir}"/>
    <delete dir="${sanity.out.dir}"/>
  </target>

<!-- =================================================================== -->
<!-- Remove all built objects (except jars) -->
<!-- =================================================================== -->
  <target
      name="clobber"
      depends="clean,cleangenerated,cleanstate,cleanreleasefiles"
      description="Remove all build artifacts."
  >
    <delete file="${out.base}/changenumber.properties"/>
  </target>

<!-- =================================================================== -->
<!-- Remove the tree of generated intermediate sources -->
<!-- =================================================================== -->
  <target name="cleangenerated">
    <delete dir="${generated.dir}"/>
  </target>

<!-- =================================================================== -->
<!-- Remove output tree -->
<!-- =================================================================== -->
  <target name="clean">
    <delete dir="${out.dir}"/>
    <delete dir="${generated.dir}"/>
   <delete dir="${out.storeless.dir}"/>
   <delete dir="${out.pptesting.dir}"/>
  </target>

<!-- ==================================================================== -->
<!-- Build parsers -->
<!-- ==================================================================== -->

  <!-- Top level target for building both of the javacc parsers -->
  <target name="parsers">
    <ant dir="${derby.tools.dir}/impl/tools" target="parser"/>
    <ant dir="${derby.engine.dir}/impl/sql" target="parser"/>
  </target>

  <target name="genParser" depends="chkparser" unless="parser.done">
    <echo level="info" message=" ${msg}"/>
    <delete>
      <fileset dir="${generated.src.dir}/${directory}" includes="${rmfiles}"/>
    </delete>
    <java classname="javacc"
          classpath="${javacc}"
                dir="${derbysrc.dir}/${srcroot}/${directory}"
               fork="yes"
        failonerror="true">
      <arg value="-OUTPUT_DIRECTORY=${generated.src.dir}/${directory}"/>
      <arg value="${jjfile}"/>
    </java>
    <!-- Qualify reference to tokenImage to fix issue with inheritence -->
    <!-- IBM JDK 1.3.1. See DERBY-1078 -->
    <replaceregexp file="${generated.src.dir}/${directory}/${chkfile}" match="tokenImage"
                   replace="${constantsfile}.tokenImage"/>
  </target>

  <target name="chkparser">
    <uptodate property="parser.done"
              targetfile="${generated.src.dir}/${directory}/${chkfile}" >
      <srcfiles dir="${derbysrc.dir}/${srcroot}/${directory}" includes="${jjfile}" />
    </uptodate>
  </target>

<!-- =================================================================== -->
<!-- Build the stub implementation of JDBC4 -->
<!-- =================================================================== -->
  <target name="jdbc4stubs">
    <mkdir dir="${out.stubs.dir}"/>
    <mkdir dir="${out.jdbc4.dir}"/>

    <javac
      source="1.6"
      target="1.6"
      bootclasspath="${empty}"
      nowarn="on"
      debug="${debug}"
      depend="${depend}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      proceed="${proceed}"
      verbose="${verbose}"
      srcdir="${derby.jdbc4.src.dir}"
      destdir="${out.jdbc4.dir}">
      <classpath>
        <pathelement path="${java16compile.classpath}"/>
      </classpath>
      <compilerarg value="-Xlint:unchecked"/>
     </javac>

  </target>

<!-- =================================================================== -->
<!-- Build the stub FELIX (OSGI) implementation -->
<!-- =================================================================== -->
  <target name="felixStubs">
    <mkdir dir="${out.stubs.dir}"/>
    <mkdir dir="${out.felix.dir}"/>

    <javac
      source="1.6"
      target="1.6"
      bootclasspath="${empty}"
      nowarn="on"
      debug="${debug}"
      depend="${depend}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      proceed="${proceed}"
      verbose="${verbose}"
      srcdir="${derby.felix.src.dir}"
      destdir="${out.felix.dir}">
      <classpath>
        <pathelement path="${java16compile.classpath}"/>
      </classpath>
      <compilerarg value="-Xlint:unchecked"/>
     </javac>

  </target>

<!-- =================================================================== -->
<!-- Build the Unix shell scripts under bin -->
<!-- =================================================================== -->

<target name="binscripts" depends="check-binscripts" unless="binscripts.done">
  <antcall target="makebinscript">
    <param name="script" value="dblook"/>
  </antcall>

  <antcall target="makebinscript">
    <param name="script" value="ij"/>
  </antcall>

  <antcall target="makebinscript">
    <param name="script" value="sysinfo"/>
  </antcall>

  <antcall target="makebinscript">
    <param name="script" value="NetworkServerControl"/>
  </antcall>

  <antcall target="makebinscript">
    <param name="script" value="startNetworkServer"/>
  </antcall>

  <antcall target="makebinscript">
    <param name="script" value="stopNetworkServer"/>
  </antcall>

  <!-- All the scripts should be executable. -->
  <chmod perm="+x" dir="${generated.bin.dir}" includes="*"/>

</target>

<target name="makebinscript">
  <concat destfile="${generated.bin.dir}/${script}">
    <fileset file="bin/templates/derby_common.sh"/>
    <fileset file="bin/templates/${script}"/>
  </concat>
</target>

<target name="check-binscripts">
  <dependset>
    <srcfileset file="bin/templates/derby_common.sh"/>
    <targetfileset dir="${generated.bin.dir}"/>
  </dependset>
  <uptodate property="binscripts.done">
    <srcfiles dir="bin/templates" excludes="derby_common.sh"/>
    <globmapper from="*" to="${generated.bin.dir}/*"/>
  </uptodate>
</target>

<!-- =================================================================== -->
<!-- Remove generated message files -->
<!-- =================================================================== -->
  <target name="cleanmessages">
    <delete>
      <fileset dir="${generated.engine.locale.dir}" includes="messages_en.properties"/>
    </delete>
  </target>

<!-- =================================================================== -->
<!-- Class Size Catalog build -->
<!-- =================================================================== -->

  <!--
Create the class size catalog, a java file

Note that checking the up-to-date status of the files scanned by
ClassSizeCrawler will not always result in the ClassSizeCatalogImpl
being updated properly. We would have to be able to scan the full
dependency tree. This does prevent recompilation in most cases,
and requires it in the most obvious. If there is concern that
the ClassSizeCatalogImpl may have changed significantly since the
last build, run clobber and rebuild to regenerate it.
-->

  <target name="class_size_catalog" depends="cscuptodate" unless="csc.uptodate">
    <java classname="org.apache.derbyBuild.ClassSizeCrawler"
          fork="yes"
          failonerror="yes">
      <classpath>
        <pathelement path="${out.dir}"/>
        <pathelement path="${compile.classpath}"/>
      </classpath>
      <jvmarg value="-DWS=${workspace}"/>
      <jvmarg value="-DclassDir=${out.dir}"/>
      <jvmarg value="-Dout=${generated.cache.dir}/ClassSizeCatalogImpl.java"/>
      <jvmarg value="-Dprefix.1=org.apache.derby.iapi.types"/>
      <jvmarg value="-Dprefix.2=org.apache.derby.impl"/>
      <arg value="org.apache.derby.iapi.types.DataValueDescriptor"/>
      <arg value="org.apache.derby.impl.services.cache.CachedItem"/>
      <arg value="org.apache.derby.impl.store.raw.data.RecordId"/>
      <arg value="org.apache.derby.iapi.store.raw.ContainerKey"/>
      <arg value="org.apache.derby.iapi.services.cache.SizedCacheable"/>
      <arg value="java.lang.ref.WeakReference"/>
      <arg value="java.math.BigDecimal"/>
      <arg value="java.util.ArrayList"/>
      <arg value="java.util.GregorianCalendar"/>
      <arg value="java.util.Vector"/>
    </java>

    <javac
      source="1.6"
      target="1.6"
      bootclasspath="${empty}"
      nowarn="on"
      debug="${debug}"
      depend="${depend}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      proceed="${proceed}"
      verbose="${verbose}"
      srcdir="${generated.src.dir}"
      destdir="${out.dir}">
      <classpath>
        <pathelement path="${compile.classpath}"/>
      </classpath>
      <include name="${derby.dir}/iapi/services/cache/ClassSizeCatalogImpl.java"/>
    </javac>

  </target>

  <target name="cscuptodate">
    <condition property="csc.uptodate">
      <and>
        <uptodate srcfile="${derby.engine.dir}/iapi/types/DataValueDescriptor.java"
                  targetfile="${out.dir}/org/apache/derby/iapi/types/DataValueDescriptor.class"/>
        <uptodate srcfile="${derby.engine.dir}/impl/services/cache/CachedItem.java"
                  targetfile="${out.dir}/org/apache/derby/impl/services/cache/CachedItem.class"/>
        <uptodate srcfile="${derby.engine.dir}/impl/store/raw/data/RecordId.java"
                  targetfile="${out.dir}/org/apache/derby/impl/store/raw/data/RecordId.class"/>
        <uptodate srcfile="${derby.engine.dir}/iapi/store/raw/ContainerKey.java"
                  targetfile="${out.dir}/org/apache/derby/iapi/store/raw/ContainerKey.class"/>
        <uptodate srcfile="${derby.engine.dir}/iapi/services/cache/SizedCacheable.java"
                  targetfile="${out.dir}/org/apache/derby/iapi/services/cache/SizedCacheable.class"/>
        <available file="${generated.src.dir}/${derby.dir}/iapi/services/cache/ClassSizeCatalogImpl.java"/>
      </and>
    </condition>
  </target>

<!-- =================================================================== -->
<!-- Generate sanity.properties -->
<!-- =================================================================== -->

  <target name="sane" depends="make-generated-dirs">
    <propertyfile file="${state.file}" comment="${header}">
      <entry key="sanity" value="true" type="string"/>
    </propertyfile>
    <delete dir="${sanity.out.dir}"/>
  </target>
  <target name="insane" depends="make-generated-dirs">
    <propertyfile file="${state.file}" comment="${header}">
      <entry key="sanity" value="false" type="string"/>
    </propertyfile>
    <delete dir="${sanity.out.dir}"/>
  </target>


<!-- =================================================================== -->
<!-- Javadoc targets -->
<!-- =================================================================== -->

  <!-- javadoc specific properties -->

  <property name="public.api.dir" value="${out.javadoc.dir}/publishedapi"/>
  <property name="javadoc.temp.dir" value="${out.javadoc.dir}/temp"/>
  <property name="javadoc.exclusions" value="${javadoc.temp.dir}/javadoc_exclusions"/>
  <property name="javadoc.inclusions" value="${javadoc.temp.dir}/javadoc_inclusions"/>

  <!-- Helper target to build the JavaDocs and zip them up.
Introduced to achieve a higher degree of platform independence when
pulling JavaDocs from continuous integration systems and build systems.
-->
  <target name="javadoc-with-bundle" depends="javadoc">
    <property name="javadoc.bundle" value="${out.javadoc.dir}/javadocs.zip"/>
    <delete file="${javadoc.bundle}" quiet="true"/>
    <zip destfile="${javadoc.bundle}"
         basedir="${out.javadoc.dir}"/>
  </target>

  <target
      name="javadoc"
      depends="init,initjars,publishedapi,derbydocs,toolsdocs,grammardocs,testingdocs"
      description="Build all of the javadoc, including the public api, the production javadoc, and the testing javadoc."
  />

  <target name="publishedapi" depends="initjars">
 
    <tstamp>
      <format
          property="javadoc.ts"
          pattern="EEE yyyy-MM-dd HH:mm:ssZ"
          locale="en, us"/>
    </tstamp>
    <property
        name="javadoc.Footer"
        value="Built on ${javadoc.ts}, from revision ${changenumber}"/>
  
    <delete dir="${public.api.dir}"/>
    <mkdir dir="${public.api.dir}"/>
 
    <antcall target="publishedapi-workhorse">
      <param name="extraApi" value="publishedapi_jdbc.ant"/>
    </antcall>

  </target>

<!-- ==================================================================== -->
<!-- Download Java SE and J2EE's "package-list"s -->
<!-- ==================================================================== -->

   <!-- You can override this property in local.properties to fetch from an alternative location -->
   <property name="javasedoc.url" value="http://docs.oracle.com/javase/8/docs/api"/>
   <property name="j2eedoc.url" value="http://docs.oracle.com/javaee/7/api"/>
   <property name="javasedoc.local" value="packageListLoc-se-8"/>
   <property name="j2eedoc.local" value="packageListLoc-j2ee-7"/>

   <target name="packagelist_check">
     <condition property="javadoc_local.exists">
       <and>
       <available file="${javasedoc.local}/package-list" property="javasedoc.exists"/>
       <available file="${j2eedoc.local}/package-list" property="j2eedoc.exists"/>
       </and>
     </condition>
   </target>

   <target name="install_packagelists" depends="packagelist_check" unless="javadoc_local.exists" description="downloads Java SE and J2EE package lists to local cache">
       <mkdir dir="${javasedoc.local}"/>
       <mkdir dir="${j2eedoc.local}"/>
       <get src="${javasedoc.url}/package-list" dest="${javasedoc.local}/" verbose="true" ignoreerrors="false"/>
       <get src="${j2eedoc.url}/package-list" dest="${j2eedoc.local}/" verbose="true" ignoreerrors="false"/>
   </target>

  <!--
This target used to be called twice, once to build the JDBC3 public api
and then a second time to build the JDBC4 api. Now it is only called once,
for the single JDBC4+ api.

bootClasspath Sensitive to JDBC level.
extraApi Extra files to include in the public api.

If behind a firewall, the links to Java SE and J2EE javadocs may
fail. You can manually download the package-list files into the
folders ./packageListLoc-se-8 and ./packageListLoc-j2ee-7 instead
to get a correct build.
-->
  <target name="publishedapi-workhorse" depends="initjars,set-doclint,install_packagelists">
 
    <!-- Only include the files we want customers to see. -->
    <mkdir dir="${javadoc.temp.dir}"/>
    <antcall target="include-in-javadoc">
      <param name="more_inclusions" value="publishedapi.ant"/>
    </antcall>
    <antcall target="include-in-javadoc">
      <param name="more_inclusions" value="${extraApi}"/>
    </antcall>

    <javadoc bootclasspath="${bootClasspath}"
             classpath="${bootClasspath};${osgi};${servlet24};${out.dir};${jars.javadoc}"
             sourcepath="${derby.engine.src.dir}:${derby.client.src.dir}:${derby.drda.src.dir}:${derby.shared.src.dir}:${derby.optional.src.dir}:${derby.tools.src.dir}"
             excludepackagenames="org.apache.derby.*"
             breakiterator="true"
             access="public"
             destdir="${public.api.dir}"
     Overview="${basedir}/published_api_overview.html"
             Windowtitle="Apache Derby ${major}.${minor} API Documentation"
             Header="Apache Derby ${major}.${minor}"
             Footer="${javadoc.Footer}"
             bottom="Apache Derby ${major}.${minor} API Documentation - &lt;i&gt;Copyright &amp;copy; 2004,${copyright.year} The Apache Software Foundation. All Rights Reserved.&lt;/i&gt;">
      <Doctitle> Apache Derby ${major}.${minor} API Documentation</Doctitle>
      <link offline="true" href="${javasedoc.url}"
                         packagelistLoc="${javasedoc.local}" />
      <link offline="true" href="${j2eedoc.url}"
                     packagelistLoc="${j2eedoc.local}" />
      <fileset dir="${derby.engine.src.dir}"
               includesfile="${javadoc.inclusions}"/>
      <fileset dir="${derby.client.src.dir}"
               includesfile="${javadoc.inclusions}"/>
      <fileset dir="${derby.drda.src.dir}"
               includesfile="${javadoc.inclusions}"/>
      <fileset dir="${derby.tools.src.dir}"
               includesfile="${javadoc.inclusions}"/>
      <fileset dir="${derby.optional.src.dir}"
               includesfile="${javadoc.inclusions}"/>
      <arg value="${xarg.doclint}"/>
    </javadoc>

    <delete dir="${javadoc.temp.dir}"/>
   
    <!-- Copy the logo needed by the Doctitle attribute above -->
    <copy file="${javadoctools.dir}/logo/derby_logo64.png"
          todir="${public.api.dir}/resources"/>
    

  </target>


  <target name="derbydocs" depends="initjars,set-doclint">

    <delete dir="${out.javadoc.dir}/engine"/>
    <mkdir dir="${out.javadoc.dir}/engine"/>

    <!-- Some of the link tags are lost when using nested filesets. Fool -->
    <!-- javadoc into creating relative links by seeding it with the list -->
    <!-- of packages that have @link tags in their package.htmls -->
    <copy file="${javadoctools.dir}/package-list"
          todir="${out.javadoc.dir}/engine"/>

    <!-- Build scripts and other cruft choke javadoc. Exclude these files. -->
    <mkdir dir="${javadoc.temp.dir}"/>
    <antcall target="exclude-from-javadoc">
      <param name="more_exclusions" value="derbydocs_exclusions.ant"/>
    </antcall>
    <antcall target="exclude-java8-from-javadoc"/>

    <javadoc
        additionalparam="-J-mx500M"
        packagenames="org.*"
        access="private"
        breakiterator="yes"
        useexternalfile="yes"
        classpath="${out.dir};${jars.javadoc}"
        destdir="${out.javadoc.dir}/engine"
        windowtitle="Apache Derby V${major}.${minor} Internals"
        doctitle="Apache Derby V${major}.${minor} Internals"
        Footer="${javadoc.Footer}"
        bottom="Apache Derby V${major}.${minor} Internals - &lt;i&gt;Copyright &amp;copy; 2004,${copyright.year} The Apache Software Foundation. All Rights Reserved.&lt;/i&gt;">
        <taglet name="org.apache.derbyBuild.javadoc.FormatIdTaglet"
                path="${basedir}/classes"/>
        <taglet name="org.apache.derbyBuild.javadoc.PurposeTaglet"
                path="${basedir}/classes"/>
        <taglet name="org.apache.derbyBuild.javadoc.UpgradeTaglet"
                path="${basedir}/classes"/>
        <taglet name="org.apache.derbyBuild.javadoc.DiskLayoutTaglet"
                path="${basedir}/classes"/>
        <taglet name="org.apache.derbyBuild.javadoc.EndFormatTaglet"
                path="${basedir}/classes"/>
      <fileset dir="${derby.engine.src.dir}"
               excludesfile="${javadoc.exclusions}"/>
      <fileset dir="${derby.client.src.dir}"
               excludesfile="${javadoc.exclusions}"/>
      <fileset dir="${derby.drda.src.dir}"
               excludesfile="${javadoc.exclusions}"/>
      <fileset dir="${derby.shared.src.dir}"
               excludesfile="${javadoc.exclusions}"/>
      <fileset dir="${derby.tools.src.dir}"
               excludesfile="${javadoc.exclusions}"/>
      <link href="."/>
      <arg value="${xarg.doclint}"/>
    </javadoc>

    <delete dir="${javadoc.temp.dir}"/>

  </target>

  <!--
Include more files in the javadoc. Successive calls to this
target append more inclusions to the master file that tells
javadoc which files to notice.

Parameters:

more_inclusions Additional file to append to master inclusions file.
-->
  <target name="include-in-javadoc">
    <concat destfile="${javadoc.inclusions}" append="yes">
       <filelist dir="${javadoctools.dir}"
         files="${more_inclusions}"
       />
    </concat>
  </target>

  <!--
Exclude more files from the javadoc. Successive calls to this
target append more exclusions to the master file that tells
javadoc which files to ignore.

Parameters:

more_exclusions Additional file to append to master exclusions file.
-->
  <target name="exclude-from-javadoc">
    <concat destfile="${javadoc.exclusions}" append="yes">
       <filelist dir="${javadoctools.dir}"
         files="${more_exclusions}"
       />
    </concat>
  </target>

  <!--
Exclude Java 8 support from the javadoc if using Java 7 or earlier.
-->
  <target name="exclude-java8-from-javadoc" depends="checkVMLevel" unless="vmLevelIsAtLeast1.8">
    <antcall target="exclude-from-javadoc">
      <param name="more_exclusions" value="derbydocs_java8_exclusions.ant"/>
    </antcall>
  </target>

  <target name="toolsdocs">

    <delete dir="${out.javadoc.dir}/tools"/>
    <mkdir dir="${out.javadoc.dir}/tools"/>

    <antcall target="dojjdocs">
      <param name="jjtodoc" value="${derby.tools.dir}/impl/tools/ij/ij.jj"/>
      <param name="jjdoctarget" value="${out.javadoc.dir}/tools/ij.html"/>
    </antcall>

  </target>

  <target name="demodocs" depends="init,set-doclint">

    <delete dir="${out.javadoc.dir}/demo"/>
    <mkdir dir="${out.javadoc.dir}/demo"/>

    <javadoc
        additionalparam="-J-mx500M"
        packagenames="org.apache.derbyDemo.vtis.*"
        access="private"
        breakiterator="yes"
        useexternalfile="yes"
        classpath="${out.dir}"
        destdir="${out.javadoc.dir}/demo"
        windowtitle="Apache Derby Demos"
        doctitle="Apache Derby Demos"
    >
     <fileset dir="${derby.demo.src.dir}/vtis/java"/>
      <arg value="${xarg.doclint}"/>
    </javadoc>


  </target>

  <target name="grammardocs">

    <delete dir="${out.javadoc.dir}/language"/>
    <mkdir dir="${out.javadoc.dir}/language"/>

    <antcall target="dojjdocs">
      <param name="jjtodoc" value="${derby.engine.dir}/impl/sql/compile/sqlgrammar.jj"/>
      <param name="jjdoctarget" value="${out.javadoc.dir}/language/sqlgrammar.html"/>
    </antcall>

  </target>

  <target name="dojjdocs">

    <java classname="jjdoc" fork="yes">
      <classpath path="${javatools.dir}/javacc.jar;${compile.classpath}"/>
      <arg value="-NOONE_TABLE"/>
      <arg value="-output_file=${jjdoctarget}"/>
      <arg value="${jjtodoc}"/>
    </java>

  </target>

  <target name="testingdocs" depends="initjars,set-doclint">

    <antcall target="exclude-from-javadoc">
      <param name="more_exclusions" value="derbydocs_exclusions.ant"/>
    </antcall>
    <antcall target="exclude-java8-from-javadoc"/>

    <javadoc
       additionalparam="-J-mx500M"
       packagenames="org.*"
       access="private"
       breakiterator="yes"
       useexternalfile="yes"
       bootclasspath="${java18compile.classpath}"
       classpath="${out.dir};${java18compile.classpath};${jars.javadoc};${junit}"
       destdir="${out.javadoc.dir}/testing"
       windowtitle="Apache Derby V${major}.${minor} Test Javadoc"
       doctitle="Apache Derby V${major}.${minor} Test Javadoc"
       Footer="${javadoc.Footer}"
       bottom="Apache Derby V${major}.${minor} Internals - &lt;i&gt;Copyright &amp;copy; 2004,${copyright.year} The Apache Software Foundation. All Rights Reserved.&lt;/i&gt;"
       source="1.6"
     >
      <fileset dir="${derby.testing.src.dir}"
               excludesfile="${javadoc.exclusions}"/>
      <arg value="${xarg.doclint}"/>
    </javadoc>

  </target>

  <target name="cleandocs">

    <delete dir="${out.javadoc.dir}"/>

  </target>

  <!-- Set the doclint variable depending on whether this is Java 8. Use a harmless arg if not on Java 8 -->
  <target name="set-doclint">
    <condition property="xarg.doclint" value="-Xdoclint:none" else="-J-mx500M">
      <available classname="java.sql.SQLType"/>
    </condition>
  </target>


<!-- =================================================================== -->
<!-- Eclipse Plugin -->
<!-- =================================================================== -->
  <target name="plugin" depends= "buildjars">
       <echo level="info" message="Begining Derby Eclipse plugin build"/>
       <property name="plugin.tmp.dir" value ="plugintmp"/>
       <mkdir dir="${derby.jar.dir}/${plugin.tmp.dir}"/>

       <java classname="org.apache.derbyBuild.eclipse.DerbyEclipsePlugin">
               <arg value="${derby.jar.dir}/${plugin.tmp.dir}"/>
               <classpath>
                       <pathelement path="${out.dir}"/>
               </classpath>
       </java>

       <property file="${derby.jar.dir}/${plugin.tmp.dir}/plugintmp.properties"/>
       <echo level="info" message="Derby Eclipse plugin build: ${plugin.derby.version.build.number}"/>

       <property name="plugin.dir" value ="plugins"/>
       <property name="plugin.core.dir" value ="${plugin.derby.core}_${plugin.derby.version}"/>

       <mkdir dir="${derby.jar.dir}/${plugin.tmp.dir}/${plugin.dir}/${plugin.core.dir}"/>

       <copy todir="${derby.jar.dir}/${plugin.tmp.dir}/${plugin.dir}/${plugin.core.dir}">
               <fileset dir="${derby.jar.dir}" includes="derby*.jar" excludes="derbyTesting.jar,derbyLocale*.jar,derbyrun.jar"/>
       </copy>
       <copy todir="${derby.jar.dir}/${plugin.tmp.dir}/${plugin.dir}/${plugin.core.dir}">
               <fileset dir="${derby.jar.dir}/${plugin.tmp.dir}" includes="plugin*.xml"/>
       </copy>

       <copy todir="${derby.jar.dir}/${plugin.tmp.dir}/${plugin.dir}/${plugin.core.dir}" file="LICENSE"/>
       <copy todir="${derby.jar.dir}/${plugin.tmp.dir}/${plugin.dir}/${plugin.core.dir}" file="NOTICE"/>

       <!-- copy the plugin properties for use by the release target -->
       <copy file="${derby.jar.dir}/${plugin.tmp.dir}/plugintmp.properties" todir="${release.base}"/>

       <delete file="${derby.jar.dir}/${plugin.tmp.dir}/plugintmp.properties"/>
       <delete file="${derby.jar.dir}/${plugin.tmp.dir}/plugin.xml"/>

       <!-- ZIP to create the final Derby plug-in -->

       <zip zipfile="${derby.jar.dir}/${plugin.derby.core.zipfile}_${plugin.derby.version}.zip" compress="true" basedir="${derby.jar.dir}/${plugin.tmp.dir}"/>
       <delete dir="${derby.jar.dir}/${plugin.tmp.dir}"/>
  </target>

<!-- =================================================================== -->
<!-- Jar targets -->
<!-- =================================================================== -->

  <target name="buildjarsclean" depends="cleanjars,buildjars"/>

  <target
      name="buildjars"
      depends="initjars,derbyjar,derbytoolsjar,derbynetjar,derbyclientjar,derbyoptionaltoolsjar,derbyrunjar,derbywar,derbylocalejars,derbytestingjar"
      description="Build all of the Derby jar files."
  />

  <target name="initjars" depends="setsanityname,getsvnversion,setCompilerProperties">
    <property name="derby.jar.dir" value="${jarsdist.dir}/${sanity.name}"/>
    <property name="derby.jar.topdir" value="${jarsdist.dir}"/>
    <mkdir dir="${derby.jar.dir}"/>
    <mkdir dir="${derby.jar.dir}/lists"/>
  </target>


<!-- - - - - - - - - - - - - - - derby.jar target - - - - - - - - - - - -->

  <target name="derbyjar" depends="checkVMLevel,initjars">

    <echo level="info" message="Beginning derby.jar ${sanity.name} build"/>

    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <!-- Classes that will only be compiled with JDK 7 and higher are
commented out. Determine here whether they should be included. -->
    <condition property="derbyjar.jdk7.prefix" value="" else="#">
        <isset property="vmLevelIsAtLeast1.7"/>
    </condition>

    <concat destfile="${derby.jar.dir}/lists/otherDerbyClasses.properties">
      <fileset dir="${basedir}/tools/jar" includes="*DBMS*.properties"/>
      <filterchain>
          <replacestring from="#jdk7#" to="${derbyjar.jdk7.prefix}"/>
      </filterchain>
    </concat>

    <mkdir dir="${derby.jar.dir}/lists/org/apache/derby"/>
    <java classname="org.apache.derbyBuild.propertyconfig" fork="yes">
      <arg value="${out.dir}/org/apache/derby/modules.properties"/>
      <arg value="derby"/>
      <arg value="${derby.jar.dir}/lists/org/apache/derby/modules.properties"/>
      <classpath>
        <pathelement path="${out.dir}"/>
      </classpath>
    </java>

    <echo level="info" message=" creating derby.jar class list "/>
    <java classname="org.apache.derbyBuild.classlister" fork="yes">
      <jvmarg value="-DcloudscapeOnly=true"/>
      <jvmarg value="-Doutputfile=${derby.jar.dir}/lists/derby.list"/>
      <arg value="${derby.jar.dir}/lists/otherDerbyClasses.properties"/>
      <arg value="${derby.jar.dir}/lists/org/apache/derby/modules.properties"/>
      <classpath>
        <pathelement path="${out.dir}"/>
      </classpath>
    </java>

    <!-- This next antcall generates a new properties file for the build. -->
    <!-- If a changenumber is passed into the build via a property file or -->
    <!-- on the command line, the build number will be inserted into the -->
    <!-- build at this point. -->
 
    <echo level="info" message=" creating new DBMS.properties file"/>
    <antcall target="infowriter">
      <param name="info.iname" value="Apache Derby Embedded Engine"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.productfile" value="derby.jar"/>
      <param name="info.file" value="${out.dir}//org/apache/derby/info/DBMS.properties"/>
    </antcall>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>

    <!-- declare the embedded driver for autoloading by the JDBC 4 DriverManager -->
    <antcall target="declare-autoloadable-driver">
      <param name="driver.name" value="org.apache.derby.jdbc.AutoloadedDriver"/>
    </antcall>

    <antcall target="make-core-derbyjar-manifest">
      <param name="manifest.file" value="${derby.jar.dir}/lists/smf.mf"/>
    </antcall>

    <!-- add extra osgi bits to manifest -->

    <manifest file="${derby.jar.dir}/lists/smf.mf" mode="update">
      <attribute name="Bundle-Activator" value="org.apache.derby.osgi.EmbeddedActivator"/>
      <attribute name="Bundle-SymbolicName" value="derby"/>
      <attribute name="DynamicImport-Package" value="*"/>
      <attribute name="Export-Package" value="org.apache.derby.authentication,org.apache.derby.database,org.apache.derby.io,org.apache.derby.jdbc,org.apache.derby.vti"/>
    </manifest>

    <jar destfile="${derby.jar.dir}/derby.jar"
         basedir="${out.dir}"
includesfile="${derby.jar.dir}/lists/derby.list"
         compress="true"
         filesonly="true"
         manifest="${derby.jar.dir}/lists/smf.mf">
      <fileset dir="${out.dir}"
               includes="org/apache/derby/loc/m?_en.properties,
org/apache/derby/loc/m??_en.properties,
org/apache/derby/loc/sysinfoMessages.properties,
org/apache/derby/loc/toolsmessages.properties,
org/apache/derby/impl/jdbc/metadata.properties,
org/apache/derby/impl/sql/catalog/metadata_net.properties,
org/apache/derby/info/DBMS.properties"/>
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/**,
org/apache/derby/modules.properties"/>
    </jar>

  </target>

  <!-- Add localized jars to the classpath -->
  <target name="make-locale-classpath-manifest">
      <manifest file="${manifest.file}" mode="${manifest.mode}">
          <attribute name="Class-Path" value="derbyLocale_cs.jar derbyLocale_de_DE.jar derbyLocale_es.jar derbyLocale_fr.jar derbyLocale_hu.jar derbyLocale_it.jar derbyLocale_ja_JP.jar derbyLocale_ko_KR.jar derbyLocale_pl.jar derbyLocale_pt_BR.jar derbyLocale_ru.jar derbyLocale_zh_CN.jar derbyLocale_zh_TW.jar"/>
      </manifest>
  </target>

  <target name="make-core-derbyjar-manifest">

    <manifest file="${manifest.file}">
      <attribute name="Bundle-Vendor" value="Apache Software Foundation"/>
      <attribute name="Bundle-Name" value="Apache Derby ${major}.${minor}"/>
      <attribute name="Bundle-Version" value="${major}.${minor}.${maint}.${changenumber}"/>
      <attribute name="Bundle-ManifestVersion" value="2"/>
       <attribute name="Sealed" value="true"/>
     <section name="org/apache/derby/impl/tools/sysinfo/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/iapi/services/context/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/iapi/services/info/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/jdbc/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/info/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/iapi/services/i18n/">
     <attribute name="Sealed" value="false"/>
     </section>
        <!-- See DERBY-4669. -->
        <section name="org/apache/derby/shared/common/sanity/">
          <attribute name="Sealed" value="false"/>
        </section>
        <section name="org/apache/derby/iapi/tools/i18n/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/loc/">
     <attribute name="Sealed" value="false"/>
     </section>
       <section name="org/apache/derby/tools/">
     <attribute name="Sealed" value="false"/>
     </section>
    </manifest>

    <antcall target="make-locale-classpath-manifest">
        <param name="manifest.file" value="${manifest.file}"/>
        <param name="manifest.mode" value="update"/>
    </antcall>

  </target>

<!-- - - - - - - - - - - - - derbytools.jar target - - - - - - - - - - -->

  <target name="derbytoolsjar" depends="setsanityname">

    <echo level="info" message="Beginning derbytools.jar ${sanity.name} build"/>

    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <echo level="info" message=" creating tools.list "/>
    <java classname="org.apache.derbyBuild.classlister" fork="yes">
      <jvmarg value="-Ddb2jtools=true"/>
      <jvmarg value="-Doutputfile=${derby.jar.dir}/lists/derbytools.list"/>
      <arg value="${basedir}/tools/jar/tools.properties"/>
      <classpath>
        <pathelement path="${out.dir}"/>
      </classpath>
    </java>
    <replace file="${derby.jar.dir}/lists/derbytools.list" token="$$$$" value="$$"/>

    <echo level="info" message=" creating new tools.properties file "/>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.iname" value="Apache Derby Tools"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="derbytools.jar"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/tools.properties"/>
    </antcall>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>
    <antcall target="make-locale-classpath-manifest">
        <param name="manifest.file" value="${derby.jar.dir}/lists/smftools.mf"/>
        <param name="manifest.mode" value="replace"/>
    </antcall>

    <delete file="${derby.jar.dir}/derbytools.jar"/>
    <jar destfile="${derby.jar.dir}/derbytools.jar"
         basedir="${out.dir}"
         includesfile="${derby.jar.dir}/lists/derbytools.list"
         manifest="${derby.jar.dir}/lists/smftools.mf"
         compress="true"
         filesonly="true">
      <fileset dir="${out.dir}"
               includes="org/apache/derby/loc/sysinfoMessages.properties,
org/apache/derby/loc/toolsmessages.properties,
org/apache/derby/info/tools.properties"/>
<fileset dir="${derby.tools.src.dir}"
               includes="org/apache/derby/impl/tools/planexporter/resources/*.xsl"/>
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/**"/>
    </jar>
  </target>

<!-- - - - - - - - - - - - - derbyoptionaltools.jar target - - - - - - - - - - -->

  <target name="derbyoptionaltoolsjar" depends="setsanityname">

    <echo level="info" message="Beginning derbyoptionaltools.jar ${sanity.name} build"/>

    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <echo level="info" message=" creating new tools.properties file "/>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.iname" value="Apache Derby Optional Tools"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="derbyoptionaltools.jar"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/optional/optionaltools.properties"/>
    </antcall>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>
    <manifest file="${derby.jar.dir}/lists/smfoptionaltools.mf">
      <attribute name="Bundle-Vendor" value="Apache Software Foundation"/>
      <attribute name="Bundle-Name" value="Apache Derby ${major}.${minor}"/>
      <attribute name="Bundle-Version" value="${major}.${minor}.${maint}.${changenumber}"/>
      <attribute name="Bundle-ManifestVersion" value="2"/>
      <attribute name="Sealed" value="true"/>
    </manifest>

    <antcall target="make-locale-classpath-manifest">
        <param name="manifest.file" value="${derby.jar.dir}/lists/smfoptionaltools.mf"/>
        <param name="manifest.mode" value="update"/>
    </antcall>

    <delete file="${derby.jar.dir}/derbyoptionaltools.jar"/>
    <jar destfile="${derby.jar.dir}/derbyoptionaltools.jar"
         basedir="${out.dir}"
         includes="org/apache/derby/optional/**"
         manifest="${derby.jar.dir}/lists/smfoptionaltools.mf"
         compress="true"
         filesonly="true">
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/**"/>
    </jar>
  </target>

<!-- - - - - - - - - - - - - - derbynet.jar target - - - - - - - - - - - -->

  <target name="derbynetjar" depends="setsanityname">

    <echo level="info" message="Beginning derbynet.jar ${sanity.name} build"/>

    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <echo level="info" message=" creating net.list"/>
    <java classname="org.apache.derbyBuild.classlister" fork="yes">
      <jvmarg value="-Ddb2jdrda=true"/>
      <jvmarg value="-Doutputfile=${derby.jar.dir}/lists/derbynet.list"/>
      <arg value="${basedir}/tools/jar/net.properties"/>
      <classpath>
        <pathelement path="${out.dir}"/>
      </classpath>
    </java>

    <echo level="info" message=" creating new net.properties file "/>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.iname" value="Apache Derby Network Server"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="derbynet.jar"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/net.properties"/>
    </antcall>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>

    <manifest file="${derby.jar.dir}/lists/smfnet.mf">
      <attribute name="Main-Class" value="org.apache.derby.drda.NetworkServerControl"/>
      <attribute name="Class-Path" value="derby.jar"/>
       <attribute name="Sealed" value="true"/>
     <section name="org/apache/derby/impl/drda/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/impl/tools/sysinfo/">
     <attribute name="Sealed" value="false"/>
     </section>
       <section name="org/apache/derby/tools/">
     <attribute name="Sealed" value="false"/>
     </section>
     <section name="org/apache/derby/loc/">
     <attribute name="Sealed" value="false"/>
     </section>
    </manifest>

    <delete file="${derby.jar.dir}/derbynet.jar"/>
    <jar destfile="${derby.jar.dir}/derbynet.jar"
         basedir="${out.dir}"
         includesfile="${derby.jar.dir}/lists/derbynet.list"
         compress="true"
         filesonly="true"
     manifest="${derby.jar.dir}/lists/smfnet.mf">
      <fileset dir="${out.dir}"
               includes="org/apache/derby/loc/drda/**,
org/apache/derby/loc/sysinfoMessages.properties,
org/apache/derby/info/net.properties,
org/apache/derby/drda/server.policy"/>
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/**"/>
    </jar>

  </target>

<!-- - - - - - - - - - - - - - derbyclient.jar target - - - - - - - - -->

 <target name="derbyclientjar" depends="checkVMLevel,setsanityname,initjars">

    <echo level="info" message="Beginning derbyclient.jar ${sanity.name} build"/>

    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <copy file="${basedir}/tools/jar/dnc.properties"
          tofile="${derby.jar.dir}/lists/dnc.properties"/>
    <antcall target="derbyclientjar.1.8"/>

    <java classname="org.apache.derbyBuild.classlister" fork="yes">
      <jvmarg value="-Doutputfile=${derby.jar.dir}/lists/dnc.list"/>
      <arg value="${derby.jar.dir}/lists/dnc.properties"/>
      <classpath>
        <pathelement path="${out.dir}"/>
      </classpath>
    </java>

    <echo level="info" message=" creating new dnc.properties file "/>

    <mkdir dir="${out.dir}/org/apache/derby/info/"/>
    <antcall target="infowriter">
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.iname" value="Apache Derby Network Client"/>
      <param name="info.ename" value="Apache Derby"/>
      <param name="info.productfile" value="codeline"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/dnc.properties"/>
    </antcall>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>
    <antcall target="make-core-derbyjar-manifest">
      <param name="manifest.file" value="${derby.jar.dir}/lists/smfclient.mf"/>
    </antcall>

    <!-- add extra osgi bits to manifest -->

    <manifest file="${derby.jar.dir}/lists/smfclient.mf" mode="update">
      <attribute name="Bundle-SymbolicName" value="derbyclient"/>
      <attribute name="DynamicImport-Package" value="*"/>
      <attribute name="Export-Package" value="org.apache.derby.jdbc"/>
      <!-- See DERBY-4669. -->
      <section name="org/apache/derby/shared/common/sanity/">
        <attribute name="Sealed" value="false"/>
      </section>
    </manifest>

    <!-- declare the client driver for autoloading by the JDBC 4 DriverManager -->
    <antcall target="declare-autoloadable-driver">
      <param name="driver.name" value="org.apache.derby.jdbc.ClientDriver"/>
    </antcall>

    <delete file="${derby.jar.dir}/derbyclient.jar"/>

    <jar destfile="${derby.jar.dir}/derbyclient.jar"
         compress="true"
         filesonly="true"
         update="true"
     manifest="${derby.jar.dir}/lists/smfclient.mf">
      <fileset dir="${out.dir}"
               includesfile="${derby.jar.dir}/lists/dnc.list"/>
      <fileset dir="${out.dir}"
               includes="org/apache/derby/info/dnc.properties,
org/apache/derby/loc/sysinfoMessages.properties,
org/apache/derby/loc/clientmessages*.properties"
               excludes="org/apache/derby/loc/clientmessages_qq_PP_testOnly.properties"/>
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/**"/>
    </jar>
  </target>


  <!-- Add extra classes to jar file if building for Java 8 -->
  <target name="derbyclientjar.1.8" if="vmLevelIsAtLeast1.8">
    <concat destfile="${derby.jar.dir}/lists/dnc.properties" append="true">
      <fileset file="${basedir}/tools/jar/dnc.1.8.properties" />
    </concat>
  </target>

<!-- - - - - - - - - - - - - - derbyrun.jar target - - - - - - - - - -->
   
  <target name="derbyrunjar" depends="setsanityname,initjars">

    <echo level="info" message="Beginning derbyrun.jar build"/>

    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>
    
    <manifest file="${derby.jar.dir}/lists/smfcmd.mf">
      <attribute name="Main-Class" value="org.apache.derby.iapi.tools.run"/>
      <attribute name="Class-Path" value="derby.jar derbyclient.jar derbytools.jar derbynet.jar derbyoptionaltools.jar"/>
    </manifest>
 
    <jar destfile="${derby.jar.dir}/derbyrun.jar"
         compress="true"
         filesonly="true"
         update="true"
     manifest="${derby.jar.dir}/lists/smfcmd.mf">
      <fileset dir="${out.dir}"
               includes="org/apache/derby/iapi/tools/run.class"/>
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/LICENSE,META-INF/NOTICE"/>
    </jar>

  </target>
<!-- - - - - - - - - - - - - - derby.war target - - - - - - - - - - - -->

 <target name="derbywar" depends="initjars">

    <echo level="info" message="Beginning derby.war build"/>
    <delete file="${derby.jar.dir}/derby.war"/>
    <zip zipfile="${derby.jar.dir}/derby.war" compress="true" basedir="tools/j2ee/derby"/>
  </target>

<!-- - - - - - - - - - - - - - locale jar targets - - - - - - - - - - - -->

  <target name="derbylocalejars" depends="initjars">
 
    <!-- purge lists directory to avoid unnecessary content from other jars -->
    <delete>
      <fileset dir="${derby.jar.dir}/lists" includes="**/*"/>
    </delete>

    <!-- copy boilerplate common to derby jar files -->
    <antcall target="meta-inf-common"/>

    <!-- call localejar for each locale -->

    <antcall target="localejar">
      <param name="locale.iname" value="cs"/>
      <param name="locale.ename" value="Czech/International [cs]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="de_DE"/>
      <param name="locale.ename" value="German/Germany [de_DE]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="es"/>
      <param name="locale.ename" value="Spanish/International [es]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="fr"/>
      <param name="locale.ename" value="French/International [fr]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="hu"/>
      <param name="locale.ename" value="Hungarian/International [hu]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="it"/>
      <param name="locale.ename" value="Italian/International [it]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="ja_JP"/>
      <param name="locale.ename" value="Japanese/Japan [ja_JP]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="ko_KR"/>
      <param name="locale.ename" value="Korean/Korea [ko_KR]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="pl"/>
      <param name="locale.ename" value="Polish/International [pl]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="pt_BR"/>
      <param name="locale.ename" value="Portuguese/Brazil [pt_BR]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="ru"/>
      <param name="locale.ename" value="Russian/International [ru]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="zh_CN"/>
      <param name="locale.ename" value="Simplified_Chinese/PR_China [zh_CN]"/>
    </antcall>
    <antcall target="localejar">
      <param name="locale.iname" value="zh_TW"/>
      <param name="locale.ename" value="Chinese/Taiwan_Traditional [zh_TW]"/>
    </antcall>
  </target>

  <target name="localejar">
 
    <echo level="info" message="Building derbyLocale_${locale.iname}.jar"/>

    <!-- generate new locale property file -->
    <antcall target="localeinfowriter">
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.iname" value="_${locale.iname}"/>
      <param name="info.ename" value="${locale.ename}"/>
      <param name="info.productfile" value="derbyLocale_${locale.iname}.jar"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/locale_${locale.iname}.properties"/>
    </antcall>

    <jar destfile="${derby.jar.dir}/derbyLocale_${locale.iname}.jar"
         compress="true"
filesonly="true">
      <fileset dir="${out.dir}"
includes="org/apache/derby/info/*_${locale.iname}.properties,
org/apache/derby/loc/*_${locale.iname}.properties,
org/apache/derby/loc/drda/*_${locale.iname}.properties"/>
      <fileset dir="${derby.jar.dir}/lists"
               includes="META-INF/LICENSE,META-INF/NOTICE"/>
    </jar>
  </target>
    
<!-- - - - - - - - - - - - derby testing jar target - - - - - - - - - - -->

  <target name="derbytestingjar" depends="initjars,ckderbytesting" if="derbyTesting.available">
    <!-- generate tsting info property file -->
    <antcall target="tstinginfowriter">
      <param name="info.buildnumber" value="${changenumber}"/>
      <param name="info.iname" value="tsting"/>
      <param name="info.productfile" value="derbyTesting.jar"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/tsting.properties"/>
    </antcall>

    <zip destfile="${derby.jar.dir}/derbyTesting.jar" filesonly="true" compress="true">
      <fileset dir="${out.dir}" includes="org/apache/derbyTesting/**,SimpleApp*,org/apache/derby/impl/tools/ij/mt*.class,org/apache/derby/impl/tools/ij/SimpleCharStream.class,org/apache/derby/impl/drda/TestProto.class,org/apache/derby/impl/store/access/conglomerate/QualifierUtil.class,org/apache/derby/loc/m*_qq_PP_testOnly*,toursdb/*,org/apache/derby/info/tsting.properties"/>
    </zip>
  </target>

  <target name="ckderbytesting">
    <available file="${out.dir}/org/apache/derbyTesting"
               property="derbyTesting.available"/>
  </target>

  <target name="buildtestinginfo">
    <antcall target="tstinginfowriter">
      <param name="info.buildnumber" value="1"/>
      <param name="info.iname" value="tsting"/>
      <param name="info.productfile" value="derbyTesting.jar"/>
      <param name="info.file" value="${out.dir}/org/apache/derby/info/tsting.properties"/>
    </antcall>
  </target>

  <target name="tstinginfowriter">
    <propertyfile file="${info.file}" comment="${copyright.comment}">
      <entry key="derby.tsting.version.major" value="${major}"/>
      <entry key="derby.tsting.version.minor" value="${minor}"/>
      <entry key="derby.tsting.version.maint" value="${maint}"/>
      <entry key="derby.tsting.build.number" value="${info.buildnumber}"/>
      <entry key="derby.tsting.technology.name" value="${info.iname}"/>
      <entry key="derby.tsting.external.name" value="${info.iname}"/>
      <entry key="derby.version.beta" value="${beta}"/>
      <entry key="derby.tsting.vendor" value="${vendor}"/>
      <entry key="derby.product.file" value="${info.productfile}"/>
    </propertyfile>
  </target>

<!-- - - - - - - - - - - - jar build helper targets - - - - - - - - - -->

  <target name="setsanityname" depends="init,setissane,sanitynamesane,sanitynameinsane"/>

  <target name="sanitynamesane" if="is.sane">
    <property name="sanity.name" value="sane"/>
  </target>

  <target name="sanitynameinsane" unless="is.sane">
    <property name="sanity.name" value="insane"/>
  </target>


   <target name="getsvnversion" unless="changenumber">
     <exec executable="svnversion"
           failifexecutionfails="no"
           output="${out.base}/changenumber.properties">
       <arg value="${basedir}"/>
       <arg value="-n"/>
     </exec>
     <loadfile srcFile="${out.base}/changenumber.properties"
               failonerror="false"
               property="changenumber">
       <filterchain>
         <striplinebreaks/>
       </filterchain>
     </loadfile>
     <condition property="changenumber" value="???">
       <not>
         <isset property="changenumber"/>
       </not>
     </condition>
     <echo level="info" message="Revision number set to ${changenumber}."/>
   </target>

  <target name="cleanjars" depends="setsanityname">
    <delete dir="${jarsdist.dir}/${sanity.name}"/>
  </target>

<!-- - - - - - - - - - - - release build helper targets - - - - - - - - - -->

   <!-- Update both subversion clients for building release distributions -->
   <target name="updatesvnclients" depends="updatesvncode,updatesvndoc"/>

   <target name="updatesvncode">
     <exec executable="svn">
       <arg value="update"/>
       <arg value="${basedir}"/>
     </exec>
   </target>
   <target name="updatesvndoc">
     <exec executable="svn">
       <arg value="update"/>
       <arg value="${docs.root}"/>
     </exec>
   </target>

   <!-- Verify that both the code and docs clients have no in-flight edits -->
   <target name="checksvnclientsclean" unless="debug.release.build">

      <antcall target="checksvnclean">
         <param name="client.root" value="${docs.root}"/>
      </antcall>

      <antcall target="checksvnclean">
         <param name="client.root" value="${basedir}"/>
      </antcall>

   </target>

   <!-- Check that a subversion client has no files checked out -->
   <target name="checksvnclean">
     <exec executable="svn"
           outputproperty="svnstatusoutput"
     >
       <arg value="status"/>
       <arg value="${client.root}"/>
     </exec>

     <fail message="Cannot build a release. The ${client.root} subversion client is not clean: ${svnstatusoutput}">
         <condition>
             <not><equals arg1="${svnstatusoutput}" arg2="" trim="true"/></not>
         </condition>
     </fail>
   </target>

   <!-- Checkin the generated error documentation to the docs client -->
   <target name="copyerrordocs">

     <!-- Build the SQLState tables -->
     <antcall target="all">
        <param name="sane" value="true"/>
        <param name="sanity" value="true"/>
        <param name="sanity.name" value="sane"/>
        <param name="deprecation" value="off"/>
     </antcall>

     <property name="refdir" value="${docs.root}/src/ref"/>

     <copy file="${sqlstateTables}" todir="${refdir}"/>

      <antcall target="checkinfile">
         <param name="checkinComment" value="Check in SQLState tables as part of building a release."/>
         <param name="fileName" value="${refdir}/rrefexcept71493.dita"/>
      </antcall>

   </target>

   <!-- Build the NOTICE file and check it in -->
   <target name="buildnotice">

     <property file="${properties.dir}/release.properties"/>
     <property name="noticefile" value="${basedir}/NOTICE"/>

     <!-- plug in the current copyright year -->
     <copy overwrite="true" file="${derby.notice.src.dir}/preamble.txt" tofile="${noticefile}">
       <filterset>
         <filter token="COPYRIGHT_YEAR" value="${copyright.year}"/>
       </filterset>
     </copy>

     <antcall target="appendnotice"><param name="sourcefile" value="initialgrant.txt"/></antcall>
     <antcall target="appendnotice"><param name="sourcefile" value="nisttestgrant.txt"/></antcall>
     <antcall target="appendnotice"><param name="sourcefile" value="jdbcstubs.txt"/></antcall>
     <antcall target="appendnotice"><param name="sourcefile" value="felix.txt"/></antcall>
     <antcall target="appendnotice"><param name="sourcefile" value="lucene.txt"/></antcall>
     
      <antcall target="checkinfile">
         <param name="checkinComment" value="Check in NOTICE as part of building a release."/>
         <param name="fileName" value="${noticefile}"/>
      </antcall>

   </target>

   <!--
Append a file to the notice file

Args:
noticefile Destination NOTICE file
sourcefile Source file to append.
-->
   <target name="appendnotice">
     <concat destfile="${noticefile}" append="true">
        <filelist files="${derby.notice.src.dir}/separator.txt,${derby.notice.src.dir}/${sourcefile}"/>
     </concat>
   </target>

   <!--
Checkin in-flight edits. Do not checkin files if we are running in debug mode.

Args:
checkinComment This is the subversion checkin comment.
fileName This is the name of the file to checking (could be the root of the client).
-->
   <target name="checkinfile" unless="debug.release.build">

     <property name="checkinMessage" value="${release.base}/tmp.checkin.message"/>
     <property name="fullComment" value="[RELEASE CHECKIN] ${checkinComment}"/>

     <echo file="${checkinMessage}" message="${fullComment}"/>
     <echo message="Checking in ${fileName} with this comment: ${fullComment}"/>

     <exec executable="svn" failonerror="true">
       <arg value="commit"/>
       <arg value="--username"/>
       <arg value="${svn.username}"/>
       <arg value="--password"/>
       <arg value="${svn.password}"/>
       <arg value="-F"/>
       <arg value="${checkinMessage}"/>
       <arg value="${fileName}"/>
     </exec>

     <!-- Bring the docs client up to date again -->
     <antcall target="updatesvndoc"/>

   </target>

   <!-- Targets used to specify the correct ant executable -->
   <target name="ant-exec-windows" unless="isUnix">
     <property name="ant.exec" value="ant.bat"/>
   </target>

   <target name="ant-exec-unix" unless="isWindows">
     <property name="ant.exec" value="ant"/>
   </target>

   <!-- Build the user documentation -->
   <target name="builduserdocs" depends="ant-exec-windows,ant-exec-unix,checkdocsroot">

     <property file="${properties.dir}/release.properties"/>

     <antcall target="getsvnversion"/>

     <ant dir="${docs.root}" target="clobber"/>

     <exec executable="${ant.exec}" dir="${docs.root}">
       <env key="ANT_OPTS" value="-Xmx512m"/>
       <env key="CLASSPATH" path="${docs.root}/lib/fop.jar"/>
       <arg value="-Drelease.id.short=${eversion}"/>
       <arg value="-Drelease.id.long=${release.id.long}"/>
       <arg value="-Dcopyright.year=${copyright.year}"/>
       <arg value="-Dsubversion.revision=${changenumber}"/>
       <arg value="all"/>
     </exec>

   </target>

<!-- - - - - - - - - - - - - - targets for populating META-INF - - - - - - - - - - - -->

  <!-- copy boilerplate common to derby jar files -->

  <target name="meta-inf-common">
 
    <mkdir dir="${derby.jar.dir}/lists/META-INF"/>
    <copy todir="${derby.jar.dir}/lists/META-INF">
      <fileset dir="${basedir}" includes="LICENSE*,NOTICE*"/>
    </copy>

  </target>

  <!--
Declare the jdbc driver for autoloading under JDBC 4.

Parameters:

driver.name Class name of driver to be autoloaded by JDBC 4 DriverManager
-->

  <target name="declare-autoloadable-driver">
 
    <mkdir dir="${derby.jar.dir}/lists/META-INF/services"/>
    <echo level="info" file="${derby.jar.dir}/lists/META-INF/services/java.sql.Driver">${driver.name}
</echo>

  </target>


<!-- =================================================================== -->
<!-- IDE build targets used by the projects under tools/ide/ -->
<!-- =================================================================== -->

  <!-- Target used by NetBeans to build all code modules and all jars. -->
  <target name="nb-buildall" depends="all,buildjarsclean"/>


<!-- =================================================================== -->
<!-- Nightly build targets -->
<!-- =================================================================== -->

  <target name="buildworld">

    <property name="proceed" value="true"/>

    <!-- Build insane product jars -->
    <antcall target="clobber"/>
    <antcall target="insane"/>
    <antcall target="all"/>
    <antcall target="buildjars"/>

    <!-- Build sane product jars -->
    <antcall target="clobber"/>
    <antcall target="sane"/>
    <antcall target="all"/>
    <antcall target="buildjars"/>

    <!-- Build everything else -->
    <antcall target="javadoc"/>

  </target>

  <!--
cibuild - target suitable for continuous integration builds.
Clobbers/cleans everything it can, then builds the jars
and the javadoc.
-->
  <target name="cibuild"
depends="clobber,cleanjars,cleandocs,junit-clean,gump_all"/>

  <target name="gump_all" depends="all,buildjars,javadoc"/>

  <target name="snapshot" depends="clobber,snapshotError,init,initjars">
    <antcall target="insane"/>
    <antcall target="all"/>
    <antcall target="buildjars"/>
    <antcall target="publishedapi"/>

    <java classname="org.apache.derbyBuild.maintversion2props">
        <classpath path="${out.dir}"/>
        <arg value="${out.dir}/org/apache/derby/info/DBMS.properties"/>
        <arg value="${snapshot.dir}/maintversion.properties"/>
    </java>
    <property file="${snapshot.dir}/maintversion.properties"/>
    <zip destfile="${snapshot.dir}/db-derby-snapshot-${major}.${minor}.${interim}.${point}-${changenumber}.zip">
      <zipfileset prefix="db-derby-snapshot-${major}.${minor}.${interim}.${point}-${changenumber}/lib" dir="${jarsdist.dir}/insane" includes="*.jar,*.war"/>
      <zipfileset prefix="db-derby-snapshot-${major}.${minor}.${interim}.${point}-${changenumber}" dir="${basedir}" includes="bin/**,LICENSE,NOTICE,README,javadoc/publishedapi/**" excludes="bin/templates/**"/>
    </zip>
    <tar destfile="${snapshot.dir}/db-derby-snapshot-${major}.${minor}.${interim}.${point}-${changenumber}.tar.gz"
         compression="gzip">
      <tarfileset prefix="db-derby-snapshot-${major}.${minor}.${interim}.${point}-${changenumber}/lib" dir="${jarsdist.dir}/insane" includes="*.jar,*.war"/>
      <tarfileset prefix="db-derby-snapshot-${major}.${minor}.${interim}.${point}-${changenumber}" dir="${basedir}" includes="bin/**,LICENSE,NOTICE,README,javadoc/publishedapi/**" excludes="bin/templates/**"/>
    </tar>

    <!-- debug archives - DERBY-178 -->
    <zip destfile="${snapshot.dir}/db-derby-snapshot-debug-${major}.${minor}.${interim}.${point}-${changenumber}.zip">
      <zipfileset prefix="db-derby-snapshot-debug-${major}.${minor}.${interim}.${point}-${changenumber}/lib" dir="${jarsdist.dir}/sane" includes="*.jar,*.war"/>
      <zipfileset prefix="db-derby-snapshot-debug-${major}.${minor}.${interim}.${point}-${changenumber}" dir="${basedir}" includes="bin/**,LICENSE,NOTICE,README,javadoc/publishedapi/**" excludes="bin/templates/**"/>
    </zip>
    <tar destfile="${snapshot.dir}/db-derby-snapshot-debug-${major}.${minor}.${interim}.${point}-${changenumber}.tar.gz"
         compression="gzip">
      <tarfileset prefix="db-derby-snapshot-debug-${major}.${minor}.${interim}.${point}-${changenumber}/lib" dir="${jarsdist.dir}/sane" includes="*.jar,*.war"/>
      <tarfileset prefix="db-derby-snapshot-debug-${major}.${minor}.${interim}.${point}-${changenumber}" dir="${basedir}" includes="bin/**,LICENSE,NOTICE,README,javadoc/publishedapi/**" excludes="bin/templates/**"/>
    </tar>

  </target>

  <target name="snapshotError" if="is.sane">
    <echo level="error" message="Please run the snapshot using an insane build,"/>
    <echo level="error" message="but don't forget to generate a sane build into jars/sane also."/>
    <echo level="error" message="Either run &quot;ant -Dsane=false snapshot&quot;, or run"/>
    <echo level="error" message="the insane target before running the snapshot target."/>
    <echo level="error" message="For more information, see:"/>
    <echo level="error" message="http://wiki.apache.org/db-derby/DerbySnapshotOrRelease"/>

    <echo level="error" message=""/>
    <fail message="Exiting snapshot build..."/>
  </target>

<!-- =================================================================== -->
<!-- Junit utility targets -->
<!-- =================================================================== -->

  <!-- Basic initialization for Junit tests (doesn't configure classpath). -->
  <target name="junit-init-nocp">
    <tstamp prefix="derby.junit">
      <format property="standardtime" pattern="yyyy-MM-dd hh:mm aa zzz"/>
    </tstamp>
    <property name="derby.junit.jvm" value="${java.home}/bin/java"/>
    <property name="derby.junit.timestamp" value="${derby.junit.DSTAMP}_${derby.junit.TSTAMP}"/>
    <mkdir dir="junit_${derby.junit.timestamp}/testout"/>

    <!-- Set a dummy value for the JaCoCo agent option when running without
JaCoCo for code coverage. Required because ant doesn't (yet) handle
empty variables passed to jvmarg. See also target jacoco-enable. -->
    <!-- The purpose of the system property derby.tests.jacoco.agent is to
allow the Derby test framework to pass on the correct -javaagent
option when spawning VMs. -->
    <condition property="derby.tests.jacoco.agent" value="-Dderby.dummy.prop=X">
      <not>
        <isset property="derby.tests.jacoco.agent"/>
      </not>
    </condition>
  </target>

  <target name="junit-init" depends="junit-init-nocp">
    <!-- Set up the default classpath to use with JUnit tests. junit tasks
should include the following entries in the order specified in
their nested classpath structure:
<fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
<pathelement path="${derby.junit.classpath}"/>

The preferences:
1) User-specified derby.junit.classpath
2) Jars (insane preferred over sane)
3) classes-directory

Note also that the user's CLASSPATH environment variable is appended
to the JUnit classpath, but in most cases Derby classes here will be
shadowed by one of the above entries. It is recommended to not have
any Derby classes in the CLASSPATH environment variable.
-->

    <!-- See if the jars have been built
(skipped if derby.junit.classpath is set) -->
    <condition property="tmp.jars" value="${jarsdist.dir}/insane">
        <and>
            <available file="${jarsdist.dir}/insane/"/>
            <not>
                <isset property="derby.junit.classpath"/>
            </not>
        </and>
    </condition>
    <condition property="tmp.jars" value="${jarsdist.dir}/sane">
        <and>
            <available file="${jarsdist.dir}/sane/"/>
            <not>
                <isset property="derby.junit.classpath"/>
            </not>
        </and>
    </condition>

    <!-- Use classes-directory if not using jars and not overriden by user -->
    <condition property="derby.junit.classpath" value="${basedir}/classes">
        <not>
            <or>
                <isset property="derby.junit.classpath"/>
                <isset property="tmp.jars"/>
            </or>
        </not>
    </condition>

    <!-- Property to trigger informational message. -->
    <condition property="emit.junit.lowmem.jars">
        <isset property="tmp.jars"/>
    </condition>

    <!-- We have to set this to something, so point it to a src dir that
always exists (with no jars). -->
    <condition property="derby.junit.test.jars" value="${basedir}/java/build">
        <not>
            <isset property="tmp.jars"/>
        </not>
    </condition>
    <condition property="derby.junit.test.jars" value="${tmp.jars}">
        <isset property="tmp.jars"/>
    </condition>

    <property file="${properties.dir}/extrapath.properties"/>

    <antcall target="emit-junit-classpath-jars"/>
    <antcall target="emit-junit-classpath"/>
  </target>

  <target name='emit-junit-classpath-jars' if='emit.junit.lowmem.jars'>
        <echo message="Running with jars: ${derby.junit.test.jars}" level='info'/>
        <echo message="CLASSPATH (environment variable): ${env.CLASSPATH}" level='info'/>
  </target>

  <target name='emit-junit-classpath' unless='emit.junit.lowmem.jars'>
        <echo message="Running with classes or user specified classpath: ${derby.junit.classpath}" level='info'/>
        <echo message="CLASSPATH (environment variable): ${env.CLASSPATH}" level='info'/>
   </target>

  <target name="junit-sysinfo" depends="junit-init">
    <java classname="org.apache.derby.tools.sysinfo"
          output="junit_${derby.junit.timestamp}/sysinfo.txt">
        <classpath path="${out.dir}"/>
    </java>
  </target>

  <target
      name="junit-clean"
      description="Remove the output produced by the JUnit tests."
  >
    <delete includeEmptyDirs="true">
      <fileset dir="${basedir}" includes="junit*/**"/>
    </delete>
  </target>
<!--
Autoloading tests need to be run in a separate JVM thus
as a separate test. This target runs the test a number of
times, each with a different setting for jdbc.drivers.
When run with jar files on java SE 6/JDBC 4 the run without
setting jdbc.drivers will test that autoloading from
the manifest file works. The settings with jdbc.drivers
test the auto-loading in non JDBC 4 environments and
that setting jdbc.drivers in JDBC 4 does not cause issues.
-->

  <target name="junit-core" depends="junit-init">
    <condition property="derbyTesting.oldReleasePath" value="">
      <not>
        <isset property="derbyTesting.oldReleasePath"/>
      </not>
    </condition>
         <!--
Specifying max heap size (maxmemory) for JVMs spawned by this
target, since the default max heap size on most systems is
currently too low for some of the test suites. See DERBY-2988.
-->
   <junit printsummary="on"
           fork="yes" forkmode="perTest"
           jvm="${derby.junit.jvm}" maxmemory="512m"
           showoutput="yes"
           dir="junit_${derby.junit.timestamp}"
           tempdir="junit_${derby.junit.timestamp}"
   errorproperty="tests.failed"
   failureproperty="tests.failed">
      <jvmarg value="${derby.tests.jacoco.agent}"/>
      <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
      <sysproperty key="derbyTesting.oldReleasePath" value="${derbyTesting.oldReleasePath}"/>
      <!-- This property is needed to keep EMMA silent when measuring codecoverage -->
      <sysproperty key="emma.verbosity.level" value="silent"/>
      <!-- Pass on properties from the command line to the spawned VM. -->
      <syspropertyset id="system-properties-passed-on">
        <propertyref builtin="commandline"/>
      </syspropertyset>
      <!-- Use the system property below to debug lacking java security permissions -->
<!-- <sysproperty key="java.security.debug" value="access:failure"/> -->
      <formatter type="xml"/>
<test name="org.apache.derbyTesting.junit.EnvTest"
    todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.derbynet._Suite"
todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.tools._Suite"
   todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.demo._Suite"
   todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.lang._Suite"
todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite"
todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.store._Suite"
todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.engine._Suite"
todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationSuite"
    todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.unitTests.junit._Suite"
    todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.tests.upgradeTests._Suite"
   todir="junit_${derby.junit.timestamp}"/>
<test name="org.apache.derbyTesting.functionTests.suites.EncryptionSuite"
todir="junit_${derby.junit.timestamp}"/>

      <classpath>
            <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
      <pathelement path="${derby.junit.classpath}"/>
            <!-- ant 1.7 finds junit.jar if it is on the classpath of the <junit> task -->
            <pathelement location="${javatools.dir}/junit.jar"/>
            <pathelement location="${lucene_core}"/>
            <pathelement location="${lucene_a_co}"/>
            <pathelement location="${lucene_qp}"/>
      </classpath>
    </junit>
  </target>

  <!--
Run the simplest form of any system test. Provides a sanity
check that the functionality works. This target is not intended
to have long running tests, just enough to ensure the test works
and Derby works with the test.
-->
  <target name="junit-system-mini" depends="junit-init">
        <!--
Specifying max heap size (maxmemory) for JVMs spawned by this
target, since the default max heap size on most systems is
currently too low for some of the test suites. See DERBY-2988.
-->
        <junit printsummary="on"
               fork="yes" forkmode="perTest"
               jvm="${derby.junit.jvm}" maxmemory="512m"
               showoutput="yes"
               dir="junit_${derby.junit.timestamp}"
               tempdir="junit_${derby.junit.timestamp}"
               errorproperty="tests.failed"
               failureproperty="tests.failed">
          <jvmarg value="${derby.tests.jacoco.agent}"/>
          <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
          <!-- Pass on properties from the command line to the spawned VM. -->
          <syspropertyset id="system-properties-passed-on">
            <propertyref builtin="commandline"/>
          </syspropertyset>
          <formatter type="xml"/>

    <test name="org.apache.derbyTesting.system.oe.test.OETest"
        todir="junit_${derby.junit.timestamp}"/>
          <classpath>
               <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
               <pathelement path="${derby.junit.classpath}"/>
               <pathelement location="${javatools.dir}/junit.jar"/>
          </classpath>
         </junit>
  </target>

  <target name="junit-jdbc4" depends="checkVMLevel,junit-init">
    <antcall target="junit-jdbc4-workhorse"/>
  </target>

  <!--
Only execute jdbc4 suite if we have a pointer to a 1.6 VM.
This target is called by junit-jdbc after reading the VM level.
-->
  <target name="junit-jdbc4-workhorse" if="vmLevelIsAtLeast1.6" depends="junit-init">
   <junit printsummary="on"
           fork="yes" forkmode="perTest"
           showoutput="yes"
           dir="junit_${derby.junit.timestamp}"
           tempdir="junit_${derby.junit.timestamp}"
   errorproperty="tests.failed"
   failureproperty="tests.failed">
      <jvmarg value="${derby.tests.jacoco.agent}"/>
      <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
      <!-- Pass on properties from the command line to the spawned VM. -->
      <syspropertyset id="system-properties-passed-on">
        <propertyref builtin="commandline"/>
      </syspropertyset>
      <formatter type="xml"/>
  
      <test name="org.apache.derbyTesting.functionTests.tests.jdbc4._Suite"
       todir="junit_${derby.junit.timestamp}"/>
        <classpath>
            <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
        <pathelement path="${derby.junit.classpath}"/>
            <pathelement location="${javatools.dir}/junit.jar"/>
        </classpath>
      </junit>
  </target>

  <!-- low memory suite runs with 16MB heap -->
  <target name="junit-lowmem" depends="checkVMLevel,junit-init" if="vmLevelIsAtLeast1.5">
   <junit printsummary="on"
           fork="yes" forkmode="perTest"
           jvm="${derby.junit.jvm}" maxmemory="16m"
           showoutput="yes"
           dir="junit_${derby.junit.timestamp}"
           tempdir="junit_${derby.junit.timestamp}"
   errorproperty="tests.failed"
   failureproperty="tests.failed">
      <jvmarg value="${derby.tests.jacoco.agent}"/>
      <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
      <!-- Pass on properties from the command line to the spawned VM. -->
      <syspropertyset id="system-properties-passed-on">
        <propertyref builtin="commandline"/>
      </syspropertyset>
      <formatter type="xml"/>
  
      <test name="org.apache.derbyTesting.functionTests.tests.memory._Suite"
       todir="junit_${derby.junit.timestamp}"/>
        <classpath>
            <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
        <pathelement path="${derby.junit.classpath}"/>
            <pathelement location="${javatools.dir}/junit.jar"/>
        </classpath>
      </junit>
  </target>

  <!-- Runs Derby's JMX tests if the required VM level (1.5 or higher) is detected -->
  <target name="junit-jmx" depends="checkVMLevel,junit-init" if="vmLevelIsAtLeast1.5">
    <junit printsummary="on"
            fork="yes" forkmode="once"
            showoutput="yes"
            dir="junit_${derby.junit.timestamp}"
            tempdir="junit_${derby.junit.timestamp}"
            errorproperty="tests.failed"
            failureproperty="tests.failed">
        <jvmarg value="${derby.tests.jacoco.agent}"/>
        <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
        <!-- Pass on properties from the command line to the spawned VM. -->
        <syspropertyset id="system-properties-passed-on">
          <propertyref builtin="commandline"/>
        </syspropertyset>
        <formatter type="xml"/>

        <test name="org.apache.derbyTesting.functionTests.tests.management._Suite"
              todir="junit_${derby.junit.timestamp}"/>

        <classpath>
            <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
            <pathelement path="${derby.junit.classpath}"/>
            <pathelement location="${javatools.dir}/junit.jar"/>
        </classpath>
    </junit>
  </target>

  <!-- Run the package private tests against the classes directories. -->
  <target name="junit-pptesting" depends="junit-init-nocp">
    <junit printsummary="on"
            fork="yes" forkmode="once"
            showoutput="yes"
            dir="junit_${derby.junit.timestamp}"
            tempdir="junit_${derby.junit.timestamp}"
            errorproperty="tests.failed"
            failureproperty="tests.failed">
        <jvmarg value="${derby.tests.jacoco.agent}"/>
        <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
        <!-- Pass on properties from the command line to the spawned VM. -->
        <syspropertyset id="system-properties-passed-on">
          <propertyref builtin="commandline"/>
        </syspropertyset>
         <formatter type="xml"/>

        <test name="org.apache.derby.PackagePrivateTestSuite"
                todir="junit_${derby.junit.timestamp}"/>

        <classpath>
            <pathelement location="${out.pptesting.dir}"/>
            <pathelement location="${out.dir}"/>
            <pathelement location="${javatools.dir}/junit.jar"/>
        </classpath>
    </junit>
  </target>

  <!-- Run a single junit test or suite -->
  <target name="junit-single" depends="junit-init">
    <condition property="noTestclassSet" value="">
      <not>
        <isset property="derby.junit.testclass"/>
      </not>
    </condition>
    <fail if="noTestclassSet">No testclass selected! Set property derby.junit.testclass</fail>
    <junit printsummary="on"
           fork="yes" forkmode="perTest"
           jvm="${derby.junit.jvm}" maxmemory="512m"
           showoutput="yes"
           dir="junit_${derby.junit.timestamp}"
           tempdir="junit_${derby.junit.timestamp}"
           errorproperty="tests.failed"
           failureproperty="tests.failed">
      <jvmarg value="${derby.tests.jacoco.agent}"/>
      <sysproperty key="derby.tests.jacoco.agent" value="${derby.tests.jacoco.agent}"/>
      <!-- This property is needed to keep EMMA silent when measuring codecoverage -->
      <sysproperty key="emma.verbosity.level" value="silent"/>
      <!-- Pass on properties from the command line to the spawned VM. -->
      <syspropertyset id="system-properties-passed-on">
        <propertyref builtin="commandline"/>
      </syspropertyset>
      <formatter type="xml"/>
      
      <test name="${derby.junit.testclass}" todir="junit_${derby.junit.timestamp}"/>

      <classpath>
            <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
      <pathelement path="${derby.junit.classpath}"/>
            <pathelement location="${javatools.dir}/junit.jar"/>
            <pathelement location="${lucene_core}"/>
            <pathelement location="${lucene_a_co}"/>
            <pathelement location="${lucene_qp}"/>
      </classpath>
    </junit>
      
  </target>
   
  <target
      name="junit-all"
      depends="junit-pptesting,junit-core,junit-jdbc4,junit-jmx,junit-lowmem"
      description="Run the JUnit tests."
  />
 
  <target name="junitreport" depends="junit-all,junit-html"/>
  
  <!-- Convert the junit xml format to HTML -->
  <target name="junit-html" depends="junit-sysinfo">
    <junitreport todir="junit_${derby.junit.timestamp}">
      <fileset dir="junit_${derby.junit.timestamp}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="junit_${derby.junit.timestamp}"/>
    </junitreport>

    <!-- fix up unterminated elements in overview-frame.html -->
    <replace token="href=&quot;stylesheet.css&quot;&gt;"
             value="href=&quot;stylesheet.css&quot;/&gt;&lt;/META&gt;"
             file="junit_${derby.junit.timestamp}/overview-frame.html"/>
    <replace token="Unit Test Results"
             value="Apache Derby Test Results - ${derby.junit.standardtime}&lt;br&gt;JVM: ${java.vm.vendor} ${java.vm.version}"
             file="junit_${derby.junit.timestamp}/overview-summary.html"/>

    <xslt style="${basedir}/tools/ant/xsl/sysinfo_junitreport.xsl"
          in="junit_${derby.junit.timestamp}/overview-frame.html"
          out="junit_${derby.junit.timestamp}/overview-frame2.html"/>
    <move file="junit_${derby.junit.timestamp}/overview-frame2.html"
          tofile="junit_${derby.junit.timestamp}/overview-frame.html"/>
  
   <fail if="tests.failed">Tests Failed!</fail>
  </target>

  <target name="l10ncheck">
    <ant dir="${derbysrc.dir}/../tools/l10n"/>
  </target>

<!-- Run the junit-all target with the classpath set to include
the main derby jar files. Requires that the caller have
junit.jar in CLASSPATH due to some bug in ant that is
fixed in version 1.7.
-->
<target name="junit-all-codeline-jars"
depends="junit-all-codeline-jars-set-properties,junit-all">
<fail if="tests.failed">Tests Failed!</fail>
</target>

    <!-- Run the junit-system-mini target with the classpath set to include
the main derby jar files. Requires that the caller have
junit.jar in CLASSPATH due to some bug in ant that is
fixed in version 1.7.
-->
    <target name="junit-system-mini-codeline-jars"
        depends="junit-all-codeline-jars-set-properties,junit-system-mini">
        <fail if="tests.failed">Tests Failed!</fail>
    </target>

    <!-- Run the junit-single target with the classpath set to include
the main derby jar files. Requires that the caller have
junit.jar in CLASSPATH due to some bug in ant that is
fixed in version 1.7.
-->
    <target name="junit-single-codeline-jars"
        depends="junit-all-codeline-jars-set-properties,junit-single">
        <fail if="tests.failed">Tests Failed!</fail>
    </target>

<target name="junit-all-codeline-jars-set-properties" depends="setsanityname">
<property name="derby.jar.base" value="${jarsdist.dir}/${sanity.name}"/>
<property name="derby.junit.classpath"
value="${derby.jar.base}/derbyTesting.jar:${derby.jar.base}/derbynet.jar:${derby.jar.base}/derbytools.jar:${derby.jar.base}/derbyclient.jar"/>
</target>

<!-- =================================================================== -->
<!-- Old harness test targets -->
<!-- =================================================================== -->
<!-- The old harness tests are being phased out, so just borrow some -->
<!-- functionality from the JUnit setup. -->

  <target name="test-derbyall" depends="junit-init">
    <path id="derbyall.classpath">
      <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
    <pathelement path="${derby.junit.classpath}"/>
      <pathelement location="${javatools.dir}/junit.jar"/>
      <pathelement location="${javatools.dir}/jakarta-oro-2.0.8.jar"/>
    </path>
    <echo message="Classpath used for derbyall: ${toString:derbyall.classpath}"/>
    <mkdir dir="junit_${derby.junit.timestamp}/derbyall"/>
    <java classname="org.apache.derbyTesting.functionTests.harness.RunSuite"
        fork="yes" dir="junit_${derby.junit.timestamp}/derbyall">
      <jvmarg value="${derby.tests.jacoco.agent}"/>
      <sysproperty key="jvmflags" value="${derby.tests.jacoco.agent}"/>
      <!-- Note the duplicate specification, don't know why it's needed. -->
      <sysproperty key="testSpecialProps" value="noSecurityManager=true^noSecurityManager=true"/>
      <arg value="derbyall"/>
      <env key="CLASSPATH" value="${toString:derbyall.classpath}"/>
    </java>
  </target>

<!-- =================================================================== -->
<!-- EMMA utility targets -->
<!-- =================================================================== -->

<!--
There are three "top-level" targets that use EMMA:

'emma-clean' will delete any classes and jar files that have been instrumented
with EMMA.

Before using the 'emma-all' and 'emma-single' targets, you should build jar
files using the 'buildjars' target.

'emma-all' will instrument your jar files using EMMA, and run the 'junit-all'
target, before producting code coverage reports from the testrun.

'emma-single' will instrument your jar files using EMMA, and run the
'junit-single' target, before producing code coverage reports from the testrun.
To select which test or suite to run with the 'emma-single' target you must set
the system property derby.junit.testclass to the full classname of the suite or
test you want to run.

These targets use EMMA code, and depend upon emma.jar and emma_ant.jar being
copied to your tools/java/ directory. You can download these from
http://emma.sourceforge.net/downloads.html.

If you use ant 1.6.5 you will have to add junit to your classpath, with ant 1.7
you should not have to do this.
-->

    <!-- directory that will contain the instrumented jar-files: -->
    <property name="emmabase" value="${jarsdist.dir}/emma"/>
    <property name="instrumented.jars" value="${emmabase}/lib"/>
    <property name="instrumented.classes" value="${emmabase}/classes"/>

    <target name="emma-clean">
        <delete includeEmptyDirs="true">
            <fileset dir="${jarsdist.dir}" includes="emma/**"/>
        </delete>
    </target>

    <target name="emma-init" depends="initjars">
        <!-- EMMA distribution: -->
        <path id="emma.lib">
            <pathelement location="${emma}"/>
            <pathelement location="${emma_ant}"/>
        </path>
        <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
        <mkdir dir="${emmabase}"/>
    </target>
    
    <target name="emma-instrumentation" depends="emma-init,junit-init-nocp">
        <!-- Apply emma instrumentation to the classes in instrpath and copy to destdir -->
<emma verbosity="verbose">
            <instr outfile="junit_${derby.junit.timestamp}/coverage.em" destdir="${emmabase}" merge="true" mode="fullcopy">
<instrpath>
                    <pathelement path="${derby.jar.dir}/derbyrun.jar"/>
                </instrpath>
            </instr>
</emma>
        <!-- Change the classpath used for junit tests to use the jars instrumented by EMMA -->
        <property name="derby.junit.classpath" value="${emma}:${derby.jar.dir}/derbyTesting.jar:${instrumented.jars}/derbyrun.jar"/>
    </target>
    
    <target name="emma-all" depends="emma-instrumentation,junit-all,emma-report">
        <fail if="tests.failed">EMMA instrumented tests failed!</fail>
        <echo level="info" message="Finished measuring code coverage with EMMA."/>
    </target>

    <target name="emma-single" depends="emma-instrumentation,junit-single,emma-report">
        <fail if="tests.failed">EMMA instrumented test failed!</fail>
        <echo level="info" message="Finished measuring code coverage with EMMA."/>
    </target>
    
    <target name="emma-report" depends="emma-instrumentation">
        <emma>
            <report verbosity="verbose" depth="method">
                <sourcepath>
                    <pathelement path="${derby.client.src.dir}" />
                    <pathelement path="${derby.demo.src.dir}" />
                    <pathelement path="${derby.drda.src.dir}" />
                    <pathelement path="${derby.engine.src.dir}" />
                    <pathelement path="${derby.shared.src.dir}" />
                    <pathelement path="${derby.storeless.src.dir}" />
                    <pathelement path="${derby.tools.src.dir}" />
                </sourcepath>
                <infileset dir="junit_${derby.junit.timestamp}" includes="coverage.em,coverage*.ec" />
                <!-- Three reports: txt, xml and html -->
                <txt outfile="junit_${derby.junit.timestamp}/coverage.txt"/>
                <xml outfile="junit_${derby.junit.timestamp}/coverage.xml"/>
                <html outfile="junit_${derby.junit.timestamp}/coverage.html"/>
            </report>
        </emma>
    </target>

<!-- ==================================================================== -->
<!-- JaCoCo code coverage targets -->
<!-- ==================================================================== -->

    <target name="jacoco-complete"
            depends="clobber,sane,all,buildjars,jacoco-enable,test-derbyall,junit-all,jacoco-report"
            description="Runs all the Derby tests with JaCoCo to obtain code coverage">
    </target>

    <target name="jacoco-derbyall"
            depends="jacoco-enable,test-derbyall,jacoco-report"
            description="Runs the derbyall test with JaCoCo to obtain code coverage">
    </target>

    <target name="jacoco-junit"
            depends="jacoco-enable,junit-all,jacoco-report"
            description="Runs all the Derby JUnit tests with JaCoCo to obtain code coverage">
    </target>

    <target name="jacoco-junit-single"
            depends="jacoco-enable,junit-single,jacoco-report"
            description="Runs the specified Derby JUnit test with JaCoCo to obtain code coverage">
    </target>

<!-- The below JaCoCo targets are helper targets and have not been written to
be invoked directly. -->

    <target name="jacoco-report" depends="getsvnversion">
      <jacoco:merge destfile="junit_${derby.junit.timestamp}/merged.exec">
        <fileset dir="junit_${derby.junit.timestamp}" includes="**/jacoco.exec*"/>
      </jacoco:merge>

      <jacoco:report>
        <executiondata>
          <file file="junit_${derby.junit.timestamp}/merged.exec"/>
        </executiondata>

        <structure name="Apache Derby Code Coverage (revision ${changenumber}, JRE ${java.specification.version})">
          <classfiles>
            <fileset dir="classes">
              <include name="org/apache/derby/**/*.class"/>
                <!-- Ignore testing classes for now.
Maybe in a separate report? -->
                <!-- <include name="org/apache/derbyTesting/**/*.class"/> -->
            </fileset>
          </classfiles>
          <sourcefiles encoding="UTF-8">
            <fileset dir="java/client"/>
            <fileset dir="java/drda"/>
            <fileset dir="java/engine"/>
            <fileset dir="java/shared"/>
            <fileset dir="java/testing"/>
            <fileset dir="java/tools"/>
            <fileset dir="generated/java"/>
          </sourcefiles>
        </structure>

        <html destdir="junit_${derby.junit.timestamp}/coverage-report"/>
        <!-- Alternative report formats that are available.
<csv destfile="junit_${derby.junit.timestamp}/coverage-jacoco.csv"/>
<html destfile="junit_${derby.junit.timestamp}/coverage-jacoco.html.zip"/>
<xml destfile="junit_${derby.junit.timestamp}/coverage-jacoco.xml"/>
-->

      </jacoco:report>
    </target>

    <target name="jacoco-enable">
      <!-- Make sure we have the required JaCoCo files. -->
      <fail message="missing jacocoant.jar and/or jacocoagent.jar in tools/java">
        <condition>
          <not>
            <and>
              <available file="${basedir}/tools/java/jacocoant.jar"/>
              <available file="${basedir}/tools/java/jacocoagent.jar"/>
            </and>
          </not>
        </condition>
      </fail>
      <!-- Add the JaCoCo targets/tasks. -->
      <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
        <classpath path="${basedir}/tools/java/jacocoant.jar"/>
      </taskdef>
      <!-- Generate the property required to enable JaCoCo.
Exclude invalid class file loaded in DatabaseClassLoadingTest.
-->
      <jacoco:agent property="derby.tests.jacoco.agent"
        sessionid="derby-ant"
        excludes="*/emc:org/apache/derby/exe/*"/>
    </target>

<!-- ==================================================================== -->
<!-- Release Candidates -->
<!-- ==================================================================== -->

    <target
        name="release"
        depends="prepareforrelease"
        description="Build the release distributions."
    >
      <ant antfile="${basedir}/tools/release/build.xml" target="release"/>

      <!-- sign all of the artifacts -->
      <ant antfile="${basedir}/tools/release/build.xml" target="sign"/>

      <!-- remove cruft -->
      <delete dir="${crlf.dir}"/>
      <delete dir="${lf.dir}"/>
      <delete file="${release.dir}/maintversion.properties"/>

       <!-- the release candidate has been built. now we can bump the release id. -->
       <antcall target="writeAndCheckinReleaseProperties">
          <param name="bumpID" value="true"/>
       </antcall>

    </target>

    <!-- do most of the ant calls to prepare a release -->
    <target name="prepareforrelease" depends="checkdocsroot,checksvnclientsclean,promptforreleaseproperties,checkstateremoved,checksanenotset,cleanalljars,cleandocs,clobber,cleanreleasefiles">

        <!-- set the release id -->
        <antcall target="writeAndCheckinReleaseProperties">
           <param name="bumpID" value="false"/>
        </antcall>

        <!-- update the NOTICE file with the current copyright year and check NOTICE in -->
        <antcall target="buildnotice"/>

        <!-- copy the generated sqlstate tables to the docs client and check it in -->
        <antcall target="copyerrordocs"/>

        <!-- sync the clients to guarantee that we are up-to-date -->
        <antcall target="updatesvnclients"/>

        <antcall target="clobber"/>
        <antcall target="all">
           <param name="sane" value="true"/>
           <param name="sanity" value="true"/>
           <param name="sanity.name" value="sane"/>
           <param name="deprecation" value="off"/>
        </antcall>
        <antcall target="buildjars">
           <param name="sane" value="true"/>
           <param name="sanity" value="true"/>
           <param name="sanity.name" value="sane"/>
        </antcall>

        <antcall target="clobber"/>
        <antcall target="snapshot">
           <param name="sane" value="false"/>
           <param name="sanity" value="false"/>
           <param name="sanity.name" value="insane"/>
            <param name="deprecation" value="off"/>
        </antcall>

        <antcall target="publishedapi">
            <param name="deprecation" value="off"/>
        </antcall>

        <!-- build the docs now that the sqlstate tables are up to date -->
        <antcall target="builduserdocs"/>

        <!-- finish by removing the state.properties file, so we can do it again -->
        <antcall target="cleanstate"/>
    </target>

    <!--
Prompt for release-building inputs if they were not specified in properties already

This target must be called in a dependency list rather than via antcall. That is
because properties set in dependent targets percolate back up to the caller.
Properties set in antcalled targets are wiped out when you return to the caller.

Sneaky, very, very sneaky.
-->
    <target name="promptforreleaseproperties" depends="promptforsvncredentials,promptforpgpcredentials,promptforreleaseid"/>

    <!-- Define the task which prompts for missing properties -->
    <target name="defineprompt" depends="prebuild">

        <taskdef
          name="promptForProperty"
          classname="org.apache.derbyPreBuild.PropertyPrompt"
          classpath="${out.dir}"
        />

    </target>

    <!-- Prompt for subversion credentials if they are missing -->
    <target name="promptforsvncredentials" depends="defineprompt">

        <promptForProperty
          propertyName="svn.username"
          prompt="Enter your Apache subversion username > "
        />

        <promptForProperty
          propertyName="svn.password"
          prompt="Enter your Apache subversion password > "
        />

    </target>

    <!-- Prompt for key-signing credentials if they are missing -->
    <target name="promptforpgpcredentials" depends="defineprompt">

        <promptForProperty
          propertyName="pgp.passphrase"
          prompt="Enter your pgp passphrase > "
        />

    </target>

    <!-- Prompt for release id if it is missing -->
    <target name="promptforreleaseid" depends="defineprompt">

        <promptForProperty
          propertyName="derby.release.id"
          prompt="Enter the id of this release (e.g., 10.7.1.0) > "
        />

    </target>

    <!-- Prompt for branch id if it is missing -->
    <target name="promptforbranch" depends="defineprompt">

        <promptForProperty
          propertyName="branch.id"
          prompt="Enter the name of the branch (e.g., 10.7) > "
        />

    </target>

    <!-- Prompt for location of binary zip distribution if it is missing -->
    <target name="promptforbinaryzipdist" depends="defineprompt">

        <promptForProperty
          propertyName="derby.release.binzip"
          prompt="Enter the location of the binary zip distribution for the release (e.g., /Users/me/release/db-derby-10.7.1.0-bin.zip) > "
        />

    </target>

    <!-- Prompt for root of documentation client if it is missing -->
    <target name="promptfordocsroot" depends="defineprompt">

        <promptForProperty
          propertyName="docs.root"
          prompt="Enter the root of the subversion docs client (e.g., /Users/me/derby/docs/trunk) > "
        />

    </target>

    <!--
Prompt for whether we should continue. The user is offered a Y/N choice.

Args:
prompt
-->
    <target name="prompttocontinue" depends="defineprompt">

        <fail message="Did not expect that property prompt.to.continue would be set. Make sure that this target is only invoked via antcall and not in a dependency list.">
            <condition>
                <isset property="prompt.to.continue"/>
            </condition>
        </fail>

        <promptForProperty
          propertyName="prompt.to.continue"
          prompt="${prompt} Continue? (Y/N) > "
        />

        <fail message="Terminating.">
            <condition>
              <not>
                <equals casesensitive="false" arg1="${prompt.to.continue}" arg2="Y"/>
              </not>
            </condition>
        </fail>

    </target>

    <target name="checkstateremoved" depends="state.exists">
        <fail message="Cannot build a release; please remove java/engine/state.properties by running ant cleanstate (or run ant clobber)">
            <condition>
                <isset property="state.prepare.available"/>
            </condition>
        </fail>
    </target>

    <target name="state.exists">
        <!-- check if state.properties file does *not* exist without generating it -->
        <!-- if it exists, the sane property is already loaded, messing up the prepare process -->
        <available file="${derby.engine.src.dir}/state.properties" property="state.prepare.available"/>
    </target>

    <target name="checkdocsroot" depends="promptfordocsroot">
        <!-- make sure that docs.root points into a docs tree -->
        <fail message="Cannot build a release; docs.root does not point at your documentation client: ${docs.root}">
            <condition>
              <not><available file="${docs.root}/src/conrefs.dita"/></not>
            </condition>
        </fail>

        <!-- make sure that the doc-building classes are visible to ant -->
        <fail message="Cannot build a release; fop.jar is not visible in the docs client.">
            <condition>
              <not><available file="${docs.root}/lib/fop.jar"/></not>
            </condition>
        </fail>
    </target>

    <target name="checksanenotset">
        <!-- check that sane is *not* set elsewhere, e.g. $HOME/ant.properties -->
        <echo level="info" message="sane : ${sane}"/>
        <fail message="Cannot build a release; please do not set sane to either true or false">
            <condition>
                <isset property="sane"/>
            </condition>
        </fail>
    </target>

    <target name="cleanreleasefiles">
        <delete dir="${release.base}"/>
    </target>

    <target name="cleanalljars">
        <delete dir="${jarsdist.dir}"/>
    </target>

    <target
        name="createBranch"
        depends="checkdocsroot,checksvnclientsclean,getsvnversion"
        description="Create a new branch (both docs and code)."
    >
      <antcall target="updatesvnclients"/>
      <antcall target="getsvnversion"/>

      <property file="${properties.dir}/release.properties"/>

      <antcall target="prompttocontinue">
         <param name="prompt" value="Creating ${eversion} branch starting at revision ${changenumber}."/>
      </antcall>

      <antcall target="branchrepository">
         <param name="startingRevision" value="${changenumber}"/>
         <param name="sourceURL" value="https://svn.apache.org/repos/asf/db/derby/code/trunk/"/>
         <param name="targetURL" value="https://svn.apache.org/repos/asf/db/derby/code/branches/${eversion}/"/>
         <param name="checkinComment" value="Created the ${eversion} code branch."/>
      </antcall>

      <antcall target="branchrepository">
         <param name="startingRevision" value="${changenumber}"/>
         <param name="sourceURL" value="https://svn.apache.org/repos/asf/db/derby/docs/trunk/"/>
         <param name="targetURL" value="https://svn.apache.org/repos/asf/db/derby/docs/branches/${eversion}/"/>
         <param name="checkinComment" value="Created the ${eversion} docs branch."/>
      </antcall>

    </target>

    <!--
Branch one of the repositories

Args:
startingRevision subversion revision number of initial set of files
sourceURL points at the source (trunk) repository
targetURL location of the new (branch) repository
checkinComment one line description of the new branch
-->
    <target name="branchrepository">

      <exec executable="svn">
        <arg value="copy"/>
        <arg value="-r"/>
        <arg value="${startingRevision}"/>
        <arg value="${sourceURL}"/>
        <arg value="${targetURL}"/>
        <arg value="-m"/>
        <arg value="${checkinComment}"/>
      </exec>

    </target>

<!-- ==================================================================== -->
<!-- Release Publication -->
<!-- ==================================================================== -->

    <!-- Repackage the docs for publication on the website -->
    <target name="repackagedocs" depends="promptforwebsite,promptforbranch,promptforbinaryzipdist">

        <fail message="Cannot repackage the docs. Cannot find ${derby.release.binzip}">
            <condition>
              <not>
                <available file="${derby.release.binzip}"/>
              </not>
            </condition>
        </fail>

        <basename property="zipstub" file="${derby.release.binzip}" suffix=".zip"/>
        <echo message="${zipstub}"/>

        <property name="repackage.dir" value="${release.base}/repackagedocs"/>
        <property name="unpacked.dir" value="${repackage.dir}/unpacked"/>
        <property name="pruned.dir" value="${website.root}/build/site/docs/${branch.id}"/>
        <property name="pruned.docs.dir" value="${pruned.dir}/docs"/>
        <property name="pruned.publicapi.dir" value="${pruned.dir}/publishedapi"/>

        <delete dir="${repackage.dir}"/>
        <mkdir dir="${unpacked.dir}"/>
        <mkdir dir="${pruned.dir}"/>
        <mkdir dir="${pruned.docs.dir}"/>
        <mkdir dir="${pruned.publicapi.dir}"/>

        <unzip src="${derby.release.binzip}" dest="${unpacked.dir}"/>

        <move todir="${pruned.docs.dir}"><fileset dir="${unpacked.dir}/${zipstub}/docs"/></move>
        <move todir="${pruned.publicapi.dir}"><fileset dir="${unpacked.dir}/${zipstub}/javadoc"/></move>
        <delete dir="${unpacked.dir}"/>

        <antcall target="movepdf"><param name="userguide" value="adminguide"/></antcall>
        <antcall target="movepdf"><param name="userguide" value="devguide"/></antcall>
        <antcall target="movepdf"><param name="userguide" value="getstart"/></antcall>
        <antcall target="movepdf"><param name="userguide" value="ref"/></antcall>
        <antcall target="movepdf"><param name="userguide" value="security"/></antcall>
        <antcall target="movepdf"><param name="userguide" value="tools"/></antcall>
        <antcall target="movepdf"><param name="userguide" value="tuning"/></antcall>

        <move todir="${pruned.dir}"><fileset dir="${pruned.docs.dir}/html"/></move>
        <delete dir="${pruned.docs.dir}"/>

        <!-- Delete the obsolete Japanese and Brazilian variants -->
        <delete dir="${pruned.dir}/ja_JP"/>
        <delete dir="${pruned.dir}/pt_BR"/>

    </target>

    <!-- Move the pdf files into the html directory so that everything is in one place -->
    <target name="movepdf">
        <move todir="${pruned.docs.dir}/html/${userguide}">
          <fileset dir="${pruned.docs.dir}/pdf/${userguide}"/>
        </move>
        <delete dir="${pruned.docs.dir}/pdf/${userguide}"/>
    </target>

    <!-- Transform the release notes for publication on the website. This creates the download page for the release -->
    <target name="transformrelnotes" depends="promptforreleaseid,promptforwebsite">

        <property name="relnotes.target.dir" value="${website.root}/src/documentation/content/xdocs/releases" />

        <fail message="Cannot transform the release notes. The web site client does not look correct.">
            <condition>
              <not>
                <available file="${relnotes.target.dir}"/>
              </not>
            </condition>
        </fail>

        <property name="relnotes.src" value="${basedir}/RELEASE-NOTES.html" />

        <taskdef
          name="transformReleaseNotes"
          classname="org.apache.derbyBuild.ReleaseNotesTransformer"
          classpath="${out.dir}"
        />
        <transformReleaseNotes
            inputFileName="${relnotes.src}"
            outputFileName="${relnotes.target.dir}/release-${derby.release.id}.html"
            cliXconfFileName="${website.root}/src/documentation/conf/cli.xconf"
            releaseId="${derby.release.id}"
        />

        <!-- Copy the cgi script which enables mirroring for the new release -->
        <copy
            file="${relnotes.target.dir}/release-template.cgi"
            tofile="${relnotes.target.dir}/release-${derby.release.id}.cgi"
          />

    </target>

    <!-- Prompt for and sanity check the root of your website client -->
    <target name="promptforwebsite" depends="defineprompt">

        <promptForProperty
          propertyName="website.root"
          prompt="Enter the root directory of your Derby website client (e.g. /Users/me/derby/site/trunk) > "
        />

    </target>

</project>
Something went wrong with that request. Please try again.