mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
02.59.2013 ce873c05a4624438f19ab8776df230153c034722
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
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !
 !      Copyright 2006-2010 Sun Microsystems, Inc.
 !      Portions Copyright 2011-2013 ForgeRock AS
 ! -->
 
<project name="Directory Server" basedir="." default="package"
         xmlns:ivy="antlib:org.apache.ivy.ant">
  <description>
    This is the build script for OpenDJ.  See the BUILDING
    file in this directory for build instructions.
  </description>
 
  <!-- Build JVM properties -->
  <property name="MEM" value="512M"/>
 
  <!-- Build OpenDMK properties -->
  <property file="build.properties"/>
 
  <!-- General server-wide properties                                 -->
  <property name="src.dir"          location="src/server"              />
  <property name="build.dir"        location="build"                   />
  <property name="classes.dir"      location="${build.dir}/classes"    />
  <property name="build.lib.dir"    location="${build.dir}/lib"        />
  <property name="lib.dir"          location="lib"                     />
  <property name="ext.dir"          location="ext"                     />
  <property name="package.dir"      location="${build.dir}/package"    />
  <property name="javadoc.dir"      location="${build.dir}/javadoc"    />
  <property name="docgen.dir"       location="${build.dir}/docgen"    />
  <property name="configguide.dir"  location="${docgen.dir}/configuration_guide"    />
  <property name="configguideldap.dir"  location="${docgen.dir}/configuration_guide_with_ldap_mapping"    />
  <property name="wiki.home"        value="https://wikis.forgerock.org/confluence/display/opendj/Home"/>
  <property name="resource.dir"     location="resource"                />
  <property name="scripts.dir"      location="${resource.dir}/bin"     />
  <property name="config.dir"       location="${resource.dir}/config"  />
  <property name="build.debuglevel"    value="lines,vars,source"       />
  <property name="ivy.install.version" value="2.3.0"/>
  <property name="ivy.jar.file"        value="${ext.dir}/ivy.jar"/>
  <!-- example command line to invoke for building offline:
    ant resolve -Dbuild.offline=
  -->
  <condition property="ivy.checkmodified" value="false" else="true">
    <isset property="build.offline"/>
  </condition>
  <condition property="ivy.changingpattern" value="" else=".*-SNAPSHOT">
    <isset property="build.offline"/>
  </condition>
 
  <!-- Properties for build tools                                   -->
  <property name="buildtools.src.dir" location="src/build-tools" />
  <property name="buildtools.classes.dir" location="${build.dir}/build-tools/classes" />
 
  <!-- Properties for use in unit testing.                           -->
  <property name="unittest.testng.dir" location="tests/unit-tests-testng"/>
  <property name="unittest.testng.src.dir"
    location="${unittest.testng.dir}/src/server"/>
 
  <property name="unittest.classes.dir"
       location="${build.dir}/unit-tests/classes" />
  <property name="unittest.report.dir"
       location="${build.dir}/unit-tests/report"/>
  <property name="unittest.resource.dir"
       location="${build.dir}/unit-tests/resource"/>
 
  <!-- Properties for use with the DSML component.                      -->
  <property name="dsml.dir"         location="resource/dsml"             />
  <property name="dsml.src.dir"     location="src/dsml"                  />
  <property name="dsml.lib.dir"     location="${dsml.dir}/lib"           />
  <property name="dsml.gen.dir"     location="${build.dir}/dsml/gen"     />
  <property name="dsml.classes.dir" location="${build.dir}/dsml/classes" />
 
  <!-- Properties for use with the Quick Setup.                      -->
  <property name="quicksetup.src.dir" location="src/quicksetup"       />
  <property name="quicksetup.classes.dir"
            location="${build.dir}/quicksetup/classes"                />
  <property name="quicksetup.globalcompile.classes.dir"
            location="${classes.dir}/org/opends/quicksetup" />
  <property name="ads.src.dir" location="src/ads"       />
  <property name="ads.classes.dir" location="${classes.dir}/org/opends/admin/ads"/>
 
  <!-- Properties for use with the GUI Tools that go in OpenDJ jar.                      -->
  <property name="guitools.src.dir" location="src/guitools"       />
 
  <!-- Properties for coverage diff reports                        -->
  <property name="cvgdiff.dir" location="${build.dir}/diff"                />
  <property name="cvgdiff.report.dir"
            location="${cvgdiff.dir}/report"                        />
 
  <!-- Properties for code coverage testing.                            -->
  <property name="coverage.dir"         location="${build.dir}/coverage"            />
  <property name="coverage.report.dir"
            location="${coverage.dir}/reports/unit"                          />
  <property name="coverage.instr.dir"
            location="${coverage.dir}/instrumentedcode"                      />
  <property name="coverage.data.dir"
            location="${coverage.dir}/gathereddata"                          />
 
  <!-- Properties for the EMMA code coverage tool.                 -->
  <property name="emma.dir" location="${ext.dir}/emma/lib"          />
 
  <!-- Properties for the AspectJ tools                            -->
  <property name="aj.dir" location="${ext.dir}/aspectj"             />
  <property name="aj.lib.dir" location="${aj.dir}/lib"              />
 
  <!-- Properties for the TestNG unit testing  tool.               -->
  <property name="testng.dir" location="${ext.dir}/testng"          />
  <property name="testng.lib.dir" location="${testng.dir}/lib"      />
 
  <!-- Properties for the ANT build tool.                          -->
  <property name="ant.dir" location="${ext.dir}/ant"                />
  <property name="ant.lib.dir" location="${ant.dir}/lib"            />
 
  <!-- Properties for the checkstyle tool.                           -->
  <property name="checkstyle.dir"  location="${ext.dir}/checkstyle"   />
  <property name="checkstyle.cache.dir"  location=".checkstyle-cache" />
 
  <!-- Properties for the SVNKit tool.                         -->
  <property name="svnkit.dir"  location="${ext.dir}/svnkit" />
 
  <!-- Properties for Directory Server version information.              -->
  <property name="dynconstants.file"
       location="${src.dir}/org/opends/server/util/DynamicConstants.java" />
  <property name="dynconstants.stubfile"
        location="${resource.dir}/DynamicConstants.java.stubs" />
 
 
  <property file="PRODUCT"                                                />
 
  <!-- Properties for administration framework code generation. -->
  <property name="admin.defn.dir"  location="src/admin/defn" />
  <property name="admin.src.dir"   location="src/admin/generated" />
  <property name="admin.rules.dir" location="resource/admin" />
  <property name="configguide.resource.dir" location="resource/admin/config-guide" />
 
  <!-- Properties for generating messages. -->
  <property name="msg.dir"         location="src/messages" />
  <property name="msg.prop.dir"    location="${msg.dir}/messages" />
  <property name="msg.javagen.dir" location="${msg.dir}/generated" />
  <property name="msg.logref.dir"  location="${docgen.dir}/logref" />
  <property name="msg.package.dir" location="${classes.dir}/messages" />
  <property name="msg.src.dir"     location="${msg.dir}/src" />
 
  <!-- Properties for L10n for generating messages. -->
  <property name="msgl10n.prop.dir"  location="src/admin/messages/" />
  <property name="msgl10n.diff.dir"  location="${build.dir}/l10nmsg/" />
 
 
  <!-- Properties for SNMP extension. -->
  <property name="snmp.mib.dir"      location="src/snmp/resource/mib" />
  <property name="snmp.security.dir" location="src/snmp/resource/security" />
  <property name="snmp.config.dir"   location="src/snmp/resource/config" />
  <property name="snmp.resource.dir" location="src/snmp/resource" />
  <property name="snmp.gen.dir"      location="src/snmp/generated" />
  <property name="snmp.src.dir"      location="src/snmp/src" />
 
  <property name="snmp.classes.dir"
            location="${classes.dir}/org/opends/server/snmp" />
    
  <!-- Prevent ant runtime from being included on classpath during
       compilation. -->  
  <presetdef name="javac">
    <javac optimize="true" includeantruntime="false"
        debug="on" debuglevel="${build.debuglevel}"
        deprecation="true" fork="true"
        memoryInitialSize="${MEM}" memoryMaximumSize="${MEM}">
      <compilerarg value="-Xlint:all" />
      <compilerarg value="-Xlint:-rawtypes" />
      <compilerarg value="-Xlint:-static" />
      <compilerarg value="-Xlint:-unchecked" />
    </javac>
  </presetdef>
 
  <!-- Create a package bundle containing the DSML library. -->
  <target name="dsml" depends="predsml,package"
       description="Build a Directory Server package bundle with DSML.">
  </target>
 
  <target name="initPrecommit">
    <property name="isPrecommit" value="true"/>
  </target>
 
  <!-- The build target that should be used before committing code. -->
  <target name="precommit" depends="initPrecommit,clean,dynamicconstants,
       checkstyle,checkprecommit,dsml,test"
       description="Perform all processing needed before committing code.">
  </target>
 
  <!-- The build target that should be used for nightly builds. -->
  <target name="nightly"
       depends="nightlybuild,nightlytests"
       description="Perform all processing needed for nightly builds.">
  </target>
 
  <!-- The build target that should be used for build part of nightly builds. -->
  <target name="nightlybuild"
       depends="checkstyle,dsml,srczip,javadoc,docgen"
       description="Perform all processing related to build  for nightly builds.">
  </target>
 
  <!-- The build target that should be used for test part of nightly builds. -->
  <target name="nightlytests"
       depends="testall"
       description="Perform all processing related to unit tests for nightly builds.">
  </target>
 
 
  <!-- The build target that should be used for weekly builds. -->
  <target name="weekly" depends="nightly"
       description="Perform all processing needed for weekly builds.">
  </target>
 
 
 
 
  <!-- The build target that should be used to build everything. -->
  <target name="all"
       depends="checkstyle,clean,checkprecommit,dsml,srczip,javadoc,docgen,testall"
       description="Build using all defined targets.">
  </target>
 
 
  <target name="generatemessages" depends="buildtools">
    <typedef name="genmsg"
             classname="org.opends.build.tools.GenerateMessageFile" >
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </typedef>
    <!--
    <genmsg sourceProps="${msg.prop.dir}/xxx.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/XxxMessages.java">
    </genmsg>
    -->
    <genmsg sourceProps="${msg.prop.dir}/access_control.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/AccessControlMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/admin.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/AdminMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/admin_tool.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/AdminToolMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/backend.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/BackendMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/config.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/ConfigMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/core.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/CoreMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/dsconfig.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/DSConfigMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/extension.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/ExtensionMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/jeb.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/JebMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/log.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/LoggerMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/plugin.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/PluginMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/protocol.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/ProtocolMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/quicksetup.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/QuickSetupMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/replication.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/ReplicationMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/schema.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/SchemaMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/task.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/TaskMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/tools.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/ToolMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/utility.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/UtilityMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/version.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/VersionMessages.java">
    </genmsg>
    <genmsg sourceProps="${msg.prop.dir}/runtime_information.properties"
            destJava="${msg.javagen.dir}/org/opends/messages/RuntimeMessages.java">
    </genmsg>
 
  </target>
 
 
  <target name="generateLogReference" depends="buildtools">
    <typedef name="genlogref"
             classname="org.opends.build.tools.GenerateMessageFile" >
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </typedef>
    <!--
    <genlogref sourceProps="${msg.prop.dir}/xxx_yyy.properties"
               destJava="${msg.logref.dir}/log-ref-xxx-yyy.xml"
               writelogref="true" />
    -->
    <genlogref sourceProps="${msg.prop.dir}/access_control.properties"
               destJava="${msg.logref.dir}/log-ref-access-control.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/admin.properties"
               destJava="${msg.logref.dir}/log-ref-admin.xml"
               writelogref="true" />
    <!-- Ignore admin tool messages while documenting only serious errors.
    <genlogref sourceProps="${msg.prop.dir}/admin_tool.properties"
               destJava="${msg.logref.dir}/log-ref-admin-tool.xml"
               writelogref="true" />
    -->
    <genlogref sourceProps="${msg.prop.dir}/backend.properties"
               destJava="${msg.logref.dir}/log-ref-backend.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/config.properties"
               destJava="${msg.logref.dir}/log-ref-config.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/core.properties"
               destJava="${msg.logref.dir}/log-ref-core.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/dsconfig.properties"
               destJava="${msg.logref.dir}/log-ref-dsconfig.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/extension.properties"
               destJava="${msg.logref.dir}/log-ref-extension.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/jeb.properties"
               destJava="${msg.logref.dir}/log-ref-jeb.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/log.properties"
               destJava="${msg.logref.dir}/log-ref-log.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/plugin.properties"
               destJava="${msg.logref.dir}/log-ref-plugin.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/protocol.properties"
               destJava="${msg.logref.dir}/log-ref-protocol.xml"
               writelogref="true" />
    <!-- Ignore QuickSetup messages that users handle interactively.
    <genlogref sourceProps="${msg.prop.dir}/quicksetup.properties"
               destJava="${msg.logref.dir}/log-ref-quicksetup.xml"
               writelogref="true" />
    -->
    <genlogref sourceProps="${msg.prop.dir}/replication.properties"
               destJava="${msg.logref.dir}/log-ref-replication.xml"
               writelogref="true" />
    <!-- Ignore runtime info messages while documenting only serious errors.
    <genlogref sourceProps="${msg.prop.dir}/runtime_information.properties"
               destJava="${msg.logref.dir}/log-ref-runtime-information.xml"
               writelogref="true" />
    -->
    <genlogref sourceProps="${msg.prop.dir}/schema.properties"
               destJava="${msg.logref.dir}/log-ref-schema.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/task.properties"
               destJava="${msg.logref.dir}/log-ref-task.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/tools.properties"
               destJava="${msg.logref.dir}/log-ref-tools.xml"
               writelogref="true" />
    <genlogref sourceProps="${msg.prop.dir}/utility.properties"
               destJava="${msg.logref.dir}/log-ref-utility.xml"
               writelogref="true" />
    <!-- Ignore version messages while documenting only serious errors.
    <genlogref sourceProps="${msg.prop.dir}/version.properties"
               destJava="${msg.logref.dir}/log-ref-version.xml"
               writelogref="true" />
    -->
 
    <copy file="${resource.dir}/log-message-reference.xml"
          todir="${msg.logref.dir}" />
    <jar destfile="${docgen.dir}/log-ref.jar"
         basedir="${msg.logref.dir}"
         includes="**/*.xml" />
  </target>
 
  <!-- Remove all dynamically-generated build files. -->
  <target name="clean" depends="init,cleanadmin,cleanmessages,cleansnmp,cleanlib"
       description="Clean up any files generated during the build process">
 
    <delete dir="${build.dir}" />
    <delete file="${dynconstants.file}"  />
  </target>
 
 
 
  <!-- Perform common initialization common to several targets after cleaning out the previous build environment. -->
  <target name="cleaninit" depends="clean,init">
  </target>
 
 
 
  <!-- Set the property valid.java.version if the java version is valid. -->
  <target name="validjavaversion"
          depends="buildtools" >
 
    <property name="min.java.version" value="1.6.0_10" />
 
    <typedef name="validjavaversion"
             classname="org.opends.build.tools.ValidJavaVersion" >
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </typedef>
 
    <condition property="valid.java.version">
      <validjavaversion minVersion="${min.java.version}" />
    </condition>
 
  </target>
 
  <!-- Warn if the build java version is too old. -->
  <target name="checkjavaversion"
          depends="validjavaversion"
          unless="valid.java.version" >
    <echo level="warning"
          message="WARNING: Java version ${java.version} is too old."/>
    <echo level="warning"
          message="Java version ${min.java.version} or later is required to build ${SHORT_NAME}."/>
  </target>
 
 
  <!-- Perform common initialization common to several targets. -->
  <target name="init">
 
    <path id="run.classpath">
      <pathelement location="${classes.dir}" />
    </path>
 
    <path id="quickSetup.classpath">
       <pathelement location="${quicksetup.classes.dir}" />
    </path>
 
    <tstamp>
      <format property="timestamp" pattern="yyyyMMddHHmmss'Z'"
           timezone="UTC" />
    </tstamp>
 
    <condition property="DEBUG_BUILD" value="false">
      <not>
        <isset property="DEBUG_BUILD" />
      </not>
    </condition>
 
 
    <!--
     ! For some reason, some Apple VMs put quotes around the value of the
     ! java.vm.vendor property, which wreaks havoc with DynamicConstants.  This
     ! pair of conditions attempts to work around that by detecting the quote
     ! and surrounding the value with backslashes.
     ! -->
    <condition property="JVM_VENDOR" value="Apple Computer">
      <contains string="${java.vm.vendor}" substring="Apple Computer"
           casesensitive="false" />
    </condition>
 
    <condition property="JVM_VENDOR" value="${java.vm.vendor}">
      <not>
        <isset property="JVM_VENDOR" />
      </not>
    </condition>
 
    <condition property="isopendmkpresent">
     <or>
     <and>
       <available file="${opendmk.lib.dir}/jdmkrt.jar"/>
       <available file="${opendmk.lib.dir}/jdmktk.jar"/>
     </and>
     <and>
       <available file="${ext.dir}/jdmkrt.jar"/>
       <available file="${ext.dir}/jdmktk.jar"/>
     </and>
     </or>
    </condition>
 
    <condition property="isadmingendirpresent">
      <available file="${admin.src.dir}" type="dir" />
    </condition>
 
    <condition property="ismsggendirpresent">
      <available file="${msg.javagen.dir}" type="dir" />
    </condition>
 
  </target>
 
 
 
 
  <!-- Build the DynamicConstants.java file and any of its dependencies. -->
  <target name="dynamicconstants" depends="init,buildtools">
    <!-- Get the revision number of the current Subversion workspace -->
    <taskdef name="getsvnrevision"
             classname="org.opends.build.tools.GetSubversionRevision">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${svnkit.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <getsvnrevision property="REVISION_NUMBER" />
 
    <!-- Get the url repo of the current Subversion workspace -->
    <taskdef name="getsvnurlrepo"
             classname="org.opends.build.tools.GetSubversionUrlRepo">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${svnkit.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <getsvnurlrepo property="URL_REPOSITORY" />
 
 
    <!-- Construct the version number string -->
    <taskdef name="getversionnumber"
             classname="org.opends.build.tools.CreateVersionString">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <getversionnumber property="VERSION_NUMBER_STRING" />
 
 
    <!-- Generate the DynamicConstants.java file.
      Be warned that the .stubs file references the following properties
      PRODUCT_NAME, SHORT_NAME, MAJOR_VERSION, MINOR_VERSION, POINT_VERSION,
      VERSION_QUALIFIER, FIX_IDS, timestamp, user.name, java.version,
      java.vendor, java.vm.version, JVM_VENDOR, DEBUG_BUILD, REVISION_NUMBER,URL_REPOSITORY,
      VERSION_NUMBER_STRING
      If you change the name of any of those properties in this build.xml
      you'll need to reflect the same change in the .stubs file
    -->
    <condition property="BUILD_NUMBER" value="-1">
      <not>
        <isset property="BUILD_NUMBER" />
      </not>
    </condition>
 
    <copy file="${dynconstants.stubfile}"
          tofile="${dynconstants.file}"
          overwrite="true"                 >
      <filterchain>
        <expandproperties/>
      </filterchain>
    </copy>
  </target>
 
 
 
 
  <!-- Check modified files to see if any svn:eol-style or copyright updates
       are needed. -->
  <target name="checkprecommit" depends="buildtools"
       description="Ensure updated files eol-style and copyright info">
    <taskdef name="checkprecommit"
             classname="org.opends.build.tools.CheckPrecommit">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${svnkit.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <checkprecommit />
  </target>
 
 
 
  <!-- Ensure that the source code meets basic style requirements. -->
  <target name="checkstyle" description="Perform basic source style checks">
  <antcall target="displayjavaversion"/>
    <mkdir dir="${checkstyle.cache.dir}" />
 
    <taskdef resource="checkstyletask.properties"
         classpath="${checkstyle.dir}/checkstyle-all-4.1.jar" />
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${src.dir}">
        <include name="**/*.java"/>
        <exclude name="**/PublicAPI.java" />
      </fileset>
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${msg.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${ads.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${snmp.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${quicksetup.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${guitools.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${dsml.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-doctarget-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${src.dir}/org/opends/server/api" includes="**/*.java" />
      <fileset dir="${src.dir}/org/opends/server/protocols/internal"
           includes="**/*.java" />
      <fileset dir="${src.dir}/org/opends/server/types"
           includes="**/*.java" excludes="**/PublicAPI.java"/>
      <formatter type="plain" />
    </checkstyle>
 
    <checkstyle config="${checkstyle.dir}/opends-unittest-checkstyle.xml"
         failOnViolation="true">
      <fileset dir="${unittest.testng.src.dir}" includes="**/*.java" />
      <formatter type="plain" />
    </checkstyle>
  </target>
 
 
 
  <!-- Compile the Directory Server source files. -->
  <target name="cleancompile"
       depends="cleaninit,compilequicksetup"
       description="Recompile the Directory Server source files.">
  </target>
 
  <!-- Compile the Directory Server source files. -->
  <target name="compile"
       depends="init,checkjavaversion,dynamicconstants,generatemessages,compileadmin,resolve"
       description="Compile the Directory Server source files.">
    <mkdir dir="${classes.dir}" />
    <mkdir dir="${build.lib.dir}" />
 
    <javac srcdir="${src.dir}:${admin.src.dir}:${msg.src.dir}:${msg.javagen.dir}:${ads.src.dir}:${quicksetup.src.dir}:${guitools.src.dir}"
         destdir="${classes.dir}">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <fileset dir="${build.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
 
    <copy todir="${classes.dir}">
      <fileset dir="${src.dir}" includes="**/*.properties" />
      <fileset dir="${quicksetup.src.dir}" includes="**/*.properties, **/*.gif, **/*.png" />
      <fileset dir="${guitools.src.dir}" includes="**/*.properties, **/*.gif, **/*.png" />
    </copy>
  </target>
 
 
 
  <!-- Compile the Quick Setup source files. -->
  <target name="compilequicksetup" depends="buildtools,compile"
          description="Compile the Quick Setup source files.">
    <mkdir dir="${quicksetup.classes.dir}" />
    <javac srcdir="${ads.src.dir}" destdir="${quicksetup.classes.dir}">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <pathelement path="${classes.dir}"/>
      </classpath>
    </javac>
    <javac srcdir="${src.dir}:${msg.src.dir}:${msg.javagen.dir}" destdir="${quicksetup.classes.dir}">
      <include name="**/org/opends/server/util/SetupUtils.java"/>
      <include name="**/org/opends/server/util/CertificateManager.java"/>
      <include name="**/org/opends/server/util/DynamicConstants.java"/>
      <include name="**/org/opends/server/types/OperatingSystem.java"/>
      <include name="**/org/opends/messages/Message.java"/>
      <include name="**/org/opends/messages/MessageBuilder.java"/>
      <include name="**/org/opends/messages/MessageDescriptor.java"/>
      <include name="**/org/opends/messages/Severity.java"/>
      <include name="**/org/opends/messages/Category.java"/>
      <include name="**/org/opends/messages/QuickSetupMessages.java"/>
      <include name="**/org/opends/server/types/OpenDsException.java"/>
    </javac>
    <javac srcdir="${quicksetup.src.dir}" destdir="${quicksetup.classes.dir}">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <pathelement path="${classes.dir}"/>
      </classpath>
    </javac>
    <copy todir="${quicksetup.classes.dir}">
      <fileset dir="${quicksetup.src.dir}"
               includes="**/*.properties, **/*.gif, **/*.png" />
    </copy>
      <mkdir dir="${quicksetup.classes.dir}/messages" />
      <copy todir="${quicksetup.classes.dir}/messages">
         <fileset dir="${msg.prop.dir}"
                includes="**/quicksetup.properties" />
      </copy>
 
  </target>
 
 
 
  <!-- copy the message properties files -->
  <target name="copymessages">
    <mkdir dir="${msg.package.dir}"/>
    <copy todir="${msg.package.dir}">
      <fileset dir="${msg.prop.dir}"/>
    </copy>
  </target>
 
  <!-- copy the l10n message properties files (for generated messages)-->
  <target name="copyl10nmessages">
    <copy todir="${build.dir}/classes/admin/messages/org/opends/server/admin/std/meta/">
      <fileset dir="${msgl10n.prop.dir}" includes="*_fr.properties,*_de.properties,
        *_es.properties,*_ja.properties,*_ko.properties,*_zh_CN.properties,
        *_zh_TW.properties,*_pl.properties,*_ca_ES.properties">
      </fileset>
    </copy>
 
    <!-- check if the english generated files are different from the ones -->
    <!-- used for localization and copy the files that are different to a -->
    <!-- directory named diff -->
    <mkdir dir="${msgl10n.diff.dir}/diff"/>
    <copy todir="${msgl10n.diff.dir}/diff" verbose="true">
      <fileset dir="${build.dir}/classes/admin/messages/org/opends/server/admin/std/meta/"
        excludes="*_fr.properties,*_de.properties,*_es.properties,*_ja.properties,
        *_ko.properties,*_zh_CN.properties,*_zh_TW.properties,*_pl.properties,
        *_ca_ES.properties">
        <different targetdir="${msgl10n.prop.dir}" ignoreFileTimes="true" />
      </fileset>
    </copy>
 
    <fileset id="fs" dir="${msgl10n.diff.dir}/diff"/>
    <condition property="dir_empty">
      <length length="0">
        <fileset refid="fs"/>
      </length>
    </condition>
 
    <fail unless="dir_empty" if="isPrecommit"
      message="Generated admin message properties files differ from existing files :
 Copy all files from ${msgl10n.diff.dir}/diff to ${msgl10n.prop.dir}
 and include them for commit to resolve.">
    </fail>
  </target>
 
  <!--
   ! Rebuild the Directory Server without destroying any existing configuration
   ! or data.  It will only overwrite the libraries, classes, and scripts, and
   ! it will not re-package.  It will also not do a complete initialization, so
   ! DynamicConstants.java won't be regenerated.
   ! -->
  <target name="rebuild" depends="generatemessages"
       description="Rebuild the server without destroying config or data.">
 
    <!-- Construct the version number string -->
    <taskdef name="getversionnumber"
             classname="org.opends.build.tools.CreateVersionString">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <getversionnumber property="VERSION_NUMBER_STRING" />
 
    <!-- Set properties needed to find the packaged files -->
    <property name="pdir"
         location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" />
 
    <!-- Clean up a minimal set of files/directories for the rebuild. -->
    <delete dir="${classes.dir}" />
    <delete file="${package.dir}/lib/${SHORT_NAME}.jar" />
    <delete file="${pdir}.zip" />
    <delete dir="${quicksetup.classes.dir}" />
    <delete file="${package.dir}/lib/quicksetup.jar" />
 
    <!-- Regenerate configuration files if necessary -->
    <antcall target="compileadmin" />
 
    <!-- Recreate the classes directory and recompile into it. -->
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}:${msg.src.dir}:${msg.javagen.dir}:${admin.src.dir}:${ads.src.dir}:${quicksetup.src.dir}:${guitools.src.dir}"
         destdir="${classes.dir}">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <fileset dir="${build.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
 
    <copy todir="${classes.dir}">
      <fileset dir="${src.dir}" includes="**/*.properties" />
      <fileset dir="${quicksetup.src.dir}" includes="**/*.properties, **/*.gif, **/*.png" />
      <fileset dir="${guitools.src.dir}" includes="**/*.properties, **/*.gif, **/*.png" />
    </copy>
 
    <!-- copy the message properties files -->
    <antcall target="copymessages" />
 
 
    <!-- copy the message descriptor registry file -->
    <copy todir="${classes.dir}/org/opends/messages"
          file="${msg.javagen.dir}/org/opends/messages/descriptors.reg" />
 
    <!-- Generate the OpenDS.jar file -->
    <jar jarfile="${pdir}/lib/${SHORT_NAME}.jar"
         basedir="${classes.dir}"
         excludes="${ads.classes.dir}, ${quicksetup.globalcompile.classes.dir}"
         compress="true" index="true" />
 
    <!-- Recreate the quicksetup classes directory and recompile into it. -->
    <mkdir dir="${quicksetup.classes.dir}" />
    <javac srcdir="${ads.src.dir}" destdir="${quicksetup.classes.dir}">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <pathelement path="${classes.dir}"/>
      </classpath>
    </javac>
    <javac srcdir="${src.dir}:${msg.src.dir}:${msg.javagen.dir}" destdir="${quicksetup.classes.dir}">
      <include name="**/org/opends/server/util/SetupUtils.java"/>
      <include name="**/org/opends/server/util/CertificateManager.java"/>
      <include name="**/org/opends/server/util/DynamicConstants.java"/>
      <include name="**/org/opends/server/types/OperatingSystem.java"/>
      <include name="**/org/opends/messages/Message.java"/>
      <include name="**/org/opends/messages/MessageBuilder.java"/>
      <include name="**/org/opends/messages/MessageDescriptor.java"/>
      <include name="**/org/opends/messages/Severity.java"/>
      <include name="**/org/opends/messages/Category.java"/>
      <include name="**/org/opends/messages/QuickSetupMessages.java"/>
      <include name="**/org/opends/server/types/OpenDsException.java"/>
    </javac>
    <javac srcdir="${quicksetup.src.dir}" destdir="${quicksetup.classes.dir}">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <pathelement path="${classes.dir}"/>
      </classpath>
    </javac>
 
    <copy todir="${quicksetup.classes.dir}">
      <fileset dir="${quicksetup.src.dir}"
            includes="**/*.properties, **/*.gif, **/*.png"/>
    </copy>
 
    <!-- Generate the quicksetup.jar file -->
    <jar jarfile="${pdir}/lib/quicksetup.jar"
         basedir="${quicksetup.classes.dir}" compress="true" index="true" />
 
    <!-- Copy over external dependencies. -->
    <copy todir="${pdir}/lib">
      <fileset file="${build.lib.dir}/*.jar" />
    </copy>
 
    <!-- Regenerate example plugin. -->
    <antcall target="example-plugin" />
  </target>
 
 
  <!-- Generate the Configuration guides. -->
  <target name="docgen" depends="configguide,configguideldap"
       description="Generate the Configuration guides (1 standard + 1 with ldap mapping) (html).">
  </target>
 
  <!-- Generate the Standard Configuration guide. -->
  <target name="configguide" depends="compile,copymessages"
       description="Generate the Configuration guide (standard) (html).">
    <mkdir dir="${configguide.dir}" />
    <!-- copy the resource files -->
    <copy todir="${configguide.dir}">
          <fileset file="${configguide.resource.dir}/*" />
    </copy>
    <java fork="true" classname="org.opends.server.admin.doc.ConfigGuideGeneration" failonerror="true">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <dirset dir="${classes.dir}" />
      </classpath>
      <jvmarg value="-DGenerationDir=${configguide.dir}"/>
      <jvmarg value="-DOpendsWiki=${wiki.home}"/>
    </java>
  </target>
 
  <!-- Generate the Configuration guide with LDAP mapping. -->
  <target name="configguideldap" depends="compile,copymessages"
       description="Generate the Configuration guide (with LDAP mapping) (html).">
    <mkdir dir="${configguideldap.dir}" />
    <!-- copy the resource files -->
    <copy todir="${configguideldap.dir}">
          <fileset file="${configguide.resource.dir}/*" />
    </copy>
    <java fork="true" classname="org.opends.server.admin.doc.ConfigGuideGeneration" failonerror="true">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <dirset dir="${classes.dir}" />
      </classpath>
      <jvmarg value="-DGenerationDir=${configguideldap.dir}"/>
      <jvmarg value="-DOpendsWiki=${wiki.home}"/>
      <jvmarg value="-DLdapMapping"/>
    </java>
  </target>
 
  <!-- Populate the Directory Server package, but don't zip it up. -->
  <target name="prepackage" depends="cleancompile"
       description="Prepare the Directory Server package structure.">
    <property name="pdir"
         location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" />
 
    <mkdir dir="${pdir}"                                             />
    <mkdir dir="${pdir}/bak"                                         />
    <mkdir dir="${pdir}/bat"                                         />
    <mkdir dir="${pdir}/bin"                                         />
    <mkdir dir="${pdir}/classes"                                     />
    <mkdir dir="${pdir}/config"                                      />
    <mkdir dir="${pdir}/config/upgrade"                              />
    <mkdir dir="${pdir}/config/schema"                               />
    <mkdir dir="${pdir}/config/messages"                             />
    <mkdir dir="${pdir}/config/MakeLDIF"                             />
    <mkdir dir="${pdir}/config/snmp/security"                        />
    <mkdir dir="${pdir}/db"                                          />
    <mkdir dir="${pdir}/import-tmp"                                  />
    <mkdir dir="${pdir}/changelogDb"                                 />
    <mkdir dir="${pdir}/ldif"                                        />
    <mkdir dir="${pdir}/legal-notices"                               />
    <mkdir dir="${pdir}/lib"                                         />
    <mkdir dir="${pdir}/lib/extensions"                              />
    <mkdir dir="${pdir}/locks"                                       />
    <mkdir dir="${pdir}/logs"                                        />
    <mkdir dir="${pdir}/bin/ControlPanel.app"                         />
    <mkdir dir="${pdir}/bin/ControlPanel.app/Contents"                />
    <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/MacOS"          />
    <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources"      />
    <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources/Java" />
    <mkdir dir="${pdir}/QuickSetup.app"                              />
    <mkdir dir="${pdir}/QuickSetup.app/Contents"                     />
    <mkdir dir="${pdir}/QuickSetup.app/Contents/MacOS"               />
    <mkdir dir="${pdir}/QuickSetup.app/Contents/Resources"           />
    <mkdir dir="${pdir}/QuickSetup.app/Contents/Resources/Java"      />
    <mkdir dir="${pdir}/Uninstall.app"                               />
    <mkdir dir="${pdir}/Uninstall.app/Contents"                      />
    <mkdir dir="${pdir}/Uninstall.app/Contents/MacOS"                />
    <mkdir dir="${pdir}/Uninstall.app/Contents/Resources"            />
    <mkdir dir="${pdir}/Uninstall.app/Contents/Resources/Java"       />
 
 
    <!-- copy the message properties files -->
    <antcall target="copymessages" />
 
    <!-- copy the l10n message properties files -->
    <antcall target="copyl10nmessages" />
 
 
    <!-- copy the message descriptor registry file -->
    <copy todir="${classes.dir}/org/opends/messages"
          file="${msg.javagen.dir}/org/opends/messages/descriptors.reg" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}.jar"
         basedir="${classes.dir}"
         excludes="${ads.classes.dir}, ${quicksetup.globalcompile.classes.dir}, org/opends/server/snmp/**,**/*_fr.properties,**/*_ja.properties,**/*_de.properties,**/*_es.properties,**/*_zh_TW.properties,**/*_zh_CN.properties,**/*_ko.properties,**/*_pl.properties,**/*_ca_ES.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_fr.jar"
         basedir="${classes.dir}"
         includes="**/*_fr.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_ja.jar"
         basedir="${classes.dir}"
         includes="**/*_ja.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_de.jar"
         basedir="${classes.dir}"
         includes="**/*_de.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_es.jar"
         basedir="${classes.dir}"
         includes="**/*_es.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_ko.jar"
         basedir="${classes.dir}"
         includes="**/*_ko.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_zh_CN.jar"
         basedir="${classes.dir}"
         includes="**/*_zh_CN.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_zh_TW.jar"
         basedir="${classes.dir}"
         includes="**/*_zh_TW.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_pl.jar"
         basedir="${classes.dir}"
         includes="**/*_pl.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/${SHORT_NAME}_ca_ES.jar"
         basedir="${classes.dir}"
         includes="**/*_ca_ES.properties"
         compress="true" index="true" />
 
    <jar jarfile="${pdir}/lib/quicksetup.jar"
         basedir="${quicksetup.classes.dir}" compress="true" index="true" />
 
    <copy todir="${pdir}/lib">
        <fileset dir="${lib.dir}/jar">
          <include name="**/*.jar" />
        </fileset>
        <fileset dir="${lib.dir}/bundle">
          <include name="**/*.jar" />
        </fileset>
    </copy>
 
    <copy todir="${pdir}/lib">
      <fileset file="${lib.dir}/*.exe" />
    </copy>
 
    <copy todir="${pdir}">
      <fileset file="${resource.dir}/instance.loc" />
    </copy>
 
    <antcall target="example-plugin" />
 
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" excludes="*.bat,_client-script.sh,_server-script.sh,_mixed-script.sh,_script-util.sh" eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/lib" includes="_client-script.sh,_server-script.sh,_mixed-script.sh,_script-util.sh" eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" includes="README_WINDOWS.txt" eol="crlf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bat" excludes="_client-script.bat,_server-script.bat,_mixed-script.bat,_script-util.bat,setcp.bat" includes="*.bat" eol="crlf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/lib" includes="_client-script.bat,_server-script.bat,_mixed-script.bat,_script-util.bat,setcp.bat" eol="crlf" />
 
    <copy todir="${pdir}/config">
      <fileset file="${config.dir}/*" />
    </copy>
 
    <antcall target="package-snmp" />
 
    <copy file="${pdir}/config/config.ldif"
         tofile="${pdir}/config/upgrade/config.ldif.${REVISION_NUMBER}" />
 
    <!-- Create buildinfo files -->
    <echo message="${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}.${REVISION_NUMBER}"
        file="${pdir}/config/buildinfo" />
 
    <taskdef name="concatschema"
             classname="org.opends.build.tools.ConcatSchema">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <concatschema schemaDirectory="${resource.dir}/schema"
         toFile="${pdir}/config/upgrade/schema.ldif.${REVISION_NUMBER}" />
 
    <copy todir="${pdir}/config/schema">
      <fileset dir="${resource.dir}/schema" />
    </copy>
 
    <copy todir="${pdir}/config/messages">
      <fileset dir="${resource.dir}/messages" />
    </copy>
 
    <copy todir="${pdir}/config/MakeLDIF">
      <fileset dir="${resource.dir}/MakeLDIF" />
    </copy>
 
    <copy todir="${pdir}/legal-notices">
      <fileset dir="${resource.dir}/legal-notices" />
    </copy>
 
    <copy todir="${pdir}">
      <fileset file="${resource.dir}/README" />
    </copy>
 
    <copy todir="${pdir}">
      <fileset file="${resource.dir}/install.html" />
    </copy>
 
    <copy todir="${pdir}">
      <fileset file="${resource.dir}/install.txt" />
    </copy>
 
    <copy todir="${pdir}">
      <fileset file="${resource.dir}/images/opends_logo.png" />
    </copy>
 
    <fixcrlf srcDir="${resource.dir}" destDir="${pdir}" includes="setup,uninstall,upgrade"
         eol="lf" />
    <fixcrlf srcDir="${resource.dir}" destDir="${pdir}" includes="setup.bat,uninstall.bat,upgrade.bat"
         eol="crlf" />
 
    <chmod file="${pdir}/setup" perm="755" />
    <chmod file="${pdir}/uninstall" perm="755" />
    <chmod file="${pdir}/upgrade" perm="755" />
 
    <copy todir="${pdir}/QuickSetup.app">
      <fileset dir="${resource.dir}/mac/QuickSetup.app" />
    </copy>
    <chmod perm="755">
      <fileset dir="${pdir}">
        <include name="QuickSetup.app/Contents/MacOS/JavaApplicationStub" />
      </fileset>
    </chmod>
    <copy todir="${pdir}/Uninstall.app">
      <fileset dir="${resource.dir}/mac/Uninstall.app" />
    </copy>
    <chmod perm="755">
      <fileset dir="${pdir}">
        <include name="Uninstall.app/Contents/MacOS/JavaApplicationStub" />
      </fileset>
    </chmod>
    <copy todir="${pdir}/bin/ControlPanel.app">
      <fileset dir="${resource.dir}/mac/ControlPanel.app" />
    </copy>
    <chmod perm="755">
      <fileset dir="${pdir}/bin">
        <include name="ControlPanel.app/Contents/MacOS/JavaApplicationStub" />
      </fileset>
    </chmod>
 
    <chmod perm="755">
      <fileset dir="${pdir}/bin">
      </fileset>
    </chmod>
    <chmod file="${pdir}/lib/_client-script.sh" perm="755" />
    <chmod file="${pdir}/lib/_server-script.sh" perm="755" />
    <chmod file="${pdir}/lib/_mixed-script.sh" perm="755" />
    <chmod file="${pdir}/lib/_script-util.sh" perm="755" />
  </target>
 
 
 
 
  <!-- Package the Directory Server for distribution. -->
  <target name="package" depends="prepackage"
       description="Package the Directory Server for distribution.">
    <zip destfile="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}.zip">
      <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}"
           filemode="644" dirmode="700" />
      <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/**/*"
           excludes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/*,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
           filemode="644" dirmode="755" />
      <zipfileset dir="${package.dir}"
           includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh"
           filemode="755" dirmode="755" />
      <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/*"
           excludes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt"
           filemode="755" dirmode="755" />
      <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt"
           filemode="644" dirmode="755" />
      <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
           filemode="755" dirmode="755" />
    </zip>
    <property name="package.built" value="true"/>
 
    <!-- print a time stamp in Unix 'date' format -->
    <tstamp>
      <format property="package.built.ts" pattern="EEE MMM dd HH:mm:ss zzz yyyy" />
    </tstamp>
    <echo message="Package Built: ${package.built.ts}"/>
  </target>
 
  <!-- Package the Directory Server for the RPM distribution. -->
  <target name="package-RPM"
          description="Package the Directory Server for RPM distribution.">
    <taskdef name="getversionnumber"
                     classname="org.opends.build.tools.CreateVersionString">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <getversionnumber property="VERSION_NUMBER_STRING" />
 
    <property name="prefix"    value="/opt/opends"/>
    <property name="release"   value="0"/>
    <taskdef name="genrpm"
                     classname="org.opends.build.tools.GenerateRpm">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <mkdir dir="${build.dir}/rpm/noarch" />
    <mkdir dir="${build.dir}/rpm/i486" />
    <mkdir dir="${build.dir}/rpm/i586" />
    <mkdir dir="${build.dir}/rpm/i686" />
    <mkdir dir="${build.dir}/rpm/BUILD" />
    <mkdir dir="${build.dir}/rpm/RPMS" />
    <mkdir dir="${build.dir}/rpm/SOURCES/${prefix}" />
    <mkdir dir="${build.dir}/rpm/i386" />
    <mkdir dir="${build.dir}/rpm/SPECS" />
    <mkdir dir="${build.dir}/rpm/SRPMS" />
 
    <genrpm
        topDir="${build.dir}/rpm"
        prefix="${prefix}"
        sourceDirName="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"
        specFileName="${build.dir}/rpm/SPECS/specFile"
        version="${VERSION_NUMBER_STRING}"
        release="${release}"
          overwrite="true">
    </genrpm>
 
    <rpm
            specfile="specFile"
            topdir="${build.dir}/rpm"
      quiet="true"
    />
 
    <copy todir="${package.dir}">
      <fileset dir="${build.dir}/rpm/RPMS/noarch">
        <include name="*.rpm" />
      </fileset>
    </copy>
 
    <delete dir="${build.dir}/rpm"/>
  </target>
 
 
 
  <!-- Prepare the Directory Server DSML library. -->
  <target name="predsml" depends="prepackage"
       description="Prepare the Directory Server DSML library.">
    <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
      <classpath>
        <fileset dir="${dsml.lib.dir}">
          <include name="**/*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <mkdir dir="${dsml.gen.dir}/org/opends/dsml/protocol" />
    <xjc destdir="${dsml.gen.dir}" schema="${dsml.dir}/schema/DSMLv2.xsd"
         removeOldOutput="yes" package="org.opends.dsml.protocol"
         binding="${dsml.dir}/schema/bindings.xjb" target="2.1">
      <!-- Don't generate package-info.java as it conflicts with
           the one in src/dsml -->
      <arg value="-npa"/>
      <arg value="-verbose"/>
      <produces dir="${dsml.gen.dir}/org/opends/dsml/protocol"
           includes="* impl/*" />
    </xjc>
 
    <mkdir dir="${dsml.classes.dir}" />
 
    <javac srcdir="${dsml.gen.dir}" destdir="${dsml.classes.dir}">
      <compilerarg value="-Xlint:-path" />
      <classpath>
        <fileset dir="${dsml.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
 
    <javac srcdir="${dsml.src.dir}" destdir="${dsml.classes.dir}">
      <compilerarg value="-Xlint:-path" />
      <classpath>
        <fileset dir="${dsml.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <dirset dir="${classes.dir}" />
      </classpath>
    </javac>
 
     <mkdir dir="${dsml.classes.dir}/resources" />
     <copy file="${dsml.dir}/schema/DSMLv2.xsd"
           tofile="${dsml.classes.dir}/resources/DSMLv2.xsd"
           overwrite="true"/>
 
    <war destfile="${classes.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}-DSML.war"
         webxml="${dsml.dir}/webapp/web.xml">
      <fileset file="${dsml.dir}/webapp/server.properties" />
 
      <webinf dir="${dsml.dir}/webapp" includes="**/*"
           excludes="web.xml, **/*.jar, **/*.properties" />
 
      <classes dir="${dsml.classes.dir}" />
 
      <lib dir="${dsml.lib.dir}">
        <include name="jaxb-api.jar" />
        <include name="jaxb-impl.jar" />
        <include name="jsr173_1.0_api.jar" />
        <include name="saaj-1.3.jar" />
        <include name="saaj-impl-1.3.jar" />
      </lib>
 
      <lib dir="${pdir}/lib">
        <include name="${SHORT_NAME}.jar" />
        <include name="${SHORT_NAME}_fr.jar" />
        <include name="${SHORT_NAME}_ja.jar" />
        <include name="${SHORT_NAME}_ko.jar" />
        <include name="${SHORT_NAME}_de.jar" />
        <include name="${SHORT_NAME}_es.jar" />
        <include name="${SHORT_NAME}_zh_TW.jar" />
        <include name="${SHORT_NAME}_zh_CN.jar" />
        <include name="${SHORT_NAME}_pl.jar" />
        <include name="${SHORT_NAME}_ca_ES.jar" />
      </lib>
    </war>
 
    <copy todir="${package.dir}">
      <fileset file="${classes.dir}/*.war" />
    </copy>
  </target>
 
 
 
 
  <!-- Generate JavaDoc documentation from the source files -->
  <target name="javadoc" depends="dsml,compileadmin"
       description="Generate JavaDoc documentation.">
    <mkdir dir="${javadoc.dir}" />
 
    <javadoc destdir="${javadoc.dir}" additionalparam="-quiet"
         linksource="yes" windowtitle="${PRODUCT_NAME} API Documentation"
         maxmemory="${MEM}">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
 
        <fileset dir="${dsml.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
 
        <dirset dir="${classes.dir}" />
        <dirset dir="${dsml.classes.dir}" />
        <dirset dir="${quicksetup.classes.dir}" />
      </classpath>
 
      <packageset dir="${src.dir}" />
      <packageset dir="${admin.src.dir}" />
      <packageset dir="${ads.src.dir}" />
      <packageset dir="${dsml.src.dir}" />
      <packageset dir="${msg.src.dir}" />
    </javadoc>
  </target>
 
 
  <!-- Internal target to run the Directory Server directly. -->
  <target name="run-server" depends="dynamicconstants">
    <!-- Set properties needed to find the packaged files -->
    <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
    <java fork="true" classname="org.opends.server.core.DirectoryServer" failonerror="true">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar"/>
        </fileset>
        <dirset dir="${classes.dir}"/>
      </classpath>
      <jvmarg value="-Dorg.opends.server.BuildRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.scriptName=start-ds"/>
      <jvmarg value="-Dorg.opends.server.ServerRoot=${pdir}"/>
      <arg value="--configClass=org.opends.server.extensions.ConfigFileHandler"/>
      <arg value="--configFile=${pdir}/config/config.ldif"/>
      <arg value="--nodetach"/>
    </java>
  </target>
 
  <!-- Netbeans target to debug the Directory Server. -->
  <target name="nb-debug-server" depends="dynamicconstants">
    <!-- Set properties needed to find the packaged files -->
    <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
    <path id="cp">
      <fileset dir="${lib.dir}">
        <include name="**/*.jar"/>
      </fileset>
      <dirset dir="${classes.dir}"/>
   </path>
    <nbjpdastart addressproperty="jpda.address" name="Directory Server" transport="dt_socket">
      <classpath refid="cp"/>
    </nbjpdastart>
    <java classname="org.opends.server.core.DirectoryServer" fork="true">
      <classpath refid="cp"/>
      <jvmarg value="-Xdebug"/>
      <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
      <jvmarg value="-Dorg.opends.server.BuildRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.scriptName=start-ds"/>
      <jvmarg value="-Dorg.opends.server.ServerRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.debug.enabled=true"/>
      <arg value="--configClass=org.opends.server.extensions.ConfigFileHandler"/>
      <arg value="--configFile=${pdir}/config/config.ldif"/>
      <arg value="--nodetach"/>
    </java>
  </target>
 
  <!-- Netbeans target to profile the Directory Server. -->
  <target name="nb-profile-server" depends="dynamicconstants">
    <!-- Set properties needed to find the packaged files -->
    <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
    <path id="cp">
      <fileset dir="${lib.dir}">
        <include name="**/*.jar"/>
      </fileset>
      <dirset dir="${classes.dir}"/>
    </path>
    <nbprofiledirect>
      <classpath refid="cp"/>
    </nbprofiledirect>
    <java fork="true" classname="org.opends.server.core.DirectoryServer">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar"/>
        </fileset>
        <dirset dir="${classes.dir}"/>
      </classpath>
      <jvmarg value="${profiler.info.jvmargs.agent}"/>
      <jvmarg value="-Dorg.opends.server.BuildRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.scriptName=start-ds"/>
      <jvmarg value="-Dorg.opends.server.ServerRoot=${pdir}"/>
      <arg value="--configClass=org.opends.server.extensions.ConfigFileHandler"/>
      <arg value="--configFile=${pdir}/config/config.ldif"/>
      <arg value="--nodetach"/>
    </java>
  </target>
 
   <!-- Internal target to run directly dsconfig. -->
  <target name="run-dsconfig" depends="dynamicconstants">
          <!-- Set properties needed to find the packaged files -->
      <property name="pdir"
                location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" />
    <java fork="true" classname="org.opends.server.tools.dsconfig.DSConfig" failonerror="true">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <dirset dir="${classes.dir}" />
      </classpath>
      <jvmarg  value="-Dorg.opends.server.scriptName=dsconfig" />
      <jvmarg value="-Dorg.opends.server.BuildRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.ServerRoot=${pdir}"/>
    </java>
  </target>
 
 <!-- Netbeans target to debug dsconfig. -->
  <target name="nb-debug-dsconfig" depends="dynamicconstants">
    <!-- Set properties needed to find the packaged files -->
    <property name="pdir"
              location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" />
    <path id="cp">
      <fileset dir="${lib.dir}">
        <include name="**/*.jar" />
      </fileset>
      <dirset dir="${classes.dir}" />
    </path>
    <nbjpdastart addressproperty="jpda.address" name="Directory Server" transport="dt_socket">
      <classpath refid="cp"/>
    </nbjpdastart>
    <java classname="org.opends.server.tools.dsconfig.DSConfig" fork="true">
      <classpath refid="cp"/>
      <jvmarg value="-Xdebug"/>
      <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
      <jvmarg  value="-Dorg.opends.server.scriptName=dsconfig" />
      <jvmarg value="-Dorg.opends.server.BuildRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.ServerRoot=${pdir}"/>
      <jvmarg value="-Dorg.opends.server.debug.enabled=true"/>
     </java>
  </target>
 
 
  <!-- Internal target to prepare to generate a code coverage report. -->
  <target name="coverage">
    <property name="coverage.enabled" value="true" />
 
    <mkdir dir="${coverage.dir}"        />
    <mkdir dir="${coverage.data.dir}"   />
    <mkdir dir="${coverage.instr.dir}"  />
    <mkdir dir="${coverage.report.dir}" />
 
    <path id="run.classpath">
      <pathelement location="${classes.dir}" />
    </path>
 
    <path id="quickSetup.classpath">
       <pathelement location="${quicksetup.classes.dir}" />
    </path>
  </target>
 
 
 
  <!-- Prepare to execute the Directory Server TestNG unit tests. -->
  <target name="test.OpenDS.package.required" depends="dynamicconstants">
    <condition property="test.OpenDS.package.required">
      <available file="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}.zip"/>
    </condition>
  </target>
 
  <target name="testinit-package" depends="test.OpenDS.package.required" unless="test.OpenDS.package.required">
    <echo message="Performing full rebuild (no OpenDJ zip package found)"/>
    <antcall target="package"/>
  </target>
 
  <target name="testinit-recompile" depends="test.OpenDS.package.required" if="test.OpenDS.package.required">
    <echo message="Performing partial rebuild (OpenDJ zip package found)"/>
    <mkdir dir="${classes.dir}" />
 
    <javac srcdir="${src.dir}:${admin.src.dir}:${msg.src.dir}:${msg.javagen.dir}:${ads.src.dir}:${quicksetup.src.dir}:${guitools.src.dir}"
        destdir="${classes.dir}">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <fileset dir="${build.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
 
    <copy todir="${classes.dir}">
      <fileset dir="${src.dir}" includes="**/*.properties" />
      <fileset dir="${quicksetup.src.dir}" includes="**/*.properties, **/*.gif, **/*.png" />
      <fileset dir="${guitools.src.dir}" includes="**/*.properties, **/*.gif, **/*.png" />
    </copy>
  </target>
 
  <target name="testinit" depends="testinit-package,testinit-recompile"
         description="Prepare to execute the Directory Server TestNG unit tests.">
    <!-- If we are to perform coverage tests, then set that up. -->
    <path id="emma.lib">
      <pathelement location="${emma.dir}/emma.jar"     />
      <pathelement location="${emma.dir}/emma_ant.jar" />
    </path>
 
    <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
 
    <emma enabled="${coverage.enabled}">
      <instr instrpathref="run.classpath" destdir="${coverage.instr.dir}"
             metadatafile="${coverage.data.dir}/metadata.emma" merge="true" />
    </emma>
 
    <!-- Compile the test cases -->
    <mkdir dir="${unittest.classes.dir}" />
    <javac srcdir="${unittest.testng.src.dir}" destdir="${unittest.classes.dir}" excludes="org/opends/server/snmp/**">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
 
        <fileset dir="${testng.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <path refid="run.classpath" />
        <path refid="quickSetup.classpath" />
      </classpath>
    </javac>
 
    <copy todir="${unittest.classes.dir}">
      <fileset dir="${unittest.testng.src.dir}"
               includes="**/*.properties" />
    </copy>
 
    <!-- Compile SNMP Tests if needed -->
    <antcall target="testsnmpinit"/>
 
    <!-- Prep the TestNG XML file -->
 
    <condition property="test.groups" value="exclude=slow">
      <not>
        <or>
          <isset property="test.groups" />
          <isset property="test.packages" />
          <isset property="test.classes" />
          <isset property="test.methods" />
        </or>
      </not>
    </condition>
 
    <!-- do not run tests dependent upon creation of the .zip file -->
    <condition property="test.packages" value="org.opends.server.*,org.opends.messages.*">
      <and>
        <not>
          <or>
            <isset property="test.packages" />
            <isset property="test.classes" />
            <isset property="test.methods" />
          </or>
        </not>
        <not>
          <equals arg1="${package.built}" arg2="true" />
        </not>
      </and>
    </condition>
 
    <!-- run tests dependent upon creation of the .zip file -->
    <condition property="test.packages" value="org.opends.server.*,org.opends.messages.*,org.opends.quicksetup.*">
      <and>
        <not>
          <or>
            <isset property="test.packages" />
            <isset property="test.classes" />
            <isset property="test.methods" />
          </or>
        </not>
        <equals arg1="${package.built}" arg2="true" />
      </and>
    </condition>
 
 
    <condition property="test.classes" value="">
      <not>
        <or>
          <isset property="test.classes" />
          <isset property="test.methods" />
        </or>
      </not>
    </condition>
 
    <condition property="test.methods" value="">
      <not>
        <or>
          <isset property="test.methods" />
        </or>
      </not>
    </condition>
 
    <mkdir dir="${unittest.resource.dir}" />
    <typedef name="preptestng" classname="org.opends.build.tools.PrepTestNG"
        classpath="${build.dir}/build-tools/build-tools.jar" />
 
 
    <preptestng file="${testng.dir}/testng.xml"
                tofile="${unittest.resource.dir}/testng.xml"
                grouplist="${test.groups}"
                packagelist="${test.packages}"
                classList="${test.classes}"
                methodList="${test.methods}" />
 
    <antcall target="testinit.checkFailedTestsOnly"/>
  </target>
 
 
 
  <!-- If we were asked to run only the tests that failed,
      then we overwrite the testng.xml that we just generated
      with testng-failed.xml, which TestNG generated. -->
  <target name="testinit.checkFailedTestsOnly" if="test.failures">
    <!-- Ensure that some of the tests failed last time. -->
    <available property="testng-failed.xml.exists"
               file="${unittest.report.dir}/testng-failed.xml"/>
    <fail message="No unit tests failed in the previous run."
          unless="testng-failed.xml.exists"/>
 
    <!-- We replace the 'Failed suite [OpenDS]' with 'OpenDS' so we
         don't end up with 'Failed suite [Failed suite [OpenDS]]]' etc. -->
    <replace file="${unittest.report.dir}/testng-failed.xml"
             token="Failed suite [OpenDS]"
             value="OpenDS"/>
    <replace file="${unittest.report.dir}/testng-failed.xml"
             token="default(failed)"
             value="default"/>
 
    <copy file="${unittest.report.dir}/testng-failed.xml"
          tofile="${unittest.resource.dir}/testng.xml"
          overwrite="true"/>
 
    <echo message="Will run the failed unit tests only"/>
  </target>
 
 
 
  <!-- Generate coverage diff report -->
  <target name="coveragediff">
    <condition property="test.diff.srcpath" value="">
      <not>
        <isset property="test.diff.srcpath" />
      </not>
    </condition>
 
    <condition property="test.diff.enabled" value="true">
      <not>
        <isset property="test.diff.disable" />
      </not>
    </condition>
 
    <condition property="test.diff.verbose" value="false">
      <not>
        <isset property="test.diff.verbose" />
      </not>
    </condition>
 
    <condition property="test.diff.enabled" value="false">
      <isset property="test.diff.disable" />
    </condition>
 
    <!-- The SVN revision to perform the diff against when calculating
         the coverage diff.  It can be a revision number, a timestamp,
         or a revision keyword (BASE, COMMITTED, and PREV make the
         most sense).  The primary use case for this setting is to do
         a coverage diff against the previous revision when there are
         no changes in the working copy.  It defaults to BASE.  -->
    <condition property="test.diff.from.revision" value="BASE">
      <not>
        <isset property="test.diff.from.revision" />
      </not>
    </condition>
 
    <mkdir dir="${cvgdiff.report.dir}" />
    <taskdef name="coveragediff" classname="org.opends.build.tools.CoverageDiff">
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${emma.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${svnkit.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <coveragediff emmadatapath="${coverage.data.dir}"
                  outputpath="${cvgdiff.report.dir}"
                  diffpath="${test.diff.srcpath}"
                  enabled="${test.diff.enabled}"
                  verbose="${test.diff.verbose}"
                  fromrevision="${test.diff.from.revision}" />
 
  </target>
 
 
 
  <!-- Execute the Directory Server TestNG unit tests in text mode. -->
  <target name="enableTestNGAssertions">
    <property name="TESTASSERT" value="true"/>
  </target>
 
 
 
  <!-- Execute Directory Server TestNG unit tests specified from CLI -->
  <target name="testcustom">
    <echo message="This target is deprecated. Please use the test target as it now supports the test.* properties." />
  </target>
 
 
 
  <!-- Execute all of the Directory Server TestNG unit tests in text mode. -->
  <target name="testall"
          depends="enableTestNGAssertions,prepdefaultalltest,testinit,runtests"
          description="Run all of the TestNG tests (including 'slow' ones) with assertions enabled.  See 'testwithcoverage' for properties you can set.">
  </target>
 
 
 
  <!-- Execute the Directory Server TestNG unit tests in text mode. -->
  <target name="test"
          depends="testinit,runtests"
          description="Execute the Directory Server TestNG unit tests in text mode.  Set '-Dorg.opends.test.suppressOutput=false' to see the output from the unit tests.  Set '-Dtest.failures=true' to run only the tests that failed previously.">
  </target>
 
  <!-- Display Java version which will be used for tests. -->
  <target name="displayjavaversion">
    <echo message="The following Java version will be used :"/>
    <echo message=""/>
    <exec executable="java">
      <arg value="-version"/>
    </exec>
    <echo message=""/>
    <echo message=""/>
  </target>
 
  <!-- Execute the Directory Server TestNG unit tests in text mode with a coverage report. -->
  <target name="testwithcoverage"
          depends="coverage,test,coveragediff"
          description="Execute the Directory Server TestNG unit tests in text mode with a coverage report.  Use -Dtest.packages, -Dtest.classes, or -Dtest.methods to control which unit tests are run.  Use -Dtest.diff.srcpath to control which src files show up in the coverage diff.  See the 'test' package for other properties you can set.">
  </target>
 
  <!-- Execute the Directory Server TestNG unit tests in text mode with a coverage report and slow tests. -->
  <target name="testallwithcoverage"
          depends="coverage,testall,coveragediff"
          description="The same as 'testwithcoverage' except 'testall' is run instead of 'test'.">
  </target>
 
  <!-- Execute the Directory Server TestNG unit tests specified from CLI in text mode with a coverage report. -->
  <target name="testcustomwithcoverage">
    <echo message="This target is deprecated. Please use the testwithcoverage target as it now supports the test.* properties." />
  </target>
 
  <target name="testhelp" unless="disable.test.help">
    <echo message="About to run the unit tests.  Ant options to control the tests:"/>
    <echo message=""/>
    <echo message="  -Dorg.opends.test.suppressOutput=false"/>
    <echo message="      writes the unit test output to the screen"/>
    <echo message=""/>
    <echo message="  -Dtest.progress=&quot;default,memory&quot;"/>
    <echo message="      Unless explicity disabled using -Dtest.progress=none, the"/>
    <echo message="      tests provide continuous progress of the tests that are being"/>
    <echo message="      run.  The specific options to set for this property are"/>
    <echo message=""/>
    <echo message="        none:         no progress output"/>
    <echo message="        all:          enables all progress (slows tests)"/>
    <echo message="        default:      same as &quot;time,count,restarts&quot;"/>
    <echo message="        time:         timing information for the tests"/>
    <echo message="        count:        # of run test classes, methods, and invocations"/>
    <echo message="        memory:       running total of memory usage (slows tests)"/>
    <echo message="        threadcount:  running total of active threads"/>
    <echo message="        threadchange: +/- changes for active threads between tests"/>
    <echo message="        restarts:     running total of in-core server restarts"/>
    <echo message=""/>
    <echo message="      To specifying multiple values, nseparate them with ',' and"/>
    <echo message="      quote the entire value.  For instance, when you want the default"/>
    <echo message="      output plus more, do -Dtest.progress=&quot;default,memory&quot;."/>
    <echo message=""/>
    <echo message="      Enabling memory progress slows down the tests significantly."/>
    <echo message="      Include the otherwise undocumented property &quot;gcs&quot; to see how"/>
    <echo message="      much time each progress line spends doing garbage collections"/>
    <echo message="      to get an accurate measure of memory usage."/>
    <echo message=""/>
    <echo message="      A new line of progress is written when TestNG completes running tests"/>
    <echo message="      for a class.  This progress is reported immediately before TestNG"/>
    <echo message="      starts to run the first test of the next class.  All @BeforeClass"/>
    <echo message="      and @BeforeMethod methods will have been invoked for the next"/>
    <echo message="      class as well as the @DataProvider (if any) for the first test method."/>
    <echo message="      Keep this in mind when debugging memory usage, running times, and"/>
    <echo message="      thread creation."/>
    <echo message=""/>
    <echo message="  -Dtestng.verbosity0to5=5"/>
    <echo message="      for example has TestNG dump the maximum amount of debugging"/>
    <echo message="      output to stdout.  This output is useful to check the order"/>
    <echo message="      in which test methods are invoked.  Valid values are integer"/>
    <echo message="      values from 0 (no output) to 5 (maximum output).  Since this"/>
    <echo message="      implicitly sets -Dorg.opends.test.suppressOutput=false,"/>
    <echo message="      other stderr/stdout output generated by the unit tests will"/>
    <echo message="      also be displayed."/>
    <echo message=""/>
    <echo message="  -Dorg.opends.test.pauseOnFailure=true"/>
    <echo message="      pauses the test suite whenever a failure occurs allowing you to inspect"/>
    <echo message="      the server more closely in the failure state"/>
    <echo message=""/>
    <echo message="  -Dorg.opends.test.copyClassesToTestPackage=true"/>
    <echo message="      copies the classes into the test server root.  This enables you to run"/>
    <echo message="      the server tools on the test server.  It can slow down the test startup"/>
    <echo message="      so the files are not copied by default."/>
    <echo message=""/>
    <echo message="  -Dtest.failed=true"/>
    <echo message="      runs only the tests that failed last time"/>
    <echo message=""/>
    <echo message="  -Dorg.opends.server.debug.target=org.opends.server.core:level=verbose,category=data"/>
    <echo message="      for example only include debug messages in the core"/>
    <echo message="      package that are related to data access and at the" />
    <echo message="      verbose level or higher. The syntax of this target" />
    <echo message="      definition is the same as the org.opends.server.debug.target.x" />
    <echo message="      property when starting ${SHORT_NAME}. " />
    <echo message="      Default debug target:"/>
    <echo message="      org.opends.server:level=warning,category=caught|data|database-access|message|protocol,stack,cause" />
    <echo message=""/>
    <echo message="  -Dtest.diff.srcpath=src/server/org/opends/server/core"/>
    <echo message="      for example includes only the classes in"/>
    <echo message="      src/server/org/opends/server/core in the coveragediff report."/>
    <echo message="      To list multiple directories or files, separate them with"/>
    <echo message="      a space as you would an argument list to 'svn diff' and quote"/>
    <echo message="      the whole value."/>
    <echo message=""/>
    <echo message="  -Dtest.groups=exclude=slow"/>
    <echo message="      for example excludes the slow tests.  Each value is expected" />
    <echo message="      group inclusion/exclusion clause which consists of either 'include'" />
    <echo message="      or 'exclude' followed by the '=' character and then a group name." />
    <echo message="      For multiple group clauses, separate them with a ',' and "/>
    <echo message="      quote the entire value. Debug logging is disabled."/>
    <echo message=""/>
    <echo message="  -Dtest.packages=org.opends.server.api"/>
    <echo message="      for example runs only the tests in the api package"/>
    <echo message="      For multiple packages, separate them with a ',' and "/>
    <echo message="      quote the entire value. Debug logging is disabled."/>
    <echo message=""/>
    <echo message="  -Dtest.classes=org.opends.server.types.TestDN"/>
    <echo message="      for example only runs the TestDN class"/>
    <echo message="      For multiple classes, separate them with a ',' and "/>
    <echo message="      quote the entire value. Debug logging is disabled."/>
    <echo message=""/>
    <echo message="  -Dtest.methods=org.opends.server.types.TestDN.testGetRDN"/>
    <echo message="      for example only runs the testGetRDN method"/>
    <echo message="      For multiple methods within the same class, append additional"/>
    <echo message="      method names to the end separating them with a ',' and "/>
    <echo message="      quote the entire value. Debug logging is disabled."/>
    <echo message=""/>
    <echo message="  -Dtest.remote.debug.port=5005"/>
    <echo message="      for example will allow you to remotely debug the unit tests from"/>
    <echo message="      the debugger of your choice by pointing it at port 5005."/>
    <echo message="      The unit tests will not start to run until the debugger is attached"/>
    <echo message="      unless you also specify -Dtest.remote.debug.suspend=n."/>
    <echo message=""/>
  </target>
 
 
 
  <!-- Internal target to execute the Directory Server TestNG unit tests in text mode after everything has been initialized. -->
  <target name="runtests">
    <antcall target="testhelp"/>
    <antcall target="displayjavaversion"/>
 
    <mkdir dir="${unittest.report.dir}" />
 
    <taskdef resource="testngtasks">
      <classpath>
        <fileset dir="${testng.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
 
    <!-- This sets TESTASSERT to false if and only if it's not already set. -->
    <condition property="TESTASSERT" value="false">
      <not>
        <isset property="TESTASSERT" />
      </not>
    </condition>
 
    <!-- This sets testng.verbosity if it's not already set. -->
    <condition property="testng.verbosity0to5" value="0">
      <not>
        <isset property="testng.verbosity0to5" />
      </not>
    </condition>
 
    <!-- This sets unsuppresses the test output if and only if testng
         is configured to dump debug output. -->
    <condition property="org.opends.test.suppressOutput" value="false">
      <not>
        <equals arg1="${testng.verbosity0to5}" arg2="0"/>
      </not>
    </condition>
 
    <!-- This sets org.opends.test.suppressOutput if and only if it's not
         already set. -->
    <condition property="org.opends.test.suppressOutput" value="true">
      <not>
        <isset property="org.opends.test.suppressOutput" />
      </not>
    </condition>
 
    <!-- This sets org.opends.test.pauseOnFailure if and only if it's not
         already set. -->
    <condition property="org.opends.test.pauseOnFailure" value="false">
      <not>
        <isset property="org.opends.test.pauseOnFailure" />
      </not>
    </condition>
 
    <!-- This sets org.opends.server.debug.target if and only if its's not
         already set. -->
    <condition property="org.opends.server.debug.target"
               value="org.opends.server:level=warning,category=caught|data|database-access|message|protocol,stack,cause">
      <not>
        <isset property="org.opends.server.debug.target" />
      </not>
    </condition>
 
    <condition property="org.opends.test.copyClassesToTestPackage"
               value="false">
      <not>
        <isset property="org.opends.test.copyClassesToTestPackage" />
      </not>
    </condition>
 
    <condition property="test.progress"
               value="">
      <not>
        <isset property="test.progress" />
      </not>
    </condition>
 
 
    <!-- If the debug port was set, we pass these options into the <testng> target below:
           -Xdebug
           -Xnoagent
           -Djava.compiler=NONE
           -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
     -->
    <condition property="test.remote.debug.suspend" value="y">
       <not>
         <isset property="test.remote.debug.suspend" />
       </not>
    </condition>
    <condition property="jvm.debug.arg1" value="-Xdebug" else="-Dopends.bogus.debug.arg1">
       <isset property="test.remote.debug.port" />
    </condition>
    <condition property="jvm.debug.arg2" value="-Xnoagent" else="-Dopends.bogus.debug.arg2">
       <isset property="test.remote.debug.port" />
    </condition>
    <condition property="jvm.debug.arg3" value="-Djava.compiler=NONE" else="-Dopends.bogus.debug.arg3">
       <isset property="test.remote.debug.port" />
    </condition>
    <condition property="jvm.debug.arg4"
         value="-Xrunjdwp:transport=dt_socket,server=y,suspend=${test.remote.debug.suspend},address=${test.remote.debug.port}"
         else="-Dopends.bogus.debug.arg4">
       <isset property="test.remote.debug.port" />
    </condition>
 
 
    <!-- Cleanout the old reports.  Otherwise, the old testng-failed.xml
         will hang around even if all of the tests pass. -->
    <delete>
      <fileset dir="${unittest.report.dir}" includes="*"/>
    </delete>
 
    <!-- Our testng listener will remove this file if all of the
         tests passed.  This allows us to generate the coverage
         report even if the tests failed and still fail the build. -->
    <touch file="${unittest.report.dir}/.tests-failed-marker"/>
 
    <testng outputdir="${unittest.report.dir}"
            haltonfailure="false"
            verbose="${testng.verbosity0to5}"
            enableAssert="${TESTASSERT}"
            listeners="org.opends.server.TestListener org.testng.reporters.FailedReporter"
            useDefaultListeners="false"
            suiteRunnerClass="org.opends.server.SuiteRunner">
      <classpath>
        <pathelement location="${coverage.instr.dir}" />
        <pathelement location="${classes.dir}" />
        <pathelement location="${quicksetup.classes.dir}" />
        <pathelement location="${unittest.classes.dir}" />
        <pathelement location="${resource.dir}" />
        <path refid="run.classpath" />
        <path refid="emma.lib" />
 
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
 
        <!-- Needed by quicksetup tests -->
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
 
        <fileset dir="${testng.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar"/>
        </fileset>
 
      </classpath>
      <jvmarg  value="-Demma.coverage.out.file=${coverage.data.dir}/unit.emma" />
      <jvmarg value="-Demma.coverage.out.merge=false" />
      <jvmarg value="-Dorg.opends.server.BuildRoot=${basedir}" />
      <jvmarg value="-Dorg.opends.server.BuildDir=${build.dir}" />
      <jvmarg value="-Dorg.opends.server.RunningUnitTests=true" />
      <jvmarg value="-Dorg.opends.server.snmp.opendmk=${opendmk.lib.dir}"/>
      <jvmarg value="-Dorg.opends.test.suppressOutput=${org.opends.test.suppressOutput}" />
      <jvmarg value="-Dorg.opends.test.pauseOnFailure=${org.opends.test.pauseOnFailure}" />
      <jvmarg value="-Dorg.opends.server.debug.target=${org.opends.server.debug.target}" />
      <jvmarg value="-Dorg.opends.test.copyClassesToTestPackage=${org.opends.test.copyClassesToTestPackage}" />
      <jvmarg value="-Dtest.progress=${test.progress}" />
      <jvmarg value="-Xms${MEM}" />
      <jvmarg value="-Xmx${MEM}" />
      <jvmarg value="${jvm.debug.arg1}" />
      <jvmarg value="${jvm.debug.arg2}" />
      <jvmarg value="${jvm.debug.arg3}" />
      <jvmarg value="${jvm.debug.arg4}" />
      <xmlfileset dir="${unittest.resource.dir}" includes="testng.xml" />
    </testng>
 
    <!-- Our testng listener will create this file if any of the
         tests failed.  This allows us to generate the coverage
         report even if the tests failed. -->
    <available property="testng.tests.failed"
               file="${unittest.report.dir}/.tests-failed-marker"/>
 
    <!-- Delete all of the report suite sub-directories since we only
         have a single suite. -->
    <delete dir="${unittest.report.dir}/${SHORT_NAME}"/>
 
    <emma enabled="${coverage.enabled}" >
      <report sourcepath="${src.dir}" >
        <fileset dir="${coverage.data.dir}" >
          <include name="unit.emma"     />
          <include name="metadata.emma" />
        </fileset>
 
        <txt  outfile="${coverage.report.dir}/coverage.txt" />
        <html outfile="${coverage.report.dir}/index.html" />
        <xml  outfile="${coverage.report.dir}/coverage.xml" />
      </report>
 
    </emma>
 
    <!-- We delay failing until after the coverage report is generated. -->
    <fail message="The unit tests failed." if="testng.tests.failed"/>
 
  </target>
 
 
 
  <target name="prepdefaultalltest">
    <condition property="test.groups" value="">
      <not>
        <or>
          <isset property="test.groups" />
          <isset property="test.packages" />
          <isset property="test.classes" />
          <isset property="test.methods" />
        </or>
      </not>
    </condition>
  </target>
 
 
 
  <target name="testreport"
        depends="test"
        description="Takes testng results and convert them into JUnit compatible xml">
    <junitreport todir="${unittest.report.dir}">
      <fileset dir="${unittest.report.dir}">
        <include name="*.xml"/>
      </fileset>
 
      <report format="noframes"  todir="${unittest.report.dir}"/>
    </junitreport>
  </target>
 
 
 
 
  <target name="buildtools" depends="init"
        description="Builds the build tools">
 
    <mkdir dir="${buildtools.classes.dir}" />
 
    <copy file="${resource.dir}/Messages.java.stub" todir="${buildtools.classes.dir}/org/opends/build/tools/resource"/>
 
    <javac srcdir="${src.dir}:${msg.src.dir}" destdir="${buildtools.classes.dir}"
           sourcepath=""
           includes="org/opends/messages/Severity.java,
                     org/opends/messages/Category.java,
                     org/opends/messages/Message.java,
                     org/opends/messages/MessagePropertyKey.java,
                     org/opends/messages/MessageDescriptor.java,
                     org/opends/server/types/PublicAPI.java,
                     org/opends/server/types/StabilityLevel.java"/>
 
 
    <javac srcdir="${buildtools.src.dir}" destdir="${buildtools.classes.dir}">
      <classpath>
        <fileset dir="${ant.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <fileset dir="${emma.dir}">
          <include name="*.jar" />
        </fileset>
 
        <fileset dir="${svnkit.dir}">
          <include name="*.jar" />
        </fileset>
 
        <path refid="run.classpath" />
      </classpath>
    </javac>
 
    <jar jarfile="${build.dir}/build-tools/build-tools.jar"
         basedir="${buildtools.classes.dir}" compress="true" index="true" />
  </target>
 
 
 
  <!-- Code generation for core administration components. -->
  <target name="compileadmin" depends="validateadmin" description="Code generation for configuration Object.">
    <!-- The XSLT task creates a lot of noise.
         I can't find any other way to shut it up. -->
 
    <condition property="antcmd" value="ant.bat">
      <os family="windows" />
    </condition>
 
    <condition property="antcmd" value="ant">
      <not>
        <isset property="antcmd" />
      </not>
    </condition>
 
    <exec executable="${ant.home}/bin/${antcmd}" failonerror="true">
      <arg value="-buildfile" />
      <arg value="${ant.file}" />
      <arg value="-Dbuild.dir=${build.dir}" />
      <arg value="-quiet" />
      <arg value="compileadminsubtask" />
      <env key="ANT_OPTS" value="-Xmx${MEM}" />
      <!-- Set classpath to workaround Apple JDK Xalan conflict -->
      <env key="CLASSPATH" value="${ext.dir}/xalan-j/xalan.jar" />
    </exec>
  </target>
 
 
 
  <target name="compileadminsubtask">
    <!-- Xalan-J Class Path : refer to it explicitly from each XSLT task. -->
    <path id="xalan.class.path">
      <fileset dir="${ext.dir}/xalan-j">
        <include name="*.jar" />
      </fileset>
    </path>
 
    <!-- Generate introspection API for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/metaMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.java" />
      <param name="base-dir" expression="${admin.defn.dir}" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/meta/package-info.java" />
      <param name="type" expression="meta" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <!-- Generate client API for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/clientMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/client/\2CfgClient.java" />
      <param name="base-dir" expression="${admin.defn.dir}" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/client/package-info.java" />
      <param name="type" expression="client" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <!-- Generate server API for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/serverMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/server/\2Cfg.java" />
      <param name="base-dir" expression="${admin.defn.dir}" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/server/package-info.java" />
      <param name="type" expression="server" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <!-- Generate LDAP profile for core administration components. -->
    <mkdir dir="${classes.dir}" />
    <xslt basedir="${admin.defn.dir}" destdir="${classes.dir}/admin/profiles/ldap" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/ldapMOProfile.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${admin.defn.dir}" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <!-- Generate CLI profile for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${classes.dir}/admin/profiles/cli" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/cliMOProfile.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${admin.defn.dir}" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <!-- Generate I18N messages for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${classes.dir}/admin/messages" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/messagesMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${admin.defn.dir}" />
      <classpath refid="xalan.class.path" />
    </xslt>
 
    <!-- Generate manifest file for core administration components. -->
    <tempfile property="admin.temp.dir" destDir="${build.dir}" prefix="tmp" />
    <mkdir dir="${admin.temp.dir}" />
    <xslt basedir="${admin.defn.dir}" destdir="${admin.temp.dir}" extension=".manifest" includes="**/*Configuration.xml"
          style="${admin.rules.dir}/manifestMO.xsl">
      <classpath refid="xalan.class.path" />
    </xslt>
    <concat destfile="${classes.dir}/admin/core.manifest">
      <fileset dir="${admin.temp.dir}" includes="**/*.manifest" />
    </concat>
    <delete dir="${admin.temp.dir}" />
  </target>
 
 
 
  <!-- Remove all dynamically-generated build files. -->
  <target name="cleanadmin" if="isadmingendirpresent" description="Clean up any generated source files for admin">
    <delete includeemptydirs="true">
      <fileset dir="${admin.src.dir}" includes="**/*" />
    </delete>
  </target>
 
  <!-- Validate core administration component XML definition files. -->
  <target name="validateadmin" description="Validate core administration component XML definition files.">
    <schemavalidate>
      <fileset dir="${admin.defn.dir}" includes="**/*.xml" />
      <schema namespace="http://www.opends.org/admin" file="${admin.rules.dir}/admin.xsd"/>
      <schema namespace="http://www.opends.org/admin-ldap" file="${admin.rules.dir}/admin-ldap.xsd"/>
      <schema namespace="http://www.opends.org/admin-cli" file="${admin.rules.dir}/admin-cli.xsd"/>
    </schemavalidate>
  </target>
 
  <!-- Remove all dynamically-generated build files. -->
  <target name="cleanmessages" if="ismsggendirpresent" description="Clean up any generated source files for messages">
    <delete includeemptydirs="true">
      <fileset dir="${msg.javagen.dir}" includes="**/*" />
    </delete>
  </target>
 
  <!-- Generate a src.zip file containing all the server source. -->
  <target name="srczip" depends="compileadmin"
       description="Generate a src.zip file with all the server source.">
    <zip destfile="${build.dir}/src.zip">
      <zipfileset dir="${src.dir}" excludes="**/.svn" filemode="644"
           dirmode="755" />
      <zipfileset dir="${admin.src.dir}" excludes="**/.svn" filemode="644"
           dirmode="755" />
      <zipfileset dir="${ads.src.dir}" excludes="**/.svn" filemode="644"
           dirmode="755" />
      <zipfileset dir="${quicksetup.src.dir}" excludes="**/.svn" filemode="644"
           dirmode="755" />
      <zipfileset dir="${guitools.src.dir}" excludes="**/.svn" filemode="644"
           dirmode="755" />
    </zip>
  </target>
 
 
 
  <!-- Generate example plugin package. -->
  <target name="example-plugin" if="pdir">
    <!-- Create folder hierarchy in temporary directory. -->
    <tempfile property="plugin.temp.dir" destDir="${build.dir}" prefix="tmp"/>
    <mkdir dir="${plugin.temp.dir}/example-plugin" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/src" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/src-generated" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/lib" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/ext" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/admin" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/config" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/schema" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/messages" />
    <copy todir="${plugin.temp.dir}/example-plugin/src">
      <fileset dir="${admin.defn.dir}" includes="**/*.xml" />
    </copy>
    <copy todir="${plugin.temp.dir}/example-plugin/resource/admin">
      <fileset dir="${admin.rules.dir}" excludes="example-plugin/**" />
    </copy>
    <copy todir="${plugin.temp.dir}/example-plugin" file="${admin.rules.dir}/example-plugin/build.xml" />
    <copy todir="${plugin.temp.dir}/example-plugin" file="${admin.rules.dir}/example-plugin/README" />
    <copy todir="${plugin.temp.dir}/example-plugin/resource/schema" file="${admin.rules.dir}/example-plugin/99-example-plugin.ldif" />
    <copy todir="${plugin.temp.dir}/example-plugin/resource/config" file="${admin.rules.dir}/example-plugin/example-plugin.ldif" />
    <copy todir="${plugin.temp.dir}/example-plugin/src/com/example/opends">
      <fileset dir="${admin.rules.dir}/example-plugin" includes="*.java,*.xml" excludes="build.xml" />
    </copy>
    <copy todir="${plugin.temp.dir}/example-plugin/lib" file="${build.dir}/build-tools/build-tools.jar" />
    <copy todir="${plugin.temp.dir}/example-plugin/resource/messages/com/example/opends/messages" file="${admin.rules.dir}/example-plugin/example_plugin.properties" />
    <copy todir="${plugin.temp.dir}/example-plugin/resource/messages/com/example/opends/messages" file="${admin.rules.dir}/example-plugin/example_plugin_fr.properties" />
    <!-- Package up the plugin in the OpenDJ package folder. -->
    <zip destfile="${pdir}/example-plugin.zip">
      <zipfileset dir="${plugin.temp.dir}" filemode="644" dirmode="755" />
    </zip>
    <delete dir="${plugin.temp.dir}" />
  </target>
 
  <target name="snmpmessagebuild" if="isopendmkpresent">
      <echo message="SNMP extension will be built and included in the delivery."/>
      <echo message="OpenDMK jar file location is ${opendmk.lib.dir}/jdmkrt.jar"/>
  </target>
 
  <target name="snmpmessageNotbuild" unless="isopendmkpresent">
      <echo message="Building without SNMP extension."/>
      <echo message="To build with SNMP extension set opendmk.lib.dir build property"/>
      <echo message="to indicate the location of the OpenDMK jar files. OpenDMK jars"/>
      <echo message="can be found at OpenDMK project at https://opendmk.dev.java.net"/>
  </target>
 
  <target name="snmpecho" depends="snmpmessageNotbuild,snmpmessagebuild"/>
 
  <!-- SNMP targets -->
  <target name="cleansnmp" description="Clean up any SNMP generated source files">
    <delete includeemptydirs="true" failonerror="false">
      <fileset dir="${snmp.gen.dir}" includes="**/*" />
    </delete>
  </target>
 
  <target name="mibgeneration" if="isopendmkpresent" description="mibgen invocation">
    <property name="opendmktk.path" location="${opendmk.lib.dir}/jdmktk.jar"/>
    <mkdir dir="${snmp.gen.dir}/org/opends/server/snmp" />
    <exec dir="${snmp.mib.dir}" executable="java">
      <arg line="-classpath ${opendmktk.path}
        com.sun.jdmk.tools.MibGen -X:use-display-hint
        -d &quot;${snmp.gen.dir}/org/opends/server/snmp&quot; -mc -desc
        -tp org.opends.server.snmp &quot;${snmp.mib.dir}/rfc2605.txt&quot;
        &quot;${snmp.mib.dir}/mib_core.txt&quot;
        &quot;${snmp.mib.dir}/rfc2021.txt&quot; &quot;${snmp.mib.dir}/rfc2788.txt&quot;"/>
    </exec>
  </target>
 
   <target name="compilesnmp"
       depends="mibgeneration"
       if="isopendmkpresent"
       description="Compile the SNMP Connection Handler extension source files.">
 
    <mkdir dir="${classes.dir}" />
 
    <javac srcdir="${snmp.gen.dir}" destdir="${classes.dir}" >
      <compilerarg value="-Xlint:-serial" />
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
 
     <javac srcdir="${snmp.src.dir}" destdir="${classes.dir}">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
  </target>
 
 
  <!-- Package the SNMP Directory Server extension for distribution. -->
  <target name="package-snmp" if="isopendmkpresent" depends="snmpecho,compilesnmp"
          description="Package the SNMP Directory Server extension for distribution.">
    <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
    <mkdir dir="${pdir}/lib/extensions" />
    <mkdir dir="${pdir}/snmp/mib"/>
    <mkdir dir="${pdir}/config/snmp/security" />
    <!-- Copy security template files -->
    <copy todir="${pdir}/config/snmp/security">
      <fileset dir="${snmp.security.dir}"/>
    </copy>
    <!-- Copy the mib -->
    <copy todir="${pdir}/snmp/mib" file="${snmp.mib.dir}/rfc2605.txt"/>
 
    <!-- Update the config.ldif file with snmp config -->
    <concat destfile="${pdir}/config/config.ldif" append="true">
        <filelist dir="${snmp.config.dir}" files="config.snmp.ldif"/>
    </concat>
 
    <!-- Create the jar file -->
    <jar jarfile="${pdir}/lib/extensions/snmp-mib2605.jar"
         basedir="${classes.dir}"
         includes="org/opends/server/snmp/**"
         compress="true" index="true" >
      <manifest>
        <attribute name="Extension-Name" value="snmp-mib2605"/>
        <attribute name="Implementation-Version" value="${VERSION_NUMBER_STRING}"/>
        <attribute name="Revision-Number" value="${REVISION_NUMBER}"/>
      </manifest>
    </jar>
    <!-- Add admin/extension.manifest into the extension jar file -->
    <jar jarfile="${pdir}/lib/extensions/snmp-mib2605.jar"
         basedir="${snmp.resource.dir}"
         includes="admin/**"
         compress="true" index="true" update="yes">
    </jar>
    <echo message="SNMP Extension is built"/>
    <echo message="${pdir}/lib/extensions/snmp-mib2605.jar"/>
  </target>
 
  <target name="testsnmpinit" if="isopendmkpresent" depends="init">
    <!-- Compile the SNMP test cases -->
    <mkdir dir="${unittest.classes.dir}" />
    <javac srcdir="${unittest.testng.src.dir}" destdir="${unittest.classes.dir}"
           includes="org/opends/server/snmp/**">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="**/*.jar" />
        </fileset>
 
        <fileset dir="${testng.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar" />
        </fileset>
 
        <path refid="run.classpath" />
        <path refid="quickSetup.classpath" />
      </classpath>
    </javac>
  </target>
 
  <!-- ==============
  IVY TARGETS
  =================== -->
 
  <target name="check-ivy-installed">
    <available file="${ivy.jar.file}" property="ivy-installed"/>
  </target>
 
  <target name="download-ivy" depends="check-ivy-installed" unless="ivy-installed">
    <mkdir dir="${ext.dir}"/>
    <!-- download Ivy from web site so that it can be used even without any special installation -->
    <echo message="installing ivy..."/>
    <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
  </target>
 
  <target name="install-ivy" depends="download-ivy" description="--> install ivy">
    <!-- try to load ivy here from local ivy dir, in case the user has not already dropped
    it into ant's lib dir (note that the latter copy will always take precedence).
    We will not fail as long as local lib dir exists (it may be empty) and
    ivy is in at least one of ant's lib dir or the local lib dir. -->
    <path id="ivy.lib.path">
      <fileset dir="${ext.dir}" includes="*.jar"/>
    </path>
    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
  </target>
 
  <target name="resolve" depends="install-ivy" description="--> retrieve dependencies with ivy">
    <ivy:retrieve pattern="${lib.dir}/[type]/[artifact].[ext]"/>
  </target>
 
  <target name="cleanlib" description="--> clean the lib directory">
    <delete>
      <fileset dir="${lib.dir}">
        <include name="**/*.jar" />
      </fileset>
    </delete>
  </target>
  
  <target name="clean-ivy" description="--> clean the ivy installation">
    <delete file="${ivy.jar.file}"/>
  </target>
 
  <target name="clean-ivy-cache" depends="install-ivy" description="--> clean the ivy cache">
    <ivy:cleancache/>
  </target>
 
 
  <import file="build-svr4.xml"/>
  <import file="build-pkg.xml"/>
</project>