summaryrefslogtreecommitdiffstats
path: root/build/build.xml
blob: 76e6461e221f2d82559e386547bbc443e6104549 (plain)
1
2
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.jgit.junit.http
Bundle-Version: 4.1.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.servlet;version="[2.5.0,3.2.0)",
 javax.servlet.http;version="[2.5.0,3.2.0)",
 org.apache.commons.logging;version="[1.1.1,2.0.0)",
 org.eclipse.jetty.http;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.security;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.security.authentication;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.server;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.server.handler;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.server.nio;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.servlet;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.util.component;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.util.log;version="[9.0.0,10.0.0)",
 org.eclipse.jetty.util.security;version="[9.0.0,10.0.0)",
 org.eclipse.jgit.errors;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.http.server;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.internal.storage.file;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.junit;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.lib;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.revwalk;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.transport;version="[4.1.0,4.2.0)",
 org.eclipse.jgit.transport.resolver;version="[4.1.0,4.2.0)",
 org.junit;version="[4.0.0,5.0.0)"
Export-Package: org.eclipse.jgit.junit.http;version="4.1.0";
  uses:="org.eclipse.jgit.transport,
   org.eclipse.jgit.junit,
   javax.servlet.http,
   org.eclipse.jgit.lib,
   org.eclipse.jgit.revwalk,
   org.eclipse.jetty.server.handler,
   javax.servlet,
   org.eclipse.jetty.server,
   org.eclipse.jetty.util.log,
   org.eclipse.jetty.servlet"
href='#n236'>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
<?xml version="1.0"?>

