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
|
<?xml version="1.0" ?>
<project name="Red5" basedir="." default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- This build file requires Apache Ant >= 1.7 -->
<condition property="ant-at-least-7">
<antversion atleast="1.7.0"/>
</condition>
<!-- project properties -->
<property environment="env"/>
<property name="java.home" value="${env.JDK_HOME}"/>
<property name="src.dir" value="src"/>
<property name="dist.dir" value="dist"/>
<property name="cluster.dir" value="cluster"/>
<property name="origindist.dir" value="${cluster.dir}/origin"/>
<property name="edgedist.dir" value="${cluster.dir}/edge"/>
<property name="log.dir" value="log"/>
<property name="lib.dir" value="lib"/>
<property name="classes.dir" value="bin"/>
<property name="webapps.dir" value="webapps"/>
<property name="webapps.build.dir" value="${dist.dir}/webapps"/>
<property name="config.dir" value="src/conf"/>
<property name="javadoc.dir" value="doc/api"/>
<property name="debug.state" value="true"/>
<!-- Documentation properties -->
<property name="doc.ref.dir" value="doc/reference"/>
<property name="doc.ref.lib" value="${doc.ref.dir}/lib"/>
<property name="javadoc.style" value="${doc.ref.dir}/styles/javadoc.css"/>
<!-- unit testing -->
<property name="test.dir" value="test"/>
<property name="testclass.dir" value="bin/testcases/classes"/>
<property name="testreports.dir" value="bin/testcases/testreports"/>
<property name="testdoc.dir" value="doc/test"/>
<!-- base project properties -->
<property file="build.properties"/>
<!-- user overides for project properties -->
<property file="${user.home}/build.properties"/>
<!-- Hudson auto-builds and release properties -->
<!-- Hudson will set BUILD_TAG when running -->
<condition property="archive.version" value="${red5.version}-build-${env.BUILD_TAG}">
<isset property="env.BUILD_TAG"/>
</condition>
<!-- And if we're not in Hudson, just use the red5.version property -->
<condition property="archive.version" value="${red5.version}">
<not>
<isset property="archive.version"/>
</not>
</condition>
<property name="red5.zip" value="${red5.filename}-${archive.version}.zip"/>
<property name="red5.archive" value="${red5.filename}-${archive.version}.tar.gz"/>
<tstamp prefix="build">
<format property="TODAY" pattern="d-MMMM-yyyy" locale="en"/>
</tstamp>
<!-- Special directory destination for WAR build - unused in normal server build -->
<property name="tmp.war.dir" value=""/>
<!--
Ivy tasks and lib directory
http://ant.apache.org/ivy
http://testearly.com/2007/06/24/ivy-in-42-steps
-->
<taskdef uri="antlib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml" classpath="${lib.dir}/${ivy.version}.jar"/>
<!-- Latest ivy 9/2008 seems to want absolute path -->
<property name="ivy.lib.dir" value="${basedir}/lib"/>
<path id="debian.build.classpath.id">
<pathelement path="${debian.build.classpath}"/>
</path>
<path id="debian.test.classpath.id">
<pathelement path="${debian.test.classpath}"/>
</path>
<path id="project.classpath">
<path refid="debian.build.classpath.id" />
</path>
<path id="script.classpath">
<path refid="debian.build.classpath.id" />
<pathelement location="${classes.dir}"/>
</path>
<path id="full.classpath">
<path refid="debian.build.classpath.id" />
<path refid="debian.test.classpath.id" />
<fileset dir="./">
<filename name="${red5.filename}.jar"/>
<filename name="boot.jar"/>
</fileset>
</path>
<path id="runtime.classpath">
<path refid="debian.build.classpath.id" />
</path>
<!-- Build Targets -->
<target name="-java6.check">
<condition property="java6.installed" value="true">
<and>
<equals arg1="${java.target_version}" arg2="1.6"/>
<available property="java6.installed" classname="javax.script.Bindings"/>
</and>
</condition>
<condition property="java6.using" value="1.6" else="${java.target_version}">
<isset property="java6.installed"/>
</condition>
<echo message="Using Java ${java6.using}"/>
</target>
<!-- Check for the main libraries -->
<target name="-library.check">
<echo message="Java: java.home is ${java.home} and the target version is ${java.target_version}"/>
<echo message="Ant: ant.home is ${ant.home} and the target version is ${ant.version}"/>
<!-- May want to add repository availability checking
<condition property="repository.offline.googlecode" value="true">
<isreachable host="red5.googlecode.com" timeout="30" />
</condition>
<echo message='Repository access: googlecode=${repository.offline.googlecode}'/>
-->
<condition property="library.installed" value="true">
<and>
<or>
<and>
<available property="spring.installed" classpathref="project.classpath" classname="org.springframework.core.SpringVersion"/>
<available property="logging.installed" classpathref="project.classpath" classname="org.slf4j.Logger"/>
<available property="catalina.installed" classpathref="project.classpath" classname="org.apache.catalina.Server"/>
<available property="mina.installed" classpathref="project.classpath" classname="org.apache.mina.filter.codec.ProtocolEncoder"/>
<available property="minajmx.installed" classpathref="project.classpath" classname="org.apache.mina.integration.jmx.IoServiceManager"/>
<available property="acegi.installed" classpathref="project.classpath" classname="org.acegisecurity.SecurityConfig"/>
<equals arg1="${java.target_version}" arg2="1.6"/>
</and>
<and>
<available property="spring.installed" classpathref="project.classpath" classname="org.springframework.core.SpringVersion"/>
<available property="logging.installed" classpathref="project.classpath" classname="org.slf4j.Logger"/>
<available property="catalina.installed" classpathref="project.classpath" classname="org.apache.catalina.Server"/>
<available property="mina.installed" classpathref="project.classpath" classname="org.apache.mina.filter.codec.ProtocolEncoder"/>
<available property="minajmx.installed" classpathref="project.classpath" classname="org.apache.mina.integration.jmx.IoServiceManager"/>
<available property="acegi.installed" classpathref="project.classpath" classname="org.acegisecurity.SecurityConfig"/>
<available property="script.installed" classpathref="project.classpath" classname="com.sun.phobos.script.javascript.RhinoScriptEngine"/>
<available property="groovy.script.installed" classpathref="project.classpath" classname="com.sun.script.groovy.GroovyScriptEngine"/>
<available property="jython.script.installed" classpathref="project.classpath" classname="com.sun.script.jython.JythonScriptEngine"/>
<equals arg1="${java.target_version}" arg2="1.5"/>
</and>
</or>
<and>
<isset property="ivy.conf.name"/>
<!-- check for the test jars -->
<available property="junit.installed" classpathref="project.classpath" classname="org.junit.Test"/>
<available property="groboutils.installed" classpathref="project.classpath" classname="net.sourceforge.groboutils.junit.v1.TestRunnable"/>
<available property="spring-mock.installed" classpathref="project.classpath" classname="org.springframework.mock.web.MockServletConfig"/>
<equals arg1="ivy.conf.name" arg2="test"/>
</and>
</and>
</condition>
</target>
<target name="prepare" description="Setup the directories for building">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${log.dir}"/>
<mkdir dir="${dist.dir}/${log.dir}"/>
<mkdir dir="${cluster.dir}"/>
<mkdir dir="${origindist.dir}"/>
<mkdir dir="${edgedist.dir}"/>
<mkdir dir="${testclass.dir}"/>
<mkdir dir="${testreports.dir}"/>
</target>
<target name="clean" description="Clean the directories for building">
<delete file="${red5.filename}.jar"/>
<delete file="boot.jar"/>
<delete file="ivy.log"/>
<delete dir="${classes.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${cluster.dir}"/>
<delete dir="${javadoc.dir}"/>
<delete dir="${testdoc.dir}"/>
<delete includeemptydirs="true">
<fileset dir="${webapps.dir}/" includes="**/*.class"/>
</delete>
<delete includeemptydirs="true">
<fileset dir="${webapps.dir}/" includes="**/*.jar"/>
</delete>
<delete>
<fileset dir="." includes="*.tar.gz"/>
<fileset dir="." includes="*.zip"/>
</delete>
</target>
<target name="retrieve" unless="library.installed" description="Retrieves the libraries if needed">
<!-- Ivy configuration - http://ant.apache.org/ivy/history/trunk/ant.html -->
<ivy:settings file="ivysettings.xml"/>
<condition property="ivy.conf.name" value="java6">
<not>
<isset property="ivy.conf.name"/>
</not>
</condition>
<echo message="Ivy conf name: ${ivy.conf.name}"/>
<ivy:resolve file="ivy.xml" conf="${ivy.conf.name}"/>
<ivy:retrieve conf="${ivy.conf.name}"/>
</target>
<target name="ivyclear" description="Clears out the Ivy cache">
<delete dir="${user.home}/.ivy2/cache"/>
<delete includeemptydirs="true">
<fileset dir="${lib.dir}" excludes="**/ivy*.jar"/>
</delete>
</target>
<target name="compile" depends="-library.check, -java6.check, prepare" description="Compiles the server">
<!-- token replacement filers -->
<property name="filter.file" value="${config.dir}/build_standalone.properties"/>
<condition property="java.target_version" value="1.5">
<not>
<isset property="java.target_version"/>
</not>
</condition>
<echo message="javac version: ${java.target_version}"/>
<condition property="eclipse.using" value="Using" else="Not using">
<isset property="eclipse.running"/>
</condition>
<echo message="${eclipse.using} the Eclipse IDE"/>
<condition property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter">
<isset property="eclipse.running"/>
</condition>
<condition property="compiler" value="${build.compiler}${java.target_version}">
<equals arg1="${build.compiler}" arg2="javac"/>
</condition>
<property name="compiler" value="${build.compiler}"/>
<echo message="Compiler adapter name: ${compiler}"/>
<!-- destination for compiled classes -->
<property name="dest.dir" value="${classes.dir}"/>
<!-- standard excludes for compile -->
<property name="std_excludes" value="**/*.jsp,org/red5/server/script/**"/>
<antcall target="compile-core" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-core-compatibility" inheritAll="true" inheritRefs="true"/>
<!-- libraries and classes needed for building the demos -->
<path id="webapps.classpath">
<fileset dir="${lib.dir}">
<filename name="*.jar"/>
</fileset>
<pathelement location="${classes.dir}"/>
</path>
<antcall target="compile-demos" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-script" inheritAll="true" inheritRefs="true"/>
</target>
<!-- Core -->
<target name="compile-core" if="java6.installed" description="Build server core">
<antcall target="retrieve" inheritAll="true" inheritRefs="true">
<param name="ivy.conf.name" value="java6"/>
</antcall>
<javac sourcepath="" srcdir="${src.dir}" destdir="${dest.dir}" classpathref="project.classpath"
optimize="${build.optimize}" verbose="${build.verbose}" fork="${build.fork}" nowarn="${build.nowarn}"
deprecation="${build.deprecation}" debug="${debug.state}" compiler="${compiler}"
source="${java.target_version}" target="${java.target_version}" memoryMaximumSize="${memory.maximum}"
excludes="${std_excludes}" listfiles="false"/>
<!-- touch this source file so that the revision number will be updated upon svn commit -->
<touch file="${src.dir}/org/red5/server/api/Red5.java"/>
</target>
<target name="compile-core-compatibility" unless="java6.installed">
<antcall target="retrieve" inheritAll="true" inheritRefs="true">
<param name="ivy.conf.name" value="java5"/>
</antcall>
<javac sourcepath="" srcdir="${src.dir}" destdir="${dest.dir}" classpathref="project.classpath"
optimize="${build.optimize}" verbose="${build.verbose}" fork="${build.fork}" nowarn="${build.nowarn}"
deprecation="${build.deprecation}" debug="${debug.state}" compiler="${compiler}"
source="${java.target_version}" target="${java.target_version}" memoryMaximumSize="${memory.maximum}"
excludes="${std_excludes}" listfiles="false"/>
</target>
<macrodef name="build-demo">
<attribute name="name"/>
<element name="copy-assets" optional="yes"/>
<sequential>
<mkdir dir="${webapps.build.dir}/@{name}/WEB-INF/classes"/>
<mkdir dir="${webapps.build.dir}/@{name}/WEB-INF/lib"/>
<javac sourcepath="" srcdir="${webapps.dir}/@{name}/WEB-INF/src" destdir="${webapps.build.dir}/@{name}/WEB-INF/classes"
classpathref="webapps.classpath" optimize="${build.optimize}" verbose="${build.verbose}"
fork="${build.fork}" nowarn="${build.nowarn}" deprecation="${build.deprecation}"
debug="${debug.state}" compiler="${compiler}" source="${java.target_version}" target="${java.target_version}"/>
<copy todir="${webapps.build.dir}/@{name}" filtering="true">
<fileset dir="webapps/@{name}">
<exclude name="**/src/**"/>
<exclude name="**/*.flv"/>
<exclude name="**/*.meta"/>
</fileset>
</copy>
<!-- copy other demo files (optional) -->
<copy-assets/>
</sequential>
</macrodef>
<macrodef name="logback">
<attribute name="webapp"/>
<sequential>
<!-- copy the logback config per webapp and associated jars -->
<copy todir="${webapps.build.dir}/@{webapp}/WEB-INF/classes" file="webapps/@{webapp}/WEB-INF/src/logback-@{webapp}.xml"
overwrite="true"/>
</sequential>
</macrodef>
<!-- Demos -->
<target name="compile-demos" description="Build demo apps">
<echo message="Webapps dir: ${webapps.dir}"/>
<echo message="Webapps build dir: ${webapps.build.dir}"/>
<!-- load token replacement filters -->
<filter filtersfile="${filter.file}"/>
<copy todir="${webapps.build.dir}/root" filtering="true">
<fileset dir="webapps/root">
<exclude name="**/src/**"/>
<exclude name="**/*.swf"/>
<exclude name="**/*.png"/>
<exclude name="**/*.jpg"/>
<exclude name="demos"/>
</fileset>
</copy>
<!-- copy SWF without filtering as it causes corruption -->
<copy todir="${webapps.build.dir}/root">
<fileset dir="webapps/root">
<include name="**/*.swf"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<exclude name="demos"/>
</fileset>
</copy>
<!-- installer -->
<!-- load token replacement filters -->
<filter filtersfile="${filter.file}"/>
<copy todir="${webapps.build.dir}/installer" filtering="true">
<fileset dir="webapps/installer">
<exclude name="**/src/**"/>
<exclude name="**/*.swf"/>
</fileset>
</copy>
<!-- copy SWF without filtering to prevent file corruption -->
<copy todir="${webapps.build.dir}/installer">
<fileset dir="webapps/installer">
<include name="**/*.swf"/>
</fileset>
</copy>
<!-- copy the demos if they dont exist in the tree -->
<copy todir="${webapps.build.dir}/root/demos" failonerror="false">
<fileset dir="../../../flash/trunk/deploy">
<include name="**/*.*"/>
<exclude name=".svn"/>
</fileset>
</copy>
</target>
<!-- Scripting -->
<target name="compile-script" depends="prepare">
<available property="scripting_compatibility" classpathref="project.classpath" classname="javax.script.ScriptEngineManager"/>
<condition property="scripting.using" value="Scripting compatibility is available." else="No compatibility for scripting available">
<istrue value="${scripting_compatibility}"/>
</condition>
<javac sourcepath="" srcdir="${src.dir}" destdir="${dest.dir}" classpathref="script.classpath"
optimize="${build.optimize}" verbose="${build.verbose}" fork="${build.fork}" nowarn="${build.nowarn}"
deprecation="${build.deprecation}" debug="${debug.state}" compiler="${compiler}"
source="${java.target_version}" target="${java.target_version}" memoryMaximumSize="${memory.maximum}"
includes="org/red5/server/script/**" listfiles="false"/>
<echo message="${scripting.using}"/>
</target>
<target name="compile-war" depends="-library.check, -java6.check, clean, prepare">
<!-- token replacement filers -->
<property name="filter.file" value="${config.dir}/war/build_war.properties"/>
<condition property="java.target_version" value="1.6">
<not>
<isset property="java.target_version"/>
</not>
</condition>
<echo message="javac version: ${java.target_version}"/>
<condition property="compiler" value="${build.compiler}${java.target_version}">
<equals arg1="${build.compiler}" arg2="javac"/>
</condition>
<property name="compiler" value="${build.compiler}"/>
<echo message="Compiler adapter name: ${compiler}"/>
<mkdir dir="${classes.dir}/WEB-INF/classes"/>
<property name="dest.dir" value="${classes.dir}/WEB-INF/classes"/>
<property name="std_excludes" value="${server.war.excludes}"/>
<antcall target="compile-core" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-core-compatibility" inheritAll="true" inheritRefs="true"/>
<!-- libraries and classes needed for building the demos -->
<path id="webapps.classpath">
<fileset dir="${lib.dir}">
<filename name="*.jar"/>
</fileset>
<pathelement location="${dest.dir}"/>
</path>
<antcall target="compile-demos" inheritAll="true" inheritRefs="true"/>
<antcall target="compile-script" inheritAll="true" inheritRefs="true">
<param name="dest.dir" value="${classes.dir}/WEB-INF/classes"/>
</antcall>
</target>
<macrodef name="compile-wardemo">
<attribute name="name"/>
<sequential>
<war destfile="${dist.dir}/@{name}.war" webxml="${webapps.build.dir}/@{name}/WEB-INF/web.xml">
<fileset dir="${webapps.build.dir}/@{name}">
<exclude name="WEB-INF"/>
<exclude name="**/src/**"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</war>
</sequential>
</macrodef>
<target name="war-demos" description="Build wars for demo apps" depends="compile-demos">
<!-- copy installer swf etc under root/installer -->
<mkdir dir="${webapps.build.dir}/root/installer"/>
<copy todir="${webapps.build.dir}/root/installer">
<fileset dir="${webapps.build.dir}/installer"/>
</copy>
<!-- war up root -->
<war destfile="${dist.dir}/ROOT.war" webxml="${webapps.build.dir}/root/WEB-INF/web.xml">
<fileset dir="${webapps.build.dir}/root"/>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</war>
</target>
<target name="javadoc" description="Generate JavaDoc">
<condition property="available.envpath" value="Path: ${env.Path}" else="Not using env.Path">
<isset property="env.Path"/>
</condition>
<echo message="${available.envpath}"/>
<!-- Determine the location of Sun's API docs -->
<condition property="javadoc.loc" value="javase/6">
<equals arg1="${java6.installed}" arg2="true"/>
</condition>
<condition property="javadoc.loc" value="j2se/1.5.0">
<not>
<equals arg1="${java6.installed}" arg2="true"/>
</not>
</condition>
<javadoc useexternalfile="true" failonerror="false" verbose="false" classpathref="full.classpath"
destdir="${javadoc.dir}" author="true" version="true" use="true" splitindex="true"
windowtitle="${documentation.title}" stylesheetfile="${javadoc.style}">
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/red5/**"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.xsd"/>
</fileset>
<doctitle><![CDATA[<h1>${documentation.title}</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © ${red5.age} <a href="${red5.url}" target="_blank">${red5.name}</a></i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Public API" packages="org.red5.server.api:org.red5.server.api.*"/>
<group title="Network Protocols" packages="org.red5.server.net:org.red5.server.net.*"/>
<group title="Streaming" packages="org.red5.server.stream:org.red5.server.stream.*"/>
<group title="IO Packages" packages="org.red5.io:org.red5.io.*"/>
<group title="Scripting" packages="org.red5.server.script:org.red5.server.script.*"/>
<link href="/usr/share/doc/default-jdk-doc/api/"/>
<link href="/usr/share/doc/libmina2-java/api/"/>
<link href="/usr/share/doc/liblog4j1.2-java/api/"/>
<link href="/usr/share/doc/groovy/api/"/>
</javadoc>
<echo message="Javadoc API stub: ${javadoc.loc}"/>
<echo message="Javadoc CSS: ${doc.ref.dir} ${javadoc.style}"/>
</target>
<macrodef name="compile-jardemo">
<attribute name="name"/>
<element name="copy-assets" optional="yes"/>
<sequential>
<jar destfile="${webapps.build.dir}/@{name}/WEB-INF/lib/@{name}.jar">
<fileset dir="${webapps.build.dir}/@{name}/WEB-INF/classes">
<include name="**"/>
</fileset>
</jar>
<!-- copy files (optional) -->
<copy-assets/>
</sequential>
</macrodef>
<!-- Determine classpath for jar file -->
<target name="jar-determine-classpath" depends="compile" unless="jar.classpath">
<!--
<manifestclasspath property="jar.classpath" jarfile="${red5.filename}.jar">
<classpath refid="runtime.classpath"/>
</manifestclasspath>
-->
</target>
<target name="jar" description="Make Archive" depends="jar-determine-classpath">
<jar destfile="${red5.filename}.jar">
<fileset dir="${classes.dir}">
<exclude name="**/org/red5/server/Bootstrap.class"/>
<exclude name="**/org/red5/server/Shutdown.class"/>
<exclude name="**/org/red5/server/LoaderMBean.class"/>
<exclude name="**/org/red5/classloading/**"/>
<include name="**/org/**"/>
<include name="**/META-INF**"/>
</fileset>
<manifest>
<attribute name="Red5-Version" value="${red5.version}"/>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
<metainf dir="${src.dir}/META-INF">
<include name="**"/>
</metainf>
</jar>
<!-- Bootstrap, Shutdown, and classloaders -->
<jar destfile="boot.jar">
<fileset dir="${classes.dir}">
<include name="**/org/red5/server/Bootstrap.class"/>
<include name="**/org/red5/server/Shutdown.class"/>
<include name="**/org/red5/server/LoaderMBean.class"/>
<include name="**/org/red5/classloading/**"/>
<include name="**/META-INF**"/>
</fileset>
<manifest>
<attribute name="Red5-Version" value="${red5.version}"/>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
<attribute name="Main-Class" value="org.red5.server.Bootstrap"/>
</manifest>
<metainf dir="${src.dir}/META-INF">
<include name="**"/>
</metainf>
</jar>
</target>
<target name="dist" description="Create binary distribution" depends="jar">
<copy todir="${dist.dir}/conf">
<fileset dir="${config.dir}">
<!-- exclude war config files -->
<exclude name="**/war/**"/>
<exclude name="**/jboss/**"/>
</fileset>
</copy>
<copy todir="${dist.dir}/webapps" file="webapps\red5-default.xml"/>
<copy todir="${dist.dir}">
<fileset dir="./">
<include name="${red5.filename}.jar"/>
<include name="boot.jar"/>
<include name="red5.bat"/>
<include name="red5-shutdown.bat"/>
<include name="red5.sh"/>
<include name="red5-shutdown.sh"/>
<include name="red5-debug.sh"/>
<include name="red5-debug.bat"/>
<include name="red5-highperf.sh"/>
<include name="red5-highperf.bat"/>
<include name="license.txt"/>
</fileset>
</copy>
<chmod file="${dist.dir}/red5.sh" perm="755"/>
<chmod file="${dist.dir}/red5-shutdown.sh" perm="755"/>
<chmod file="${dist.dir}/red5-debug.sh" perm="755"/>
<chmod file="${dist.dir}/red5-highperf.sh" perm="755"/>
</target>
<target name="dist-installer" description="Create installer distribution" depends="clean, ivyclear, dist, javadoc">
<copy todir="${dist.dir}/doc">
<fileset dir="doc"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir="./">
<include name=".classpath"/>
<include name=".project"/>
<include name=".springBeans"/>
<include name="build.xml"/>
<include name="build.properties"/>
<include name="Makefile"/>
<include name="red5-debug.bat"/>
<include name="red5-debug.sh"/>
</fileset>
</copy>
<chmod file="${dist.dir}/red5-debug.sh" perm="755"/>
<!-- include war config files -->
<copy todir="${dist.dir}/conf">
<fileset dir="${config.dir}">
<include name="**/war/**"/>
<include name="**/jboss/**"/>
</fileset>
</copy>
<!--
<copy todir="${dist.dir}/src">
<fileset dir="src"/>
</copy>
-->
<copy todir="${webapps.build.dir}">
<fileset dir="webapps">
<include name="**/src/**"/>
</fileset>
</copy>
<copy todir="${webapps.build.dir}/root/demos" failonerror="false">
<fileset dir="../../../flash/trunk/deploy"/>
</copy>
<!-- zip the source instead of copying verbatim -->
<zip destfile="${dist.dir}/src.zip" basedir="${src.dir}" level="9"/>
</target>
<target name="dist-archive" depends="dist-installer" description="Create archive file for distribution">
<touch>
<fileset dir="${dist.dir}"/>
</touch>
<!--
We use exec instead of tar here because Ant's tar
can't preserve file permissions.
-->
<!-- Create a directory with the right subname -->
<exec dir="." executable="rm" osfamily="unix">
<arg line="-rf ${red5.filename}-${archive.version}"/>
</exec>
<exec dir="." executable="cp" osfamily="unix">
<arg line="-rf ${dist.dir} ${red5.filename}-${archive.version}"/>
</exec>
<!-- tar that directory -->
<exec dir="." executable="tar" osfamily="unix">
<!-- p: perserve permissions
c: compress
z: gzip
v: list files processed
f: archive -->
<arg value="-pczvf"/>
<arg value="${red5.archive}"/>
<arg value="${red5.filename}-${archive.version}"/>
</exec>
<!-- and remove the tmp directory -->
<exec dir="." executable="rm" osfamily="unix">
<arg line="-rf ${red5.filename}-${archive.version}"/>
</exec>
<!-- Now we create a zip file for our windows friends;
file permissions won't be preserved and it'll unzip into
the directory it's in, but that's standard windows fare -->
<zip destfile="${red5.zip}" basedir="${dist.dir}" level="9">
<zipfileset prefix="${archive.version}/" dir="${dist.dir}">
<include name="${dist.dir}/**"/>
<exclude name="${dist.dir}/*.sh"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="${archive.version}/" filemode="755">
<include name="${dist.dir}/*.sh"/>
</zipfileset>
</zip>
</target>
<target name="dist-edge" depends="dist-origin">
<!-- Copies edge build and then puts config into place. -->
<copy todir="${edgedist.dir}/">
<fileset dir="${dist.dir}">
<exclude name="**/build.properties"/>
<exclude name="**/build.xml"/>
<exclude name="**/Makefile"/>
<exclude name="**/doc/**"/>
<exclude name="**/conf/red5-origin.xml"/>
<exclude name="**/conf/red5-origin-core.xml"/>
<exclude name="**/conf/red5.xml"/>
<exclude name="**/docs/**"/>
<exclude name="**/dumps/**"/>
<exclude name="**/src/**"/>
<exclude name="**/swf/**"/>
<exclude name="**/webapps/**"/>
</fileset>
</copy>
<copy todir="${edgedist.dir}/webapps">
<fileset file="${dist.dir}/webapps/red5-default.xml"/>
</copy>
<move tofile="${edgedist.dir}/conf/red5.xml" file="${edgedist.dir}/conf/red5-edge.xml"
overwrite="true"/>
<chmod file="${edgedist.dir}/red5.sh" perm="755"/>
<chmod file="${edgedist.dir}/red5-shutdown.sh" perm="755"/>
</target>
<target name="dist-origin" depends="dist-installer">
<!-- Copies dist build and then puts config into place. -->
<copy todir="${origindist.dir}/">
<fileset dir="${dist.dir}">
<exclude name="**/conf/red5.xml"/>
</fileset>
</copy>
<move tofile="${origindist.dir}/conf/red5.xml" file="${dist.dir}/conf/red5-origin.xml"
overwrite="true"/>
<chmod file="${origindist.dir}/red5.sh" perm="755"/>
<chmod file="${origindist.dir}/red5-shutdown.sh" perm="755"/>
</target>
<target name="dist-cluster" description="Create Edge/Origin distribution" depends="dist-edge">
<copy tofile="${cluster.dir}/Readme.txt" file="${dist.dir}/doc/HOWTO-Clustering.txt" overwrite="true"/>
<echo>Edge configured in: ${edgedist.dir}</echo>
<echo>Origin configured in: ${origindist.dir}</echo>
</target>
<target name="dist-macosx" description="Create Mac OSX installer">
<ant antfile="install/macosx/build.xml" inheritAll="false"/>
</target>
<target name="dist-windows" description="Create Windows installer">
<ant antfile="install/windows/build.xml" inheritAll="false"/>
</target>
<target name="dist-debian" description="Create Debian package" depends="dist-installer">
<!-- 1. update "debian/changelog" and add an entry for the new version you are
building. Note that the syntax must match the previous entries!
2. Update the filename in "debian/files" to match the version you are
building.
3. Run this task from the Red5 root -->
<mkdir name="${dist.dir}/debian"/>
<!-- Copies debian files to dist -->
<copy todir="${dist.dir}/debian/">
<fileset dir="${basedir}/install/debian"/>
</copy>
<exec executable="dpkg-buildpackage" dir="${dist.dir}" failonerror="true">
<arg line="-uc -b -rfakeroot"/>
</exec>
</target>
<target name="dist-redhat" description="Create Redhat installer" depends="dist-installer">
<exec executable="rpm" failonerror="true">
<arg line="-ba install/redhat/red5.spec"/>
</exec>
</target>
<target name="server" depends="dist" description="Compile and start the server">
<echo message="Using ${dist.dir} for Red5 root"/>
<mkdir dir="${dist.dir}/${log.dir}"/>
<java classname="org.red5.server.Bootstrap" fork="true">
<classpath>
<pathelement location="${dist.dir}/conf"/>
<pathelement location="${dist.dir}/boot.jar"/>
</classpath>
<!-- Unusable until policy is fixed
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${dist.dir}/conf/red5.policy"/>
-->
<jvmarg value="-Dpython.home=${dist.dir}/lib"/>
<jvmarg value="-Dred5.root=${dist.dir}"/>
</java>
</target>
<target name="shutdown">
<java classname="org.red5.server.Shutdown" fork="true">
<classpath>
<pathelement location="${dist.dir}/conf"/>
<pathelement location="${dist.dir}/boot.jar"/>
</classpath>
<!-- Unusable until policy is fixed
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${dist.dir}/conf/red5.policy"/>
-->
<!-- enable the following 2 lines if your using JMX with SSL and auth -->
<!--
<jvmarg value="-Djavax.net.ssl.trustStore=${dist.dir}/conf/truststore.jmx"/>
<jvmarg value="-Djavax.net.ssl.trustStorePassword=trustword"/>
-->
<jvmarg value="-Dred5.root=${dist.dir}"/>
<arg value="9999"/>
<arg value="red5user"/>
<arg value="changeme"/>
</java>
</target>
<target name="udp-server" depends="compile" description="Compile and start experimental UDP server">
<java classname="org.red5.server.net.udp.Standalone" fork="true">
<classpath>
<pathelement location="${config.dir}"/>
<pathelement location="${classes.dir}"/>
<path refid="full.classpath"/>
</classpath>
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${config.dir}/red5.policy"/>
</java>
</target>
<target name="run-tests" depends="compile-tests" description="Run unit tests and generate HTML reports">
<!-- copy config contents to test conf dir -->
<mkdir dir="${testdist.dir}/../bin/conf"/>
<copy todir="${testdist.dir}/../bin/conf">
<fileset dir="${src.dir}/conf">
<include name="**/*.properties"/>
</fileset>
</copy>
<junit fork="true" haltonfailure="no" printsummary="yes" showoutput="no" failureproperty="test.failure.property"
dir="${testreports.dir}">
<classpath>
<pathelement location="${testclass.dir}"/>
<pathelement location="${testdist.dir}/conf"/>
<pathelement location="${testdist.dir}/boot.jar"/>
<pathelement location="${testdist.dir}/red5.jar"/>
<path refid="full.classpath"/>
</classpath>
<formatter type="xml"/>
<batchtest todir="${testreports.dir}">
<fileset dir="${testclass.dir}">
<include name="**/*Test.class"/>
<exclude name="**/Abstract*Test.class"/>
<exclude name="**/*AbstractTest.class"/>
</fileset>
</batchtest>
</junit>
<condition property="test.allPassed" else="yes" value=" !!!!!! NO !!!!!">
<isset property="test.failure.property"/>
</condition>
<mkdir dir="${testdoc.dir}"/>
<junitreport todir="${testdoc.dir}">
<fileset dir="${testreports.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${testdoc.dir}"/>
</junitreport>
<echo message="Did all tests pass: ${test.allPassed}"/>
</target>
<target name="run-tests-systemtest" depends="compile-tests" description="Runs some end-to-end system tests against a test server using a Flash client">
<!-- Copy over all self-run scripts -->
<!-- Note we use cp, and not <copy> to preserve permission
semantics. This means this target will NOT run directly
on Windows without Cygwin, which is fine because
all the shell scripts are .sh scripts. It is left
as an exercise for the reader to develop a .bat version
that can actually run processes in the background. -->
<!-- Finally, don't use fully qualified paths here; that
can screw up Cygwin -->
<exec executable="cp">
<arg line="-rf"/>
<arg line="${test.dir}/scripts"/>
<arg line="${testdist.dir}/"/>
</exec>
<exec executable="bash" dir="${testreports.dir}/fixtures" failonerror="true">
<arg line="${testdist.dir}/scripts/red5-flash-player-headless"/>
<arg line="red5-selftest.swf"/>
<env key="PATH" path="${env.PATH}:${testdist.dir}/scripts"/>
<env key="RED5_HOME" path="${testdist.dir}"/>
</exec>
</target>
<target name="run-tests-server" depends="compile-tests" description="Run the selftest server">
<echo message="Using ${testdist.dir} for Red5 root"/>
<mkdir dir="${testdist.dir}/${log.dir}"/>
<java classname="org.red5.server.Bootstrap" fork="true" dir="${testdist.dir}">
<classpath>
<pathelement location="${testdist.dir}/conf"/>
<pathelement location="${testdist.dir}/boot.jar"/>
</classpath>
<!-- Unusable until policy is fixed
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-Djava.security.policy=${testdist.dir}/conf/red5.policy"/>
-->
<jvmarg value="-Dpython.home=${testdist.dir}/lib"/>
<jvmarg value="-Dred5.root=${testdist.dir}"/>
</java>
</target>
<target name="compile-tests" depends="dist" description="Compiles unit test classes">
<property name="testdist.dir" location="${testreports.dir}/dist"/>
<echo>Making dist for testing</echo>
<mkdir dir="${testdist.dir}"/>
<mkdir dir="${testreports.dir}/fixtures"/>
<mkdir dir="${testreports.dir}/log"/>
<!-- Give the tests their own dist installation to work with -->
<antcall target="dist" inheritAll="false" inheritRefs="false">
<param name="dist.dir" value="${testdist.dir}"/>
</antcall>
<!-- Copy all test config files into the dist/conf of the
test distribution. The JUnit task below will add this
directory to the classpath -->
<copy todir="${testdist.dir}/conf" overwrite="true">
<fileset dir="${test.dir}" includes="**/*.xml" excludes="www/**/*"/>
<fileset dir="${test.dir}" includes="**/*.properties" excludes="www/**/*"/>
</copy>
<!-- Install the self-test application that tests depend on -->
<copy todir="${testdist.dir}/webapps/selftest" overwrite="true">
<fileset dir="${test.dir}/www/" includes="**/*"/>
</copy>
<copy todir="${testreports.dir}/fixtures" overwrite="true">
<fileset dir="${test.dir}/fixtures" includes="**/*"/>
</copy>
<echo>Libraries checked: ${library.installed}</echo>
<antcall target="retrieve" inheritAll="true" inheritRefs="true">
<param name="ivy.conf.name" value="utest"/>
</antcall>
<available property="junit.installed" classname="junit.framework.TestCase"/>
<mkdir dir="${testclass.dir}"/>
<javac srcdir="${test.dir}" destdir="${testclass.dir}" optimize="${build.optimize}" verbose="${build.verbose}"
fork="${build.fork}" nowarn="${build.nowarn}" deprecation="${build.deprecation}"
debug="${debug.state}" compiler="${build.compiler}">
<classpath>
<pathelement location="${testdist.dir}/conf"/>
<pathelement location="${testdist.dir}/boot.jar"/>
<pathelement location="${testdist.dir}/red5.jar"/>
<path refid="full.classpath"/>
</classpath>
</javac>
<mkdir dir="${testdist.dir}/webapps/selftest/WEB-INF/classes"/>
<copy todir="${testdist.dir}/webapps/selftest/WEB-INF/classes" overwrite="true">
<fileset dir="${testclass.dir}" includes="**/*.class"/>
</copy>
</target>
<target name="webwar" description="Make Web Archive" depends="compile-war">
<!-- token replacement filers -->
<filter filtersfile="${config.dir}/war/build_war.properties"/>
<copy todir="${classes.dir}">
<fileset dir=".">
<include name="license.txt"/>
</fileset>
</copy>
<!-- remove directories we dont want -->
<delete dir="${classes.dir}/testcases"/>
<!-- cleanup "standalone" red5-web files -->
<delete>
<fileset dir="${webapps.build.dir}" includes="**/red5-web.*"/>
</delete>
<!-- add the configs to the root war -->
<filter token="display.name" value=""/>
<filter token="webapp.root.key" value="/"/>
<filter token="context.path" value="/"/>
<copy tofile="${webapps.build.dir}/root/META-INF/context.xml" overwrite="true" filtering="true"
file="${config.dir}/war/root-context.xml"/>
<copy todir="${webapps.build.dir}/root/WEB-INF" overwrite="true" filtering="true">
<fileset dir="${config.dir}/war">
<include name="web.xml"/>
</fileset>
</copy>
<copy todir="${webapps.build.dir}/root/WEB-INF/classes" overwrite="true" filtering="true">
<fileset dir="${config.dir}">
<include name="*.jmx"/>
<include name="access.properties"/>
<include name="password.properties"/>
</fileset>
<fileset dir="${config.dir}/war">
<include name="logback.xml"/>
<include name="beanRefContext.xml"/>
<include name="defaultContext.xml"/>
<include name="red5-common.xml"/>
<include name="red5-core.xml"/>
<include name="*-web.xml"/>
</fileset>
</copy>
<!-- copy installer swf etc under root/installer -->
<mkdir dir="${webapps.build.dir}/root/installer"/>
<copy todir="${webapps.build.dir}/root/installer">
<fileset dir="${webapps.build.dir}/installer"/>
</copy>
<delete dir="${webapps.build.dir}/root/installer/WEB-INF"/>
<!-- war up root -->
<war destfile="${dist.dir}/ROOT.war" webxml="${webapps.build.dir}/root/WEB-INF/web.xml">
<fileset dir="${webapps.build.dir}/root"/>
<fileset dir="${classes.dir}">
<exclude name="**/logback.xml"/>
</fileset>
<lib dir="${lib.dir}">
<exclude name="*.properties"/>
<exclude name="jsp*.jar"/>
<exclude name="servlet*.jar"/>
<exclude name="catalina*.jar"/>
<exclude name="tomcat*.jar"/>
<exclude name="annotations-api*.jar"/>
<exclude name="el-api*.jar"/>
<exclude name="jetty*.jar"/>
<exclude name="jasper*.jar"/>
<exclude name="ehcache*.jar"/>
<exclude name="whirly*.jar"/>
<exclude name="Grobo*.jar"/>
<exclude name="grobo*.jar"/>
<exclude name="junit*.jar"/>
<exclude name="ivy*.jar"/>
</lib>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</war>
<!-- cleanup -->
<delete dir="${dist.dir}/webapps"/>
</target>
<target name="remote-jar" description="Creates a jar that may be deployed with remote applications"
depends="compile">
<mkdir dir="${classes.dir}/conf"/>
<copy todir="${classes.dir}/conf">
<fileset dir="${config.dir}">
<exclude name="**/war/**"/>
<exclude name="**/jboss/**"/>
</fileset>
</copy>
<jar destfile="${dist.dir}/red5-remoting.jar">
<fileset dir="${classes.dir}">
<include name="**/AMFTunnelServlet.class"/>
<include name="**/ServletUtils.class"/>
<include name="**/red5/compatibility/**"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${red5.fullname}"/>
<attribute name="Built-On" value="${build.TODAY}"/>
</manifest>
</jar>
</target>
<target name="rtmps-keystore" description="RTMPS Keystore Generator">
<input message="Keystore Pass" addproperty="keystore.storepass" defaultvalue="password"/>
<input message="Certificate Validity" addproperty="keystore.validity" defaultvalue="365"/>
<input message="Common Name" addproperty="keystore.dname.cn" defaultvalue="localhost"/>
<input message="Organisation Unit" addproperty="keystore.dname.ou" defaultvalue="${red5.name}"/>
<input message="Organisation" addproperty="keystore.dname.o" defaultvalue="${red5.name}"/>
<input message="Location" addproperty="keystore.dname.l" defaultvalue="Henderson"/>
<input message="State" addproperty="keystore.dname.st" defaultvalue="NV"/>
<input message="Country" addproperty="keystore.dname.c" defaultvalue="US"/>
<delete file="${config.dir}/keystore"/>
<genkey alias="red5" keysize="512" keyalg="RSA" storepass="${keystore.storepass}" keypass="${keystore.storepass}"
keystore="${config.dir}/keystore" validity="${keystore.validity}">
<dname>
<param name="CN" value="${keystore.dname.cn}"/>
<param name="OU" value="${keystore.dname.ou}"/>
<param name="O" value="${keystore.dname.o}"/>
<param name="L" value="${keystore.dname.l}"/>
<param name="ST" value="${keystore.dname.st}"/>
<param name="C" value="${keystore.dname.c}"/>
</dname>
</genkey>
</target>
<target name="truststore" depends="rtmps-keystore" description="JConsole Client Truststore">
<copy file="${config.dir}/keystore" tofile="${config.dir}/keystore.jmx" overwrite="true"/>
<copy file="${config.dir}/keystore.jmx" tofile="${config.dir}/truststore.jmx" overwrite="true"/>
<echo>Verifying Keystore ${keystore.storepass}</echo>
<exec dir="." executable="keytool">
<arg line="-list -v -keystore ${config.dir}/keystore.jmx -storepass ${keystore.storepass}"/>
</exec>
<echo>Export Server Certificate</echo>
<exec dir="." executable="keytool">
<arg line="-export -alias red5 -keystore ${config.dir}/keystore.jmx -file ${config.dir}/red5server.cer -storepass ${keystore.storepass}"/>
</exec>
<echo>Import Server Certificate into TrustStore</echo>
<exec dir="." executable="keytool">
<arg line="-import -file conf/red5server.cer -keystore ${config.dir}/truststore.jmx -storepass ${keystore.storepass} -noprompt"/>
</exec>
<echo>Verifying Truststore</echo>
<exec dir="." executable="keytool">
<arg line="-list -v -keystore ${config.dir}/truststore.jmx -storepass ${keystore.storepass}"/>
</exec>
</target>
<!-- JConsole -->
<target name="console">
<exec dir="." executable="jconsole">
<arg line="-J-Djava.util.logging.config.file=${config.dir}/management.logging.properties -J-Djava.security.manager -J-Djava.security.policy=${config.dir}/red5.policy -J-Djavax.net.ssl.trustStore=${config.dir}/truststore.jmx -J-Djavax.net.ssl.trustStorePassword=password -J-Dssl.debug=true -J-Djava.security.debug=ssl service:jmx:rmi:///jndi/rmi://localhost:9999/red5"/>
</exec>
</target>
<!-- JConsole with SSL -->
<target name="console-ssl">
<exec dir="." executable="jconsole">
<arg line="-J-Djava.util.logging.config.file=${config.dir}/management.logging.properties -J-Djava.security.manager -J-Djava.security.policy=${config.dir}/red5.policy -J-Djavax.net.ssl.trustStore=${config.dir}/truststore.jmx -J-Djavax.net.ssl.trustStorePassword=password -J-Djavax.net.ssl.keyStore=${config.dir}/keystore.jmx -J-Djavax.net.ssl.keyStorePassword=password -J-Dssl.debug=true -J-Djava.security.debug=ssl service:jmx:rmi:///jndi/rmi://localhost:9999/red5"/>
</exec>
</target>
<!-- XSLT task because default is not customizable -->
<macrodef name="dbxslt">
<attribute name="xincludes" default="true"/>
<attribute name="out" default=""/>
<attribute name="in" default=""/>
<attribute name="style" default=""/>
<attribute name="basedir" default="${doc.ref.dir}"/>
<attribute name="params" default=""/>
<sequential>
<condition property="xslt.out" value="" else="-o @{out}">
<length string="@{out}" trim="true" length="0"/>
</condition>
<condition property="xslt.xincludes" value="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"
else="">
<equals arg1="@{xincludes}" arg2="true"/>
</condition>
<java classname="com.icl.saxon.StyleSheet" fork="true" dir="@{basedir}">
<classpath>
<pathelement location="/usr/share/java/saxon.jar"/>
<pathelement location="/usr/share/java/xercesImpl.jar"/>
<pathelement location="/usr/share/java/xmlParserAPIs.jar"/>
</classpath>
<jvmarg line="${xslt.xincludes}"/>
<jvmarg value="-Dxslthl.config=file:///usr/share/xml/docbook/stylesheet/nwalsh/highlighting/xslthl-config.xml"/>
<jvmarg value="-Xms128m"/>
<jvmarg value="-Xmx512m"/>
<arg line="${xslt.out} @{in} @{style} @{params}"/>
</java>
</sequential>
</macrodef>
<macrodef name="wiki2docbook">
<attribute name="host" default=""/>
<attribute name="username" default=""/>
<attribute name="password" default=""/>
<attribute name="dir" default="${basedir}/${doc.ref.dir}"/>
<attribute name="parent-page" default=""/>
<attribute name="page" default=""/>
<attribute name="type" default="chapter"/>
<attribute name="basePath" default="Documentation/UsersReferenceManual"/>
<sequential>
<!--
<condition property="wiki.page" value="" else="-s @{page}">
<equals arg1="@{page}" arg2=""/>
</condition>
<condition property="wiki.parent-page" value="" else="-P @{parent-page}">
<equals arg1="@{parent-page}" arg2=""/>
</condition>
<echo>${wiki.parent-page}</echo>
<echo>@{page}</echo>
-->
<java classname="org.red5.trac.TracWiki2DocbookClient" fork="true" dir="@{dir}" classpathref="doc.lib.classpath">
<arg value="-h @{host}"/>
<arg value="-u @{username}"/>
<arg value="-p @{password}"/>
<arg value="-d @{dir}"/>
<arg value="-t @{type}"/>
<arg value="-b @{basePath}"/>
<arg value="@{page}"/>
<jvmarg value="-Xmx512m"/>
</java>
</sequential>
</macrodef>
<!-- FOP Task because default cannot send memory args -->
<macrodef name="fop-pdf">
<attribute name="basedir" default="."/>
<attribute name="fofile" default=""/>
<attribute name="outfile" default=""/>
<sequential>
<java classname="org.apache.fop.cli.Main" dir="@{basedir}" fork="true" failonerror="true"
classpathref="doc.lib.classpath">
<sysproperty key="java.awt.headless" value="true"/>
<jvmarg value="-Xms128m"/>
<jvmarg value="-Xmx512m"/>
<jvmarg value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog"/>
<arg value="-fo"/>
<arg path="@{fofile}"/>
<arg value="-pdf"/>
<arg path="@{outfile}"/>
</java>
</sequential>
</macrodef>
<!-- Check if Docbook libraries are installed -->
<target name="doc-prepare" description="Extra preparation for the documentation" unless="doc.prepare">
<path id="doc.lib.classpath">
<fileset dir="${basedir}/${doc.ref.lib}/docbook">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/${doc.ref.lib}/tracwiki2docbook">
<include name="*.jar"/>
</fileset>
</path>
<sequential>
<get src="http://red5.electroteque.org/doc/reference/docbook-reference-libs.tar.bz2"
dest="${basedir}/${doc.ref.dir}/docbook-reference-libs.tar.bz2"
verbose="true"
usetimestamp="true"/>
<untar compression="bzip2" src="${basedir}/${doc.ref.dir}/docbook-reference-libs.tar.bz2" dest="${basedir}/${doc.ref.dir}/" overwrite="false"/>
</sequential>
<property name="doc.prepare" value="true"/>
</target>
<!-- Clean doc source -->
<target name="doc-clean" unless="doc.prepare">
<delete dir="${basedir}/${doc.ref.dir}/pdf"/>
<delete dir="${basedir}/${doc.ref.dir}/html"/>
<delete dir="${basedir}/${doc.ref.dir}/html_single"/>
</target>
<target name="doc-wiki2docbook" description="Compile reference documentation in PDF format" unless="doc.wiki2docbook">
<!-- Build fo file -->
<wiki2docbook
host="${trac.url}"
username="${trac.username}"
password="${trac.password}"
page="-P ${trac.page}"
basePath="Documentation/UsersReferenceManual"
dir="${basedir}/${doc.ref.dir}/src/"
/>
<wiki2docbook
host="${trac.url}"
username="${trac.username}"
password="${trac.password}"
page="-s Changelog"
dir="${basedir}/${doc.ref.dir}/src/"
type="appendix"
/>
<wiki2docbook
host="${trac.url}"
username="${trac.username}"
password="${trac.password}"
page="-P Codecs"
basePath="Codecs"
dir="${basedir}/${doc.ref.dir}/src/"
type="appendix"
/>
<property name="doc.wiki2docbook" value="true"/>
</target>
<!-- PDF Documentation -->
<target name="doc-pdf" description="Compile reference documentation in PDF format">
<delete dir="${basedir}/${doc.ref.dir}/pdf"/>
<antcall target="doc-prepare" inheritAll="true" inheritRefs="true"/>
<antcall target="doc-wiki2docbook" inheritAll="true" inheritRefs="true"/>
<!-- Build fo file -->
<mkdir dir="${basedir}/${doc.ref.dir}/pdf"/>
<dbxslt basedir="${basedir}/${doc.ref.dir}/src" in="${basedir}/${doc.ref.dir}/src/index.xml"
out="${basedir}/${doc.ref.dir}/src/docbook_fop.tmp" style="${basedir}/${doc.ref.dir}/styles/fopdf.xsl"/>
<!-- Build pdf -->
<fop-pdf basedir="${basedir}/${doc.ref.dir}/src" fofile="${basedir}/${doc.ref.dir}/src/docbook_fop.tmp"
outfile="${basedir}/${doc.ref.dir}/pdf/red5-reference-0.9.pdf"/>
<delete file="${doc.ref.dir}/src/docbook_fop.tmp"/>
</target>
<!-- HTML Site Documentation -->
<target name="doc-html" description="Compile reference documentation in HTML format">
<delete dir="${basedir}/${doc.ref.dir}/html"/>
<delete dir="${basedir}/${doc.ref.dir}/html_single"/>
<antcall target="doc-prepare" inheritAll="true" inheritRefs="true"/>
<antcall target="doc-wiki2docbook" inheritAll="true" inheritRefs="true"/>
<mkdir dir="${basedir}/${doc.ref.dir}/html"/>
<mkdir dir="${basedir}/${doc.ref.dir}/html/images"/>
<copy todir="${basedir}/${doc.ref.dir}/html/images">
<fileset dir="${basedir}/${doc.ref.dir}/src/images">
<include name="*.gif"/>
<include name="*.svg"/>
<include name="*.jpg"/>
<include name="*.png"/>
</fileset>
</copy>
<copy todir="${basedir}/${doc.ref.dir}/html/" failonerror="false">
<fileset dir="${basedir}/${doc.ref.dir}/styles/">
<include name="*.css"/>
<include name="*.js"/>
</fileset>
</copy>
<dbxslt basedir="${basedir}/${doc.ref.dir}/html/" in="${basedir}/${doc.ref.dir}/src/index.xml"
style="${basedir}/${doc.ref.dir}/styles/html_chunk.xsl"/>
</target>
<!-- HTML Single Documentation -->
<target name="doc-html-single" depends="doc-prepare" description="Compile reference documentation in single page HTML format">
<mkdir dir="${basedir}/${doc.ref.dir}/html"/>
<mkdir dir="${doc.ref.dir}/html_single/images"/>
<copy todir="${basedir}/${doc.ref.dir}/html_single/images">
<fileset dir="${basedir}/${doc.ref.dir}/src/images">
<include name="*.gif"/>
<include name="*.svg"/>
<include name="*.jpg"/>
<include name="*.png"/>
</fileset>
</copy>
<copy todir="${basedir}/${doc.ref.dir}/html_single/" file="${basedir}/${doc.ref.dir}/styles/html.css"
failonerror="false"/>
<dbxslt basedir="${basedir}/${doc.ref.dir}/html_single/" in="${basedir}/${doc.ref.dir}/src/index.xml"
out="${basedir}/${doc.ref.dir}/html_single/index.html" style="${basedir}/${doc.ref.dir}/styles/html.xsl"/>
</target>
<!-- Build all documentation formats -->
<target name="doc-all" depends="doc-prepare,doc-wiki2docbook, doc-pdf, doc-html" description="Generate all reference documentation">
<sequential>
<antcall target="doc-clean" inheritAll="true" inheritRefs="true"/>
<antcall target="doc-pdf" inheritAll="true" inheritRefs="true"/>
<antcall target="doc-html" inheritAll="true" inheritRefs="true"/>
</sequential>
</target>
<!--
Requirements:
1. Go here: http://subclipse.tigris.org/svnant.html
2. Download SvnAnt
ex: http://subclipse.tigris.org/files/documents/906/43359/svnant-1.2.1.zip
3. Unzip the archive and place the jar files in your Ant lib directory
ex: C:\dev\ant\lib
-->
<!-- checks out the source tree -->
<target name="checkout">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<svn>
<checkout url="${svn.url}java/server/trunk/" revision="HEAD" destPath="."/>
</svn>
</target>
<!-- checks out the source tree from the top-most level -->
<target name="checkout-all">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<svn>
<!-- we are three levels down -->
<checkout url="${svn.url}" revision="HEAD" destPath="../../../"/>
</svn>
</target>
<!-- Updates snapshot repository -->
<target name="upload-snapshot" depends="jar">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<condition property="java.version.name" value="java5" else="java6">
<not>
<isset property="java6.installed"/>
</not>
</condition>
<svn username="${svn.login}" password="${svn.password}" failonerror="true">
<update dir="${basedir}"/>
<status path="build.xml" textStatusProperty="svn.info.status" lastChangedRevisionProperty="svn.info.lastrev"
revisionProperty="svn.info.rev"/>
</svn>
<echo message="Svn info - status: ${svn.info.status} last rev: ${svn.info.lastrev} rev: ${svn.info.rev}"/>
<property name="snapshot.name" value="red5-${red5.version}-r${svn.info.rev}-${java.version.name}.jar"/>
<property name="snapshot.path" value="../../../snapshots/"/>
<echo message="Destination: ${snapshot.path}${snapshot.name}"/>
<!-- make a copy of the red5.jar with a versioned name + the java version -->
<move file="red5.jar" tofile="${snapshot.path}${snapshot.name}"/>
<!-- check if the file is already versioned -->
<svn username="${svn.login}" password="${svn.password}" failonerror="false">
<status path="${svn.url}/snapshots/${snapshot.name}" textStatusProperty="svn.info.status"/>
</svn>
<echo message="Svn info - status: ${svn.info.status}"/>
<condition property="add-file" value="true" else="false">
<equals arg1="${svn.info.status}" arg2="unversioned"/>
</condition>
<echo message="File does not exist in repository: ${add-file}"/>
<antcall target="svn-add" inheritAll="true" inheritRefs="true">
<param name="file.path" value="${snapshot.path}${snapshot.name}"/>
</antcall>
<!--
may need to add options depending upon svn client install
javahl="true|false" svnkit="true|false"
-->
<svn username="${svn.login}" password="${svn.password}" failonerror="false">
<commit message="Added snapshot" file="${snapshot.path}${snapshot.name}"/>
</svn>
</target>
<target name="svn-add" if="add-file">
<svn username="${svn.login}" password="${svn.password}" failonerror="false">
<add file="${file.path}" force="true"/>
</svn>
</target>
<target name="all" depends="clean, prepare, compile, jar, javadoc" description="Run all server tasks"/>
<target name="usage">
<echo message="Type ant -p for available targets"/>
</target>
</project>
|