<project xmlns:antcontrib="antlib:net.sf.antcontrib"
         xmlns:artifact="antlib:org.apache.maven.artifact.ant"
         xmlns:ivy="antlib:org.apache.ivy.ant"
         name="Vaadin"
         basedir="../" default="package-all">

	<property name="project.root" value="."/>
    <!-- Import common targets  -->
    <import file="./common.xml" />

    <!--Call one of package-* targets unless you understand what you are doing. -->
    <target name="package-all" depends="clean-all, init, build, javadoc, internal-package-war, internal-package-liferay, differences" description="Build public packages.">
    </target>

    <target name="package-jar" depends="clean-result, init, vaadin.jar" description="Create vaadin-x.y.z.jar file.">
    </target>

    <target name="package-war" depends="clean-result, init, build, javadoc, internal-package-war, differences">
    </target>

    <target name="package-liferay-zip" depends="clean-result, init, build, internal-package-liferay">
    </target>
	
    <target name="init-deps" depends="common.init-deps" >
        <property name="ivy.resolved" value="1" />
    	
        <ivy:resolve file="build/ivy/ivy.xml" resolveid="common" conf="ss.compile, cs.compile, ss.test.compile"/>
        <ivy:cachepath pathid="ivy.compile.classpath.server" conf="ss.compile"/>
        <ivy:cachepath pathid="ivy.compile.classpath.shared" conf="ss.compile"/>
        <ivy:cachepath pathid="ivy.compile.classpath.client" conf="cs.compile"/>
        <ivy:cachepath pathid="ivy.compile.classpath.client-compiler" conf="cs.compile"/>
        <ivy:cachepath pathid="ivy.compile.classpath.server-tests" conf="ss.test.compile"/>

        <ivy:cachepath pathid="buildhelpers.dependencies" resolveId="buildhelpers" conf="compile" file="build/ivy/buildhelpers-ivy.xml"/>        

    	<!-- Extra JARs for custom builds - taken into account before JARs from Ivy. -->
    	<!-- Note that this should not be used for permanent build dependencies. -->
        <path id="additional.jar.path">
            <fileset dir="build" includes="lib/**/*.jar" ></fileset>
        </path>

    	<!-- Default location for GWT check-out: trunk and tools in a directory next to Vaadin project -->
    	<property name="gwt.root" value="${basedir}/../trunk"/>

    	<property name="gwt.build.dir" value="${gwt.root}/build"/>
    	<property name="gwt.tools" value="${gwt.root}/../tools"/>
    	<property name="gwt.tools.lib" value="${gwt.tools}/lib"/>
    	<property name="gwt.lib.dir" value="${gwt.build.dir}/lib"/>
    	
    	<property name="gwt.user.jar" value="${gwt.lib.dir}/gwt-user.jar"/>
    	<property name="gwt.dev.jar" value="${gwt.lib.dir}/gwt-dev.jar"/>
    	<property name="gwt.codeserver.jar" value="${gwt.lib.dir}/gwt-codeserver.jar"/>
    	<property name="gwt.elemental.jar" value="${gwt.lib.dir}/gwt-elemental.jar"/>

    	<property name="gwt.user.dir" value="${gwt.root}/user"/>
    	<property name="gwt.user.bin" value="${gwt.build.dir}/out/user/bin"/>

    	<property name="jarjar-jar" value="${gwt.tools.lib}/tonicsystems/jarjar-1.0rc8.jar"/>

        <path id="compile.classpath.server">
            <path refid="additional.jar.path" />
            <path refid="ivy.compile.classpath.server" />
        </path>
        <path id="compile.classpath.shared">
            <path refid="additional.jar.path" />
            <path refid="ivy.compile.classpath.shared" />
        </path>
    	<path id="compile.classpath.client">
            <path refid="additional.jar.path" />
        	<!-- GWT -->
            <pathelement location="${gwt.user.jar}" />
            <pathelement location="${gwt.dev.jar}" />

        	<path refid="ivy.compile.classpath.client" />
        </path>
    	<path id="compile.classpath.client-compiler">
            <path refid="additional.jar.path" />
        	<!-- GWT -->
            <pathelement location="${gwt.user.jar}" />
            <pathelement location="${gwt.dev.jar}" />

        	<path refid="ivy.compile.classpath.client-compiler" />
        </path>
        <path id="compile.classpath.server-tests">
            <path refid="additional.jar.path" />

        	<!-- GWT -->
            <pathelement location="${gwt.user.jar}" />
        	<!-- needed at least for Apache Commons -->
            <pathelement location="${gwt.dev.jar}" />

            <path refid="ivy.compile.classpath.server-tests" />
        </path>

    	<path id="compile.classpath.buildhelpers">
            <path refid="additional.jar.path" />

        	<!-- GWT -->
            <pathelement location="${gwt.user.jar}" />
            <pathelement location="${gwt.dev.jar}" />

            <path refid="buildhelpers.dependencies" />
        </path>
    </target>

    <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <target name="clean-result" depends="build.properties">

        <!-- Clean build result directory. -->
        <delete dir="${result-path}" includes="**/*" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false"/>
    </target>

	<target name="build.properties" depends="init-deps">
        <property file="build/build.properties" />
		
        <property file="build/VERSION.properties" />
        <property file="build/GWT-VERSION.properties" />

		<!-- result source and classes folders -->
		<property name="result-src-server" value="${result-path}/src/server"/>
		<property name="result-src-client" value="${result-path}/src/client"/>
		<property name="result-src-client-compiler" value="${result-path}/src/client-compiler"/>
		<property name="result-src-shared" value="${result-path}/src/shared"/>
		<property name="result-src-junit" value="${result-path}/src/junit"/>
		<property name="result-src-testbench" value="${result-path}/src/testbench"/>
		<property name="result-src-sass" value="${result-path}/src/sass"/>
		<property name="result-src-sass-junit" value="${result-path}/src/sass-junit"/>
		<property name="result-classes-server" value="${result-path}/classes/server"/>
		<property name="result-classes-client" value="${result-path}/classes/client"/>
		<property name="result-classes-client-compiler" value="${result-path}/classes/client-compiler"/>
		<property name="result-classes-shared" value="${result-path}/classes/shared"/>
		<property name="result-classes-junit" value="${result-path}/classes/junit"/>
		<property name="result-classes-testbench" value="${result-path}/classes/testbench"/>
		<property name="result-classes-sass" value="${result-path}/classes/sass"/>
		<property name="result-classes-sass-junit" value="${result-path}/classes/sass-junit"/>
		<property name="result-precompiled-widgetsets" value="${result-path}/classes/widgetsets"/>

		<!-- Default classpath for building widgetsets, overridden for testing widgetset -->
		<path id="compile.classpath.widgetset">
			<path refid="compile.classpath.client" />
			<!-- Needed to resolve classes which @Connect refers to -->
			<pathelement location="${result-src-server}" />
			<!-- Needed to resolve imports in connector classes -->
			<pathelement location="${result-classes-server}" />

			<!-- The actual sources we want to compile -->
			<pathelement location="${result-src-client}" />
			<pathelement location="${result-src-shared}" />
			<!-- Contains compiled generators -->
			<pathelement location="${result-classes-client-compiler}" />
			<!-- Generators depend on shared and client interfaces -->
			<pathelement location="${result-classes-shared}" />
			<pathelement location="${result-classes-client}" />
			
			<pathelement location="${result-precompiled-widgetsets}" />
		</path>
	</target>
    <target name="clean-all" depends="clean-result">
		<delete failonerror="false">
			<fileset dir="${com.vaadin.testbench.screenshot.directory}/errors">
				<include name="*.png" />
			</fileset>
		</delete>
		<delete failonerror="false" dir="WebContent/VAADIN/gwt-unitCache" />
    </target>

    <!-- ================================================================== -->
    <!-- Check versions.                                                    -->
    <!-- ================================================================== -->

    <!-- Java compiler version. -->
    <target name="check-java-version">
      <condition property="java.version.matches">
        <or>
          <equals arg1="${ant.java.version}" arg2="${required.java.version}"/>
          <isset property="ignoreversion"/>
        </or>
      </condition>
      <fail unless="java.version.matches" message="Java version is ${ant.java.version}, but Vaadin must be compiled with genuine Java ${required.java.version} compiler. Use -Dignoreversion=1 for ant to ignore the version check."/>
      <echo>Java version is ${ant.java.version} as required.</echo>
    </target>

    <!-- ================================================================== -->
    <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- ================================================================== -->

     <target name="init" depends="init-deps, build.properties, check-java-version">
        <!-- Current timestamp in different formats. -->
        <tstamp>
            <format property="build.date" pattern="yyyy-MM-dd"/>
        </tstamp>
        <tstamp>
            <format property="build.date.compact" pattern="yyyyMMdd"/>
        </tstamp>

        <antcontrib:propertyregex property="version.major" input="${version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\1"/>
        <antcontrib:propertyregex property="version.minor" input="${version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\2"/>
        <antcontrib:propertyregex property="version.revision" input="${version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\3"/>

        <!-- Default full version name. -->
        <!-- Nightly and other TeamCity builds will define their own. -->
        <property name="version.full" value="${version}.dev-${build.date.compact}"/>
        <echo>Base Version: ${version}</echo>
        <echo>Full Version: ${version.full}</echo>

        <!-- Other properties -->
        <property file="build/html-style.properties" />

        <echo>Vaadin package is: ${vaadin-package}</echo>

        <!-- Create result dir unless already exists -->
        <mkdir dir="${result-path}" />

        <echo>We are using gwt version ${gwt-version}.</echo>

        <!-- Destination files -->
        <property name="base-name" value="${product-file}-${version.full}" />
        <property name="lib-jar-name" value="${base-name}.jar" />
        <property name="lib-sources-jar-name" value="${base-name}-sources.jar" />
        <property name="lib-javadoc-jar-name" value="${base-name}-javadoc.jar" />
        <property name="test-war-filename" value="${product-file}-tests-${version.full}.war"/>

        <echo message="Prepared to build ${product-file} version ${version.full} packages" />

        <!-- Output directory -->
        <property name="output-dir" value="${result-path}/${base-name}" />
        <mkdir dir="${output-dir}" />

        <!-- Where widgetsets are written to.                             -->
        <!-- When not building a package, widgetsets should be written to -->
        <!-- WebContent/VAADIN/widgetsets, which needs to be set in       -->
        <!-- init-nonpackage target before calling this main init target. -->
        <property name="widgetsets-output-dir" value="${output-dir}/WebContent/VAADIN/widgetsets" />
        
     	<!-- Build helpers -->
     	<property name="buildhelpers-src" value="build/buildhelpers" />
     	<property name="buildhelpers-classes" value="${result-path}/buildhelpers/classes" />

     	<!-- Sass -->
     	<property name="sass-src" value="sass/src" />
     	<property name="sass-classes" value="${result-classes-sass}" />

     	<!-- Create Output Directory Hierarchy -->
        <mkdir dir="${output-dir}/WebContent" />
        <mkdir dir="${output-dir}/WebContent/demo" />
        <mkdir dir="${output-dir}/WebContent/docs" />
        <mkdir dir="${output-dir}/WebContent/docs/api" />
        <mkdir dir="${output-dir}/WebContent/tests" />
        <mkdir dir="${output-dir}/WebContent/WEB-INF" />
        <mkdir dir="${output-dir}/WebContent/WEB-INF/lib" />
        <mkdir dir="${output-dir}/WebContent/WEB-INF/classes" />
    </target>

    <target name="internal-package-war">
        <echo>Building Test WAR</echo>

        <echo>Adding test class files and resources and launcher configuration.</echo>
        <copy todir="${output-dir}/WebContent/WEB-INF/classes">
            <fileset dir="${result-classes-testbench}">
                <include name="${vaadin-package}/tests/**/*" />
                <include name="${vaadin-package}/launcher/**" />
            </fileset>
            <fileset dir="${result-classes-junit}">
            	<!-- VaadinClasses and data classes are used by TestBench tests also -->
            </fileset>
            <!-- test resources -->
            <fileset dir="tests/testbench">
                <include name="${vaadin-package}/tests/**/*" />
                <!-- Pre-processed versions of these copied above -->
                <exclude name="**/*.java" />
                <exclude name="**/*.html" />
                <exclude name="**/*.css" />
                <exclude name="**/*.xml" />
            </fileset>

        	<!-- Include files required by the DemoLauncher/DevelopmentServerLauncher -->
            <fileset dir="tests/testbench">
        		<include name="${vaadin-package}/launcher/jetty-webdefault.xml" />
        		<include name="${vaadin-package}/launcher/keystore" />
            </fileset>
        </copy>

        <war warfile="${result-path}/${test-war-filename}"> 
            <fileset dir="${output-dir}/WebContent">
            	<exclude name="VAADIN/gwt-unitCache" />
                <!-- Already in JAR -->
            	<!-- Not excluded because used from WAR by portal integration tests
                <exclude name="VAADIN/themes/base/**/*" />
                <exclude name="VAADIN/themes/chameleon/**/*" />
                <exclude name="VAADIN/themes/liferay/**/*" />
                <exclude name="VAADIN/themes/reindeer/**/*" />
                <exclude name="VAADIN/themes/runo/**/*" />
                <exclude name="VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/**/*" />
                -->

                <!-- Not needed for testing -->
                <exclude name="docs/**/*" />
                <exclude name="docs" />
                
                <include name="**/*" />
            </fileset>
        </war>
    </target>

    <target name="internal-package-liferay" depends="internal-package-war">
        <!-- We assume the needed files are put in place by internal-package-war -->
        <echo>Building Liferay zip</echo>

        <zip zipfile="${result-path}/${base-name}-liferay.zip">
            <zipfileset prefix="VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidgetSet" dir="${output-dir}/WebContent/VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidgetSet">
                <patternset>
                    <include name="**/*" />
                </patternset>
            </zipfileset>
            <zipfileset prefix="VAADIN/themes" dir="${output-dir}/WebContent/VAADIN/themes">
                <patternset>
                    <include name="base/**/*" />
                    <include name="chameleon/**/*" />
                    <include name="liferay/**/*" />
                    <include name="runo/**/*" />
                    <include name="reindeer/**/*" />
                </patternset>
            </zipfileset>
            <zipfileset prefix="VAADIN" dir="${output-dir}/WebContent/VAADIN">
                <patternset>
                    <include name="vaadinBootstrap.js" />
                </patternset>
            </zipfileset>
        </zip>
        
        <echo>##teamcity[publishArtifacts '${result-path}/${base-name}-liferay.zip']</echo>
    </target>

    <!-- Build server-side, client-side, libraries, and tests.                   -->
    <!-- The client-side needs to be built before vaadin.jar, because the vaadin.jar -->
    <!-- require the default widgetset and doing otherwise would build it twice. -->
    <!-- However, since compiling the server-side is required by the client-side -->
    <!-- compilation, the server-side will actually be built before it.          -->
    <target name="build"
            depends="compile-server-side, compile-tests, compile-client-side, vaadin.jar, vaadin-sources.jar"
            description="Build package required files, without packing them.">
    </target>

    <target name="compile-server-side" depends="compile-gwt, compile-server, compile-client, webcontent"/>

    <!-- Copy and preprocess sources for packaging 
    NOTE: Replaces <version></version> tags with build version tag for some "textual" files
    -->
    <target name="preprocess-src">
        <!--
        Source directories in the project are
         * src (Vaadin core)
         * sass/src (SASS compiler)
         * tests/testbench (TestBench test cases)
         * tests/server-side (Server-side JUnit test cases)
         * tests/client-side (Client-side JUnit test cases)

        These are copied to 
         * ${result-path}/src/core
         * ${result-path}/src/sass
         * ${result-path}/src/tests
         * ${result-path}/src/junit

        And compiled to 
         * ${result-path}/classes/core
         * ${result-path}/classes/sass
         * ${result-path}/classes/tests
         * ${result-path}/classes/junit
         
        Java/HTML/CSS/XML files are filtered so the license is added and the version is set. 
        Other files are just copied.
        -->
        
        <loadfile property="VaadinApache2LicenseForJavaFiles" srcFile="build/VaadinApache2LicenseForJavaFiles.txt" />
        
        <mkdir dir="${result-path}/src" />
        <mkdir dir="${result-src-sass}/src" />
        <mkdir dir="${result-src-server}" />
        <mkdir dir="${result-src-client}" />
        <mkdir dir="${result-src-client-compiler}" />
        <mkdir dir="${result-src-shared}" />
        <mkdir dir="${result-src-testbench}" />
        <mkdir dir="${result-src-junit}" />
        <mkdir dir="${result-src-sass-junit}" />

        <patternset id="preprocessable-files">
            <include name="**/*.java" />
            <include name="**/*.html" />
            <include name="**/*.css" />
            <include name="**/*.xml" />
        </patternset>
        <patternset id="non-preprocessable-files">
            <exclude name="**/.svn" />
            <exclude name="**/*.java" />
            <exclude name="**/*.html" />
            <exclude name="**/*.css" />
            <exclude name="**/*.xml" />
        </patternset>
        <filterset id="version-and-license">
            <filter token="VaadinApache2LicenseForJavaFiles" value="${VaadinApache2LicenseForJavaFiles}" />
            <filter token="VERSION" value="${version.full}" />
        </filterset>
        
        <!-- Adds a style class to JavaDoc <pre> tags for style customization. -->
        <filterset id="pre-css-style" begintoken="     * &lt;" endtoken="&gt;">
            <filter token="pre" value="     * &lt;pre class='code'&gt;" />
        </filterset>

        <echo>Copying src directory and processing copied files.</echo>
        <echo>Replacing &lt;version&gt; tag with build version for java/html/css/xml files.</echo>
        <copy todir="${result-src-server}" overwrite="yes">
            <filterset refid="version-and-license"/>
            <filterset refid="pre-css-style"/>
            <fileset dir="server/src">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-shared}" overwrite="yes">
            <filterset refid="version-and-license"/>
            <filterset refid="pre-css-style"/>
            <fileset dir="shared/src">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-client}" overwrite="yes">
            <filterset refid="version-and-license"/>
            <filterset refid="pre-css-style"/>
            <fileset dir="client/src">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-client-compiler}" overwrite="yes">
            <filterset refid="version-and-license"/>
            <filterset refid="pre-css-style"/>
            <fileset dir="client-compiler/src">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>

        <copy todir="${result-src-sass}" overwrite="yes">
            <filterset refid="version-and-license"/>
            <filterset refid="pre-css-style"/>
            <fileset dir="sass/src">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>

        <copy todir="${result-src-testbench}">
            <filterset refid="version-and-license"/>
            <fileset dir="tests/testbench">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-junit}">
            <filterset refid="version-and-license"/>
            <fileset dir="tests/server-side">
                <patternset refid="preprocessable-files" />
            </fileset>
            <fileset dir="tests/client-side">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-sass-junit}">
            <filterset refid="version-and-license"/>
            <fileset dir="tests/sass/src">
                <patternset refid="preprocessable-files" />
            </fileset>
        </copy>
                
        <!-- Add other files such as images, these are not filtered or processed by fixcrlf task -->
        <echo>Copying non java/html/css/xml files such as images.</echo>
        <copy todir="${result-src-server}">
            <fileset dir="server/src">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>
        	
        <copy todir="${result-src-shared}">
            <fileset dir="shared/src">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>
        	
        <copy todir="${result-src-client}">
            <fileset dir="client/src">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>

    	<copy todir="${result-src-client-compiler}">
            <fileset dir="client-compiler/src">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>
        	
        <copy todir="${result-src-sass}">
            <fileset dir="${sass-src}">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-testbench}">
            <fileset dir="tests/testbench">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-junit}">
            <fileset dir="tests/server-side">
                <patternset refid="non-preprocessable-files" />
            </fileset>
            <fileset dir="tests/client-side">
                <patternset refid="non-preprocessable-files" />
            </fileset>
        </copy>
        <copy todir="${result-src-sass-junit}">
            <fileset dir="tests/sass/src">
                <patternset refid="non-preprocessable-files" />
            </fileset>
            <fileset dir="tests/sass/resources">
            	<!-- test resources (files to compile and compare etc.) -->
            </fileset>
        </copy>

    </target>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  WebContent
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <target name="webcontent" depends="preprocess-src,defaulttheme">

        <!-- Add WebContent -->
        <echo>Adding VAADIN/themes and META-INF</echo>
        <copy todir="${output-dir}/WebContent">
            <fileset dir="WebContent">
                <exclude name="**/.svn" />
                <include name="WEB-INF/lib/hsqldb.jar" />
                <include name="VAADIN/themes/**/*" />
            	<include name="VAADIN/vaadinBootstrap.js" />
                <include name="META-INF/**/*" />
            </fileset>
        </copy>

    	<!-- Add test files to be included in test war -->
        <copy todir="${output-dir}/WebContent">
            <fileset dir="WebContent">
                <include name="statictestfiles/**" />
            </fileset>
        </copy>

        <!-- Add servlet and portlet configuration files from WebContent -->
        <copy todir="${output-dir}/WebContent/WEB-INF">
            <fileset dir="WebContent/WEB-INF">
                <include name="liferay-*.xml" />
                <include name="portlet.xml" />
                <include name="web.xml" />
            </fileset>
        </copy>
        
        <!-- These should go to various JARs -->
        <copy todir="${output-dir}/WebContent">
            <filterchain>
                <expandproperties />
                <replacetokens begintoken="@" endtoken="@">
                    <token key="version" value="${version.full}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="version-minor" value="${version.major}.${version.minor}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="builddate" value="${build.date}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="gwt-version" value="${gwt-version}" />
                </replacetokens>
            </filterchain>
            <fileset dir="WebContent">
                <exclude name="**/.svn" />
                <include name="release-notes.html" />
                <include name="license.html" />
                <include name="css/**" />
                <include name="img/**" />
            </fileset>
        </copy>
    </target>

    <target name="compile-server" depends="init, preprocess-src, compile-shared">
        <echo>Compiling server/src</echo>
    	<!-- Compile core sources first as the other sources depend on these -->
        <mkdir dir="${result-classes-server}" />
        <javac destdir="${result-classes-server}" source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.server" debug="true" encoding="UTF-8" includeantruntime="false">
        	<classpath location="${result-classes-shared}"></classpath>
            <src path="${result-src-server}"/>
        </javac>
    </target>

    <target name="compile-client" depends="init, preprocess-src, compile-server, compile-shared">
        <echo>Compiling client/src</echo>
    	<!-- Compile core sources first as the other sources depend on these -->
        <mkdir dir="${result-classes-client}" />
        <javac destdir="${result-classes-client}" source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.client" debug="true" encoding="UTF-8" includeantruntime="false">
        	<classpath location="${result-classes-shared}"></classpath>
        	<classpath location="${result-classes-server}"></classpath>
            <src path="${result-src-client}"/>
        </javac>
    </target>
	
    <target name="compile-client-compiler" depends="init, preprocess-src, compile-client, compile-server, compile-shared">
        <echo>Compiling client-compiler/src</echo>
        <mkdir dir="${result-classes-client-compiler}" />
        <javac destdir="${result-classes-client-compiler}" source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.client-compiler" debug="true" encoding="UTF-8" includeantruntime="false">
            <src path="${result-src-client-compiler}"/>
        	<!-- These could be removed by using class names instead of class references in generators -->
        	<classpath location="${result-classes-shared}"></classpath>
        	<classpath location="${result-classes-client}"></classpath>
        	<classpath location="${result-classes-server}"></classpath>
        </javac>
    </target>
	
    <target name="compile-shared" depends="init, preprocess-src">
        <echo>Compiling shared/src</echo>
    	<!-- Compile core sources first as the other sources depend on these -->
        <mkdir dir="${result-classes-shared}" />
        <javac destdir="${result-classes-shared}" source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.shared" debug="true" encoding="UTF-8" includeantruntime="false">
            <src path="${result-src-shared}"/>
        </javac>
    </target>
	
    <target name="compile-tests" depends="compile-server,compile-client">
        <echo>Compiling src (Server and client side JUnit tests)</echo>
    	<!-- Compile server and client side JUnit tests -->
        <mkdir dir="${result-classes-junit}" />
        <javac source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.server-tests" destdir="${result-classes-junit}" debug="true" encoding="UTF-8" includeantruntime="false">
        	<classpath path="${result-classes-server}"></classpath>
            <src path="${result-src-junit}"/>
        </javac>
    	
        <echo>Compiling SASS JUnit tests</echo>
    	<!-- Compile server and client side JUnit tests -->
        <mkdir dir="${result-classes-sass-junit}" />
        <javac source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.server-tests" destdir="${result-classes-sass-junit}" debug="true" encoding="UTF-8" includeantruntime="false">
        	<classpath path="${result-classes-sass}"></classpath>
            <src path="${result-src-sass-junit}"/>
        </javac>
    	
        <echo>Compiling src (TestBench tests)</echo>
    	<!-- Compile TestBench tests -->
        <mkdir dir="${result-classes-testbench}" />
        <javac source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.server" destdir="${result-classes-testbench}" debug="true" encoding="UTF-8" includeantruntime="false">
        	<classpath path="${result-classes-junit}"></classpath>
        	<classpath path="${result-classes-server}"></classpath>
            <src path="${result-src-testbench}"/>
        </javac>
    	
    </target>

    <target name="compile-helpers" depends="init, compile-sass">
    	<mkdir dir="${buildhelpers-classes}" />
        <javac source="${required.java.version}" target="${required.java.version}" includeantruntime="false" classpathref="compile.classpath.buildhelpers" destdir="${buildhelpers-classes}" debug="true" encoding="UTF-8" >
        	<!-- SASS -->
            <classpath path="${result-classes-sass}" />

            <src path="${buildhelpers-src}"/>
		</javac>
    </target>
    
    <target name="compile-sass" depends="init, preprocess-src">
    	<!-- TODO also perform javacc compilation of the parser -->
        <mkdir dir="${result-classes-sass}" />
        <javac source="${required.java.version}" target="${required.java.version}" includeantruntime="false" srcdir="${result-src-sass}" 
                	classpathref="compile.classpath.server" destdir="${result-classes-sass}" debug="true" encoding="UTF-8" />
    </target>
    
    <target name="defaulttheme" depends="init, compile-sass, compile-helpers" description="Compile all included themes">
        <echo>Combining default themes css files</echo>
        <java classname="com.vaadin.buildhelpers.CompileDefaultTheme" failonerror="yes" fork="yes">
            <arg value="-version" />
            <arg value="${version.full}"/>
            <classpath>
            	<!-- SASS -->
                <path path="${result-classes-sass}" />
                <path location="${buildhelpers-classes}" />
            	<path refid="compile.classpath.buildhelpers" />
            </classpath>
            <jvmarg value="-Djava.awt.headless=true"/>
        </java>
    </target>

    <target name="testtarget">
        <echo>TEST TARGET CALLED</echo>
    </target>

    <!-- ================================================================== -->
    <!-- Widget Set Compilation                                             -->
    <!-- ================================================================== -->
    <!-- Widget set compilation process:                                    -->
    <!--   1. Preprocess sources                                            -->
    <!--   2. Compile server-side java                                      -->
    <!--   3. Generate widget set definitions and classes                   -->
    <!--   4. Compile widget sets                                           -->
    <!--                                                                    -->
    <!-- Widget sets can be built for two purposes:                         -->
    <!--   * for building installation packages                             -->
    <!--   * for building single widget sets during development             -->
    <!--      Targets: widgetset-<name>                                     -->

    <target name="remove-widgetset-gwt-tmp">
        <echo>Removing widgetset temp files</echo>
        <delete dir="${widgetsets-output-dir}/.gwt-tmp" includeemptydirs="true"/>
        <!-- This is generated by GWT 2.3+ for rpcPolicyManifest and symbolMaps, cannot disable -->
        <delete dir="${widgetsets-output-dir}/WEB-INF" includeemptydirs="true" failonerror="false" />
    </target>

    <!-- The widgetset generator is currently compiled along with rest of server-side Java. -->    
    <target name="compile-widgetset-generator" depends="compile-server,compile-client, compile-client-compiler"/>

	<!--  Compiles the widgetset given as the first parameter -->
    <target name="compile-widgetset" depends="init-deps">
        <fail unless="widgetset" message="No widgetset parameter set"/>
        <property name="widgetset-style" value="OBF" />
    	<property name="widgetset-localWorkers" value="2" />
    	<property name="widgetset-extraParams" value="" />
        <echo>Compiling widgetset ${widgetset}. Output directory: ${widgetsets-output-dir}</echo>
    	<mkdir dir="${widgetsets-output-dir}"/>

        <!-- Disabled to reduce JAR size: precompile the widgetset to a .gwtar file -->
    	<!--
        <java classname="com.google.gwt.dev.CompileModule" classpathref="compile.classpath.widgetset" failonerror="yes" fork="yes" maxmemory="512m">
            <arg value="-out" />
            <arg value="${result-precompiled-widgetsets}" />
            <arg value="-strict" />
            <arg value="${widgetset}" />

            <jvmarg value="-Xss8M"/>
            <jvmarg value="-XX:MaxPermSize=256M"/>  
            <jvmarg value="-Djava.awt.headless=true"/>
        </java>
        -->
    	
        <!-- compile the widgetset -->
        <java classname="com.google.gwt.dev.Compiler" classpathref="compile.classpath.widgetset" failonerror="yes" fork="yes" maxmemory="512m">
            <arg value="-war" />
            <arg value="${widgetsets-output-dir}" />
            <arg value="-style" />
            <arg value="${widgetset-style}" />
            <arg value="-strict" />
            <arg value="-localWorkers" />
            <arg value="${widgetset-localWorkers}" />
            <arg line="${widgetset-extraParams}" />
            <arg value="${widgetset}" />
        	
        	<sysproperty key="vFailIfNotSerializable" value="true" />

            <jvmarg value="-Xss8M"/>
            <jvmarg value="-XX:MaxPermSize=256M"/>  
            <jvmarg value="-Djava.awt.headless=true"/>
        </java>
    	
        <antcall target="remove-widgetset-gwt-tmp"/>
        
        <echo>Compiled ${widgetset}</echo>
    </target>
    
    <target name="compile-widgetset-default">
        <antcall target="compile-widgetset">
            <reference refid="compile.classpath.widgetset" />
            <param name="widgetset" value="com.vaadin.terminal.gwt.DefaultWidgetSet"/>
        </antcall>
    </target>
    
    <target name="compile-widgetset-testing">
    	<!-- Crate a path reference containing default widgetset classpath + testbench files -->
    	<path id="compile.classpath.testingwidgetset">
    	 	<path refid="compile.classpath.widgetset" />
    		<pathelement location="${result-classes-testbench}" />
			<pathelement location="${result-src-testbench}" />
    	</path>
        <antcall target="compile-widgetset">
            <reference refid="compile.classpath.testingwidgetset" torefid="compile.classpath.widgetset" />
            <param name="widgetset" value="com.vaadin.tests.widgetset.TestingWidgetSet"/>
        </antcall>
    </target>
	
    <target name="compile-widgetset-portal-default" unless="compile.only.default-widgetset">
        <antcall target="compile-widgetset">
            <reference refid="compile.classpath.widgetset" />
            <param name="widgetset" value="com.vaadin.portal.gwt.PortalDefaultWidgetSet"/>
        </antcall>
    </target>

    <!-- Compiles all widgetsets.                                         -->
    <!-- This is called when building packages and when compiling all     -->
    <!-- widgetsets, but not when compiling individual widgetsets.        -->
    <target name="compile-client-side" depends="compile-gwt, compile-server-side, compile-tests">
        <echo>Compiling widget sets in parallel.</echo>
        <parallel threadsperprocessor="1">
            <antcall inheritrefs="true" target="compile-widgetset-default"/>
            <antcall inheritrefs="true" target="compile-widgetset-testing"/>
            <antcall inheritrefs="true" target="compile-widgetset-portal-default"/>
        </parallel>
    </target>

    <!-- Definitions for building local components, i.e., not for an installation package. -->
    <target name="init-nonpackage" depends="build.properties">
        <!-- Definitions for building the client-side. -->
        <property name="widgetsets-output-dir" value="WebContent/VAADIN/widgetsets" />

        <echo>We are using ${gwt.dev.jar}.</echo>
        <echo>Widget sets output dir: ${widgetsets-output-dir}</echo>
    </target>

    <!-- Builds all widgetsets locally, i.e., not for an installation package. -->
    <target name="widgetsets" depends="init-nonpackage, init, compile-widgetset-generator, compile-client-side"/>

    <!-- Build each widgetset locally, i.e., not for an installation package. -->
    <target name="widgetset-default" depends="init-nonpackage, init, compile-gwt, compile-widgetset-generator, compile-widgetset-default" description="Compile the DefaultWidgetSet"/>
    <target name="widgetset-testing" depends="init-nonpackage, init, compile-gwt, compile-tests, compile-widgetset-generator, compile-widgetset-testing"/>
    <target name="widgetset-portal-default" depends="init-nonpackage, init, compile-gwt, compile-widgetset-generator, compile-widgetset-portal-default"/>

    <!-- ================================================================== -->
    <!-- Libraries and Tests                                                -->
    <!-- ================================================================== -->

    <target name="compile-gwt" depends="init" unless="use.precompiled.gwt">
    	<!-- skipped based on a parameter, use pre-compiled JARs from elsewhere -->
    	<!-- Compile GWT in a directory defined by properties -->
        <ant antfile="${gwt.root}/build.xml" target="user" dir="${gwt.root}" inheritall="false" inheritrefs="false">
            <property name="gwt.root" value="${gwt.root}"/>
        </ant>
        <ant antfile="${gwt.root}/build.xml" target="dev" dir="${gwt.root}" inheritall="false" inheritrefs="false">
            <property name="gwt.root" value="${gwt.root}"/>
        </ant>
        <ant antfile="${gwt.root}/build.xml" target="codeserver" dir="${gwt.root}" inheritall="false" inheritrefs="false">
            <property name="gwt.root" value="${gwt.root}"/>
        </ant>
        <ant antfile="${gwt.root}/build.xml" target="elemental" dir="${gwt.root}" inheritall="false" inheritrefs="false">
            <property name="gwt.root" value="${gwt.root}"/>
        </ant>
    </target>

    <!-- Compile the Vaadin library JAR.                                    -->
    <!-- Need only the default widgetset for this, but can't depend         -->
    <!-- specifically on it, because dependence does not see compiled       -->
    <!-- individual widgetsets, because antcall does not fulfill            -->
    <!-- dependencies.                                                      -->
    <target name="vaadin.jar" depends="compile-server-side, compile-client-side, compile-helpers">
        <echo>Creating JAR (server-side) ${lib-jar-name}</echo>
        <!-- Create Vaadin JAR -->
        <mkdir dir="${output-dir}/META-INF"/>
        <echo file="${output-dir}/META-INF/VERSION">${version.full}</echo> 
        	
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
            classpath="${jarjar-jar}"/>
    	
        <jarjar jarfile="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}"
             compress="true" manifest="build/package/META-INF/MANIFEST.MF" duplicate="preserve" index="true">
            <metainf dir="${output-dir}/META-INF"/>
            <manifest>
                <attribute name="Vaadin-Package-Version" value="1" />
                <attribute name="Vaadin-Widgetsets" value="com.vaadin.terminal.gwt.DefaultWidgetSet" />
                <attribute name="Implementation-Vendor" value="Vaadin Ltd" />
                <attribute name="Implementation-URL" value="http://vaadin.com" />
                <attribute name="Implementation-Version" value="${version.full}" />
            	<!-- No separate GWT-Version attribute or file -->
                <!-- <attribute name="GWT-Version" value="${gwt-version}" /> -->
                <attribute name="GWT-Version-Dependencies" value="${gwt-version-dependencies}" />
                <attribute name="Bundle-Version" value="${version.full}" />
            </manifest>
            <fileset dir="${result-classes-server}"/>
            <fileset dir="${result-classes-client}"/>
            <fileset dir="${result-classes-shared}"/>
            <fileset dir="${result-classes-sass}"/>
            <!-- add sources -->
            <fileset dir="${result-src-server}"/>
            <fileset dir="${result-src-client}"/>
            <fileset dir="${result-src-shared}"/>
            <fileset dir="${result-src-sass}"/>
            <fileset dir="${output-dir}/WebContent">
                <patternset>
                    <include name="VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/**/*" />
                    <include name="VAADIN/themes/base/**/*" />
                    <include name="VAADIN/themes/chameleon/**/*" />
                    <include name="VAADIN/themes/liferay/**/*" />
                    <include name="VAADIN/themes/runo/**/*" />
                    <include name="VAADIN/themes/reindeer/**/*" />
                    <include name="VAADIN/vaadinBootstrap.js" />
                    
                    <include name="release-notes.html" />
                    <include name="license.html" />
                    <include name="css/**" />
                    <include name="img/**" />
                </patternset>
            </fileset>
        	
        	<!-- Precompiled widgetset (.gwtar file) not included to limit JAR size -->
            <!-- <fileset dir="${result-precompiled-widgetsets}" includes="com/vaadin/terminal.gwt.DefaultWidgetSet.gwtar" /> -->

            <!-- TODO GWT related license files etc. should be in subdirectories -->
        	
            <!-- GWT -->
        	<!-- Precompiled GWT modules (.gwtar file) not included to limit JAR size -->
            <zipfileset src="${gwt.user.jar}" excludes="META-INF/**,javax/servlet/**,**/*.gwtar" />

        	<!-- TODO depends on locally compiled gwt-user -->
        	<!--
        	<fileset dir="${gwt.user.dir}/src" excludes="**/package.html" />
            <fileset dir="${gwt.user.dir}/super" excludes="**/package.html" />
            <fileset dir="${gwt.user.bin}" excludes="**/*.gwtar" />

            <zipfileset src="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
            <zipfileset src="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
        	<zipfileset src="${gwt.tools.lib}/streamhtmlparser/streamhtmlparser-jsilver-r10/streamhtmlparser-jsilver-r10-1.5-rebased.jar" />
        	-->

        	<!-- GWT development JAR contents including many external dependencies -->
            <zipfileset src="${gwt.dev.jar}" excludes="javax/servlet/**,javax/xml/**" />

            <!-- Alternative approach: GWT compiler and its dependencies only from the dev JAR -->
            <!--
            <zipfileset src="${gwt.dev.jar}">
                <include name="com/google/gwt/core/client/**"/>
                <include name="com/google/gwt/core/shared/**"/>

            	<include name="com/google/gwt/core/ext/**"/>
                <include name="com/google/gwt/core/linker/**"/>
                <include name="com/google/gwt/dev/About.java"/>
                <include name="com/google/gwt/dev/GwtVersion.java"/>
                <include name="com/google/gwt/dev/Permutation.java"/>
                <include name="com/google/gwt/dev/asm/**"/>
                <include name="com/google/gwt/dev/cfg/**"/>
                <include name="com/google/gwt/dev/javac/**"/>
                <include name="com/google/gwt/dev/jdt/**"/>
                <include name="com/google/gwt/dev/jjs/**"/>
                <include name="com/google/gwt/dev/js/**"/>
                <include name="com/google/gwt/dev/json/**"/>
                <include name="com/google/gwt/dev/resource/**"/>
                <include name="com/google/gwt/dev/util/**"/>
                <include name="com/google/gwt/soyc/**"/>
                <include name="com/google/gwt/util/**"/>
                <include name="org/eclipse/jdt/**"/>
            </zipfileset>
            <zipfileset src="${gwt.tools.lib}/apache/ant-1.6.5.jar" />
            <zipfileset src="${gwt.tools.lib}/eclipse/jdt-3.4.2_r894.jar" />
            <zipfileset src="${gwt.tools.lib}/tomcat/commons-collections-3.1.jar" />
            <zipfileset src="${gwt.tools.lib}/guava/guava-10.0.1/guava-10.0.1-rebased.jar" />
            <zipfileset src="${gwt.tools.lib}/jscomp/r1649/compiler-rebased.jar" />
            -->
        	
        	<!-- GWT SuperDevMode -->
            <zipfileset src="${gwt.codeserver.jar}" />
        	
        	<!-- GWT Elemental -->
            <zipfileset src="${gwt.elemental.jar}" />
        	
        	<!-- jarjar rules: rebase packages from gwt-dev.jar but not those from gwt-user -->
        	
        	<!-- Don't rebase these -->
        	<!-- xalan is used via reflection -->
            <rule pattern="org.apache.xalan.**" result="@0"/>
            <rule pattern="org.apache.xml.**" result="@0"/>
        	<!-- Cannot rebase - used in APIs etc. -->
            <!-- <rule pattern="org.mortbay.**" result="@0"/> -->
            <!-- <rule pattern="org.xml.**" result="@0"/> -->

        	<!-- Rebase these -->
        	<rule pattern="com.gargoylesoftware.**" result="com.vaadin.external.@0"/>
            <rule pattern="com.ibm.**" result="com.vaadin.external.@0"/>
            <rule pattern="com.steadystate.**" result="com.vaadin.external.@0"/>
            <rule pattern="mx4j.**" result="com.vaadin.external.@0"/>
            <rule pattern="net.sourceforge.htmlunit.**" result="com.vaadin.external.@0"/>
            <rule pattern="org.apache.**" result="com.vaadin.external.@0"/>
            <rule pattern="org.cyberneko.**" result="com.vaadin.external.@0"/>
            <rule pattern="org.eclipse.**" result="com.vaadin.external.@0"/>
        	<!-- looked up based on class name? -->
            <rule pattern="org.hibernate.validator.**" result="com.vaadin.external.@0"/>
            <rule pattern="org.jdesktop.swingworker.**" result="com.vaadin.external.@0"/>
            <rule pattern="org.kohsuke.args4j.**" result="com.vaadin.external.@0"/>
        </jarjar>
        
        <!-- Generate the Export-Package attribute in the manifest of the JAR -->
        <java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes">
            <arg value="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}"/>
            <classpath>
                <pathelement location="${buildhelpers-classes}" />
            </classpath>
        </java>
        
        <echo>##teamcity[publishArtifacts '${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}']</echo>
    </target>

    <target name="vaadin-sources.jar" depends="init">
        <jar file="${result-path}/${lib-sources-jar-name}" compress="true">
            <fileset dir="${result-src-server}">
                <patternset>
                    <include name="**/*.java" />
                </patternset>
            </fileset>
            <fileset dir="${result-src-shared}">
                <patternset>
                    <include name="**/*.java" />
                </patternset>
            </fileset>
            <fileset dir="${result-src-client}">
                <patternset>
                    <include name="**/*.java" />
                </patternset>
            </fileset>
            <fileset dir="${result-src-sass}">
                <patternset>
                    <include name="**/*.java" />
                </patternset>
            </fileset>
            <fileset dir="${output-dir}/WebContent">
                <patternset>
                    <include name="release-notes.html" />
                    <include name="license.html" />
                    <include name="css/**" />
                    <include name="img/**" />
                </patternset>
            </fileset>
        </jar>
    </target>
    
    <!-- ================================================================== -->
    <!-- Documentation                                                      -->
    <!-- ================================================================== -->

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
    <!-- Documentation: Add Javadoc to doc                                  -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
    <target name="javadoc" depends="init, preprocess-src">
        <property name="javadoc.destdir" value="${output-dir}/WebContent/docs/api"/>
        
        <javadoc destdir="${javadoc.destdir}" author="true" version="true" use="true" windowtitle="${product-name}" classpathref="compile.classpath.client">
            <packageset dir="${result-src-server}"/>
            <packageset dir="${result-src-client}"/>
            <packageset dir="${result-src-shared}"/>
            <doctitle>${javadoc.doctitle}</doctitle>
            <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
            <bottom>${javadoc.bottom}</bottom>
            <link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="build/javadoc/j2se-1.6.0" />
            <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
        </javadoc>

        <!-- Create a javadoc jar, mainly for Maven -->
        <jar file="${result-path}/${lib-javadoc-jar-name}" compress="true">
            <fileset dir="${javadoc.destdir}">
                <patternset>
                    <include name="**" />
                </patternset>
            </fileset>
            <fileset dir="${output-dir}/WebContent">
                <patternset>
                    <include name="release-notes.html" />
                    <include name="license.html" />
                    <include name="css/**" />
                    <include name="img/**" />
                </patternset>
            </fileset>
        </jar>

        <!-- Append local style definitions. -->
        <echo>Appending local style definitions</echo>
        <concat destfile="${javadoc.destdir}/stylesheet.css" append="yes">
            <filelist dir="build/javadoc" files="stylesheet-local.css"/>
        </concat>
    </target>

    <!-- ================================================================== -->
    <!-- Difference to previous release package.                            -->
    <!-- ================================================================== -->

    <!-- This should be called after the Linux package is ready. -->
    <target name="differences" if="build.differences">
        <exec executable="python" searchpath="true" failonerror="true" output="${result-path}/differences.txt">
            <arg value="build/bin/package-diff.py"/>
            <arg value="${version.full}"/>
        </exec>

        <echo>##teamcity[publishArtifacts '${result-path}/differences.txt']</echo>
    </target>
    
    <!-- ================================================================== -->
    <!-- Custom build.                                                     -->
    <!-- ================================================================== -->

    <!-- Main target for the custom build. -->
    <!-- Need to read custom build configuration before calling clean-result -->
    <target name="custom-build" depends="custom-build-init, clean-result, nightly-init, init, build">
    </target>


    <!-- Initialize a custom build. -->
    <target name="custom-build-init">
        <echo>Preparing a custom build with properties file: ${build.properties.file}</echo>

        <!-- Custom build support -->
        <antcontrib:if>
            <isset property="build.properties.file"/>
            <then>
                <tstamp>
                    <format property="build.date.compact" pattern="yyyyMMdd"/>
                </tstamp>
                <property file="${build.properties.file}" />
                <property name="version" value="${vaadin.version}"/>
                <property name="version.full" value="${version}-${build.date.compact}"/>
            </then>
            <!-- Otherwise version is set by the target "init" -->
        </antcontrib:if>
    </target>

    <target name="custom-build-maven-publish">
        <antcall target="nightly-maven-publish" />
    </target>


    <!-- ================================================================== -->
    <!-- Nightly build.                                                     -->
    <!-- ================================================================== -->

    <!-- Main target for the nightly build. -->
    <target name="nightly" depends="clean-result, nightly-init, init, build, javadoc, differences">
    </target>


    <!-- Initialize a nightly build. -->
    <target name="nightly-init" depends="build.properties">

        <!-- Mandatory parameters. -->
        <fail unless="build.number" message="The build.number property must be defined."/>
        <fail unless="nightly.publish" message="The nightly.publish property must be defined."/>

        <!-- Optional parameters. -->
        <property name="build.tag" value="dev"/>

        <echo>Base version: ${version}</echo>
        <echo>Build number: ${build.number}</echo>
        <echo>Build tag: ${build.tag}</echo>
        <echo>Publish target: ${nightly.publish}</echo>
        <echo>Demo publish target: ${nightly.demo.publish}</echo>

        <!-- Set build number. -->
        <tstamp>
            <format property="nightly.date" pattern="yyyyMMdd"/>
        </tstamp>
        <property name="version.full" value="${version}.${build.tag}-${nightly.date}-${build.number}"/>

        <echo>Version will be: ${version.full}</echo>

        <!-- Tell TeamCity the build name. Have to do it this way, because   -->
        <!-- this script needs to get the plain build number as a parameter. -->
        <echo>##teamcity[buildNumber '${version}-c${build.number}']</echo>
    </target>

    <target name="nightly-teamcity-publish">
        <!-- Publish as a TeamCity artifact. -->
        <echo>##teamcity[publishArtifacts '${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}']</echo>
    </target>

    <!-- Copies the nightly build artifacts to the download server. -->
    <target name="nightly-download-publish" if="nightly.publish">
        <!-- Publish to the download server. -->
        <echo>Installing ${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name} to ${nightly.publish}</echo>
        <echo>Hopefully you have permissions for the copy operation with SSH.</echo>

        <!-- Copy the linux installation package and the JAR. -->
        <exec executable="scp" searchpath="true" resultproperty="nightly.install.scp.result">
            <arg value="-B"/>
            <arg value="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}"/>
            <arg value="${nightly.publish}"/>
        </exec>

        <echo>Result: ${nightly.install.scp.result}</echo>
    </target>

    <!-- Copies the nightly build artifacts to the download server. -->
    <target name="nightly-tests-publish" if="nightly.demo.publish" depends="internal-package-war">
        <fail unless="version.major" message="Major version must be defined in version.major"/>
        <fail unless="version.minor" message="Major version must be defined in version.minor"/>
        
        
        <!-- Publish to the demo server. -->
        <property name="src" value="${result-path}/${test-war-filename}"/>
        <property name="target" value="${nightly.demo.publish}/${version.major}.${version.minor}-${build.tag}.war"/>
        
        <echo>Installing ${src} to ${target}</echo>

        <!-- Copy the linux installation package and the JAR. -->
        <exec executable="scp" searchpath="true" resultproperty="nightly.demo.install.scp.result">
            <arg value="-B"/>
            <arg value="${src}"/>
            <arg value="${target}"/>
        </exec>

        <echo>Result: ${nightly.install.scp.result}</echo>
    </target>

    <target name="nightly-publish" depends="nightly-teamcity-publish, nightly-download-publish, nightly-tests-publish">
    </target>

    
    <target name="nightly-maven-pom.xml">
        <echo>Creating pom.xml for nightly build</echo>
        <property name="vaadin.version.maven" value="${version.major}.${version.minor}-SNAPSHOT" />
        <copy tofile="build/maven/pom.xml">
            <filterchain>
                <expandproperties />
                <replacetokens begintoken="@" endtoken="@">
                    <token key="MAVEN-VERSION" value="${vaadin.version.maven}" />
                </replacetokens>
            </filterchain>
            <fileset file="build/maven/pom-template.xml"/>
        </copy>
    </target>
    
    <target name="nightly-maven-publish" depends="nightly-maven-pom.xml">
        <property file="${gpg.passphrase.file}" />

        <echo>Publishing ${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name} to Maven repository</echo>
        <artifact:mvn failonerror="true">
            <arg value="gpg:sign-and-deploy-file"/>
            <!-- .. is a workaround as maven runs in the build directory -->
            <sysproperty key="file" value="../${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" />
            <sysproperty key="pomFile" value="maven/pom.xml" />
            <sysproperty key="repositoryId" value="vaadin-snapshots" />
            <sysproperty key="url" value="${snapshot.repository.url}" />
            <sysproperty key="gpg.passphrase" value="${gpg.passphrase}" />
        </artifact:mvn>
    </target>

    <target name="local-maven-pom.xml">
        <echo>Creating pom.xml for local test build</echo>
        <fail unless="version.major" message="Major version must be defined in version.major"/>
        <fail unless="version.minor" message="Major version must be defined in version.minor"/>
        <property name="vaadin.version.maven" value="${version.major}.${version.minor}" />
        <copy tofile="build/maven/pom.xml">
            <filterchain>
                <expandproperties />
                <replacetokens begintoken="@" endtoken="@">
                    <token key="MAVEN-VERSION" value="${vaadin.version.maven}" />
                </replacetokens>
            </filterchain>
            <fileset file="build/maven/pom-template.xml"/>
        </copy>
    </target>
    
    <target name="local-maven-publish" depends="local-maven-pom.xml">
        <echo>Publishing ${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name} to the local Maven repository</echo>
        <artifact:mvn>
            <arg value="install:install-file"/>
            <!-- .. is a workaround as maven runs in the build directory -->
            <sysproperty key="file" value="../${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" />
            <sysproperty key="pomFile" value="maven/pom.xml" />
        </artifact:mvn>
    </target>

    <!-- ================================================================== -->
    <!-- Automated tests.                                                   -->
    <!-- ================================================================== -->

    <target name="tests" depends="compile-tests, internal-package-war">
        <!-- Run all different types of tests in parallel to decrease testing time -->
        <parallel threadcount="3">
        	<sequential>
                <!-- Sleep before running integration tests so testbench tests have time to compile and start -->
                <sleep minutes="4" /> 
                <antcall inheritrefs="true" inheritall="true" target="integration-tests"></antcall>
        	</sequential>
            <antcall inheritrefs="true" inheritall="true" target="testbench-tests"></antcall>
            <antcall inheritrefs="true" inheritall="true" target="server-side-tests"></antcall>
            <antcall inheritrefs="true" inheritall="true" target="sass-tests"></antcall>
        </parallel>
    </target>
    
    <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task-->
    <target name="server-side-tests" unless="tests.serverside.skip" depends="compile-tests">
        <junit printsummary="yes"> 
            <classpath> 
                <pathelement path="${result-classes-server}" />
                <pathelement path="${result-classes-junit}" />
            	<path refid="compile.classpath.server-tests"></path>
            </classpath>

            <batchtest fork="yes">
                <fileset dir="tests/server-side" includes="**/*.java" excludes="**/Abstract*.java,com/vaadin/tests/data/bean/*.java,com/vaadin/tests/util/*.java,**/VaadinClasses.java" />
                <fileset dir="tests/client-side" includes="**/*.java" excludes="**/Abstract*.java" />
            </batchtest>
        </junit>
    </target>

    <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task-->
    <target name="sass-tests" unless="tests.serverside.skip" depends="compile-tests">
        <junit printsummary="yes"> 
            <classpath> 
                <pathelement path="${result-src-sass-junit}" />
                <pathelement path="${result-classes-sass}" />
                <pathelement path="${result-classes-sass-junit}" />
            	<path refid="compile.classpath.server-tests"></path>
            </classpath>

            <batchtest fork="yes">
                <fileset dir="${result-src-sass-junit}" includes="**/*.java" excludes="**/Abstract*.java" />
            </batchtest>
        </junit>
    </target>

    <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task-->
    <target name="testbench-tests" unless="tests.testbench.skip">
        <fail unless="product-file" message="The 'product-file' property must be defined."/>
        <fail unless="version" message="The 'version' property must be defined."/>

        <echo>Version: ${version.full}</echo>

        <!-- Parameters for the test.xml script. -->
        <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined."/>
        <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined."/>
        <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined."/>

        <property name="com.vaadin.testbench.screenshot.block.error" value="0.025"/>
        <property name="com.vaadin.testbench.debug" value="false"/>
        <property name="package.name" value="${base-name}"/>

        <!-- Only Linux tests allowed. TODO: Generalize this. -->
        <property name="package.filename" value="${result-path}/${test-war-filename}"/>

        <!-- Run the separate test script. -->
        <ant antfile="tests/test.xml" target="test-package" inheritall="false" inheritrefs="true">
            <!-- This is provided so that the test script can copy the -->
            <!-- "tests" classes after unpacking the package.          -->
            <property name="output-dir" value="${output-dir}"/>

            <!-- Convert tests to run multiple times if failed. -->
            <property name="retries" value="2"/>
                        	
            <property name="package.filename" value="${basedir}/${package.filename}"/>
            <property name="testing.testarea" value="/tmp/testarea"/>
            <property name="package.name" value="${package.name}"/>
            <property name="test-output-dir" value="../build/test-output" />
            <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}"/>
            <property name="com.vaadin.testbench.deployment.url" value="${com.vaadin.testbench.deployment.url}"/>
            <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}"/>
            <property name="com.vaadin.testbench.debug" value="${com.vaadin.testbench.debug}"/>
            <property name="com.vaadin.testbench.screenshot.block.error" value="${com.vaadin.testbench.screenshot.block.error}"/>
        	
        	<property name="deps.initialized"  value="${deps.initialized}"/>
        		
        </ant>
    	
    </target>

    <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task-->
    <target name="integration-tests" depends="init-deps" unless="tests.integration.skip">
        <!-- Parameters for the test.xml script. -->
        <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined."/>
        <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined."/>
        <fail unless="sshkey.file" message="The 'sshkey.file' property must be defined."/>

        <!-- Empty passphrase if no passphrase defined -->
        <property name="passphrase" value="" />
        <property name="tests.war" location="${result-path}/${test-war-filename}" />
        
        <!-- Run the separate test script. -->
        <ant antfile="tests/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="true">
              <!-- This is provided so that the test script can copy the -->
              <!-- "tests" classes after unpacking the package.          -->
              <property name="output-dir" value="${output-dir}"/>

              <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}"/>
              <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}"/>
              <property name="sshkey.file" value="${sshkey.file}" />
              <property name="passphrase" value="${passphrase}" />
              <property name="demo.war" value="${tests.war}"/>
        	
              <property name="deps.initialized"  value="${deps.initialized}"/>
        </ant>
    </target>
</project>

<!-- These are for emacs. -->
<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:nil
sgml-general-insert-case:lower
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:4
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:("/etc/sgml/catalog" "/usr/share/xemacs21/xemacs-packages/etc/psgml-dtds/CATALOG")
sgml-local-ecat-files:("ECAT" "~/sgml/ECAT" "/usr/share/sgml/ECAT" "/usr/local/share/sgml/ECAT" "/usr/local/lib/sgml/ECAT")
End:
-